1139804Simp/*- 297372Smarcel * Copyright (c) 1990, 1991 Regents of The University of Michigan. 397372Smarcel * All Rights Reserved. 497372Smarcel * 597372Smarcel * Permission to use, copy, modify, and distribute this software and 697372Smarcel * its documentation for any purpose and without fee is hereby granted, 797372Smarcel * provided that the above copyright notice appears in all copies and 897372Smarcel * that both that copyright notice and this permission notice appear 997372Smarcel * in supporting documentation, and that the name of The University 1097372Smarcel * of Michigan not be used in advertising or publicity pertaining to 1197372Smarcel * distribution of the software without specific, written prior 1297372Smarcel * permission. This software is supplied as is without expressed or 1397372Smarcel * implied warranties of any kind. 1497372Smarcel * 1597372Smarcel * Research Systems Unix Group 1697372Smarcel * The University of Michigan 1797372Smarcel * c/o Mike Clark 1897372Smarcel * 535 W. William Street 1997372Smarcel * Ann Arbor, Michigan 2097372Smarcel * +1-313-763-0525 2197372Smarcel * netatalk@itd.umich.edu 2297372Smarcel * 2397372Smarcel * $FreeBSD$ 2497372Smarcel */ 2597372Smarcel 2697372Smarcel#ifndef _NETATALK_DDP_H_ 27116182Sobrien#define _NETATALK_DDP_H_ 28116182Sobrien 29116182Sobrien/*- 3097372Smarcel * <-1byte(8bits) -> 3197372Smarcel * +---------------+ 3297372Smarcel * | 0 | hopc |len| 3397372Smarcel * +---------------+ 3497372Smarcel * | len (cont) | 3597372Smarcel * +---------------+ 3697372Smarcel * | | 3797372Smarcel * +- DDP csum -+ 38102263Sbde * | | 3997372Smarcel * +---------------+ 40181803Sbz * | | 4197372Smarcel * +- Dest NET -+ 4297372Smarcel * | | 4397372Smarcel * +---------------+ 4497372Smarcel * | | 4597372Smarcel * +- Src NET -+ 4697372Smarcel * | | 4797372Smarcel * +---------------+ 4897372Smarcel * | Dest NODE | 4997372Smarcel * +---------------+ 5097372Smarcel * | Src NODE | 5197372Smarcel * +---------------+ 5297372Smarcel * | Dest PORT | 5397372Smarcel * +---------------+ 5497372Smarcel * | Src PORT | 5597372Smarcel * +---------------+ 5697372Smarcel * 5797372Smarcel * On Apples, there is also a ddp_type field, after src_port. However, under 5897372Smarcel * this unix implementation, user level processes need to be able to set the 5997372Smarcel * ddp_type. In later revisions, the ddp_type may only be available in a 6097372Smarcel * raw_appletalk interface. 6197372Smarcel */ 6297372Smarcel 6397372Smarcelstruct elaphdr { 6497372Smarcel u_char el_dnode; 6597372Smarcel u_char el_snode; 6697372Smarcel u_char el_type; 6797372Smarcel} __packed; 6897372Smarcel 6997372Smarcel#define SZ_ELAPHDR 3 7097372Smarcel 7197372Smarcel#define ELAP_DDPSHORT 0x01 7297372Smarcel#define ELAP_DDPEXTEND 0x02 7397372Smarcel 7497372Smarcel/* 7597372Smarcel * Extended DDP header. Includes sickness for dealing with arbitrary 7697372Smarcel * bitfields on a little-endian arch. 7797372Smarcel */ 7897372Smarcelstruct ddpehdr { 7997372Smarcel union { 8097372Smarcel struct { 8197372Smarcel#if BYTE_ORDER == BIG_ENDIAN 8297372Smarcel unsigned dub_pad:2; 8397372Smarcel unsigned dub_hops:4; 8497372Smarcel unsigned dub_len:10; 8597372Smarcel unsigned dub_sum:16; 8697372Smarcel#endif 8797372Smarcel#if BYTE_ORDER == LITTLE_ENDIAN 8897372Smarcel unsigned dub_sum:16; 8997372Smarcel unsigned dub_len:10; 9097372Smarcel unsigned dub_hops:4; 9197372Smarcel unsigned dub_pad:2; 9297372Smarcel#endif 9397372Smarcel } __packed du_bits; 9497372Smarcel unsigned du_bytes; 9597372Smarcel } deh_u; 96108172Shsu u_short deh_dnet; 97181803Sbz u_short deh_snet; 9897372Smarcel u_char deh_dnode; 9997372Smarcel u_char deh_snode; 10097372Smarcel u_char deh_dport; 10197372Smarcel u_char deh_sport; 10297372Smarcel} __packed; 10397372Smarcel#define deh_pad deh_u.du_bits.dub_pad 10497372Smarcel#define deh_hops deh_u.du_bits.dub_hops 105108172Shsu#define deh_len deh_u.du_bits.dub_len 10697372Smarcel#define deh_sum deh_u.du_bits.dub_sum 10797372Smarcel#define deh_bytes deh_u.du_bytes 10897372Smarcel 10997372Smarcel#define DDP_MAXHOPS 15 110108172Shsu 11197372Smarcelstruct ddpshdr { 11297372Smarcel union { 11397372Smarcel struct { 114124835Srse#if BYTE_ORDER == BIG_ENDIAN 11597372Smarcel unsigned dub_pad:6; 11697372Smarcel unsigned dub_len:10; 11797372Smarcel unsigned dub_dport:8; 11897372Smarcel unsigned dub_sport:8; 11997372Smarcel#endif 120168975Spjd#if BYTE_ORDER == LITTLE_ENDIAN 12197372Smarcel unsigned dub_sport:8; 12297372Smarcel unsigned dub_dport:8; 12397372Smarcel unsigned dub_len:10; 12497372Smarcel unsigned dub_pad:6; 12597372Smarcel#endif 12697372Smarcel } __packed du_bits; 12797372Smarcel unsigned du_bytes; 12897372Smarcel } dsh_u; 12997372Smarcel} __packed; 13097372Smarcel 13197372Smarcel#define dsh_pad dsh_u.du_bits.dub_pad 13297372Smarcel#define dsh_len dsh_u.du_bits.dub_len 13397372Smarcel#define dsh_dport dsh_u.du_bits.dub_dport 13497372Smarcel#define dsh_sport dsh_u.du_bits.dub_sport 135150303Smarcel#define dsh_bytes dsh_u.du_bytes 136150303Smarcel 13797372Smarcel#endif /* _NETATALK_DDP_H_ */ 13897372Smarcel