ddp.h revision 139827
1296341Sdelphij/*- 296593Smarkm * Copyright (c) 1990,1991 Regents of The University of Michigan. 396593Smarkm * All Rights Reserved. 4142429Snectar * 596593Smarkm * Permission to use, copy, modify, and distribute this software and 696593Smarkm * its documentation for any purpose and without fee is hereby granted, 796593Smarkm * provided that the above copyright notice appears in all copies and 896593Smarkm * that both that copyright notice and this permission notice appear 996593Smarkm * in supporting documentation, and that the name of The University 1096593Smarkm * of Michigan not be used in advertising or publicity pertaining to 1196593Smarkm * distribution of the software without specific, written prior 1296593Smarkm * permission. This software is supplied as is without expressed or 1396593Smarkm * implied warranties of any kind. 1496593Smarkm * 1596593Smarkm * Research Systems Unix Group 1696593Smarkm * The University of Michigan 1796593Smarkm * c/o Mike Clark 1896593Smarkm * 535 W. William Street 1996593Smarkm * Ann Arbor, Michigan 20215698Ssimon * +1-313-763-0525 21215698Ssimon * netatalk@itd.umich.edu 22215698Ssimon * 23215698Ssimon * $FreeBSD: head/sys/netatalk/ddp.h 139827 2005-01-07 02:35:34Z imp $ 24215698Ssimon */ 2596593Smarkm#ifndef _NETATALK_DDP_H_ 2696593Smarkm#define _NETATALK_DDP_H_ 1 2796593Smarkm 2896593Smarkm/* 2996593Smarkm * <-1byte(8bits) -> 3096593Smarkm * +---------------+ 3196593Smarkm * | 0 | hopc |len| 3296593Smarkm * +---------------+ 3396593Smarkm * | len (cont) | 3496593Smarkm * +---------------+ 3596593Smarkm * | | 3696593Smarkm * +- DDP csum -+ 3796593Smarkm * | | 3896593Smarkm * +---------------+ 3996593Smarkm * | | 4096593Smarkm * +- Dest NET -+ 41279264Sdelphij * | | 42279264Sdelphij * +---------------+ 4396593Smarkm * | | 4496593Smarkm * +- Src NET -+ 45215698Ssimon * | | 46215698Ssimon * +---------------+ 47215698Ssimon * | Dest NODE | 48215698Ssimon * +---------------+ 49142429Snectar * | Src NODE | 50215698Ssimon * +---------------+ 51142429Snectar * | Dest PORT | 52142429Snectar * +---------------+ 53279264Sdelphij * | Src PORT | 54279264Sdelphij * +---------------+ 55279264Sdelphij * 5696593Smarkm * On Apples, there is also a ddp_type field, after src_port. However, 57279264Sdelphij * under this unix implementation, user level processes need to be able 58279264Sdelphij * to set the ddp_type. In later revisions, the ddp_type may only be 59279264Sdelphij * available in a raw_appletalk interface. 60279264Sdelphij */ 61279264Sdelphij 62279264Sdelphijstruct elaphdr { 63215698Ssimon u_char el_dnode; 64279264Sdelphij u_char el_snode; 65279264Sdelphij u_char el_type; 66279264Sdelphij}; 67279264Sdelphij 68279264Sdelphij#define SZ_ELAPHDR 3 69215698Ssimon 70279264Sdelphij#define ELAP_DDPSHORT 0x01 7196593Smarkm#define ELAP_DDPEXTEND 0x02 7296593Smarkm 7396593Smarkm/* 7496593Smarkm * Extended DDP header. Includes sickness for dealing with arbitrary 7596593Smarkm * bitfields on a little-endian arch. 7696593Smarkm */ 7796593Smarkmstruct ddpehdr { 7896593Smarkm union { 7996593Smarkm struct { 8096593Smarkm#if BYTE_ORDER == BIG_ENDIAN 8196593Smarkm unsigned dub_pad:2; 8296593Smarkm unsigned dub_hops:4; 8396593Smarkm unsigned dub_len:10; 8496593Smarkm unsigned dub_sum:16; 8596593Smarkm#endif 8696593Smarkm#if BYTE_ORDER == LITTLE_ENDIAN 8796593Smarkm unsigned dub_sum:16; 8896593Smarkm unsigned dub_len:10; 8996593Smarkm unsigned dub_hops:4; 9096593Smarkm unsigned dub_pad:2; 9196593Smarkm#endif 9296593Smarkm } du_bits; 9396593Smarkm unsigned du_bytes; 9496593Smarkm } deh_u; 9596593Smarkm#define deh_pad deh_u.du_bits.dub_pad 9696593Smarkm#define deh_hops deh_u.du_bits.dub_hops 9796593Smarkm#define deh_len deh_u.du_bits.dub_len 9896593Smarkm#define deh_sum deh_u.du_bits.dub_sum 9996593Smarkm#define deh_bytes deh_u.du_bytes 10096593Smarkm u_short deh_dnet; 10196593Smarkm u_short deh_snet; 10296593Smarkm u_char deh_dnode; 10396593Smarkm u_char deh_snode; 10496593Smarkm u_char deh_dport; 10596593Smarkm u_char deh_sport; 10696593Smarkm}; 10796593Smarkm 10896593Smarkm#define DDP_MAXHOPS 15 10996593Smarkm 11096593Smarkmstruct ddpshdr { 11196593Smarkm union { 11296593Smarkm struct { 11396593Smarkm#if BYTE_ORDER == BIG_ENDIAN 11496593Smarkm unsigned dub_pad:6; 11596593Smarkm unsigned dub_len:10; 11696593Smarkm unsigned dub_dport:8; 11796593Smarkm unsigned dub_sport:8; 11896593Smarkm#endif 11996593Smarkm#if BYTE_ORDER == LITTLE_ENDIAN 12096593Smarkm unsigned dub_sport:8; 12196593Smarkm unsigned dub_dport:8; 12296593Smarkm unsigned dub_len:10; 12396593Smarkm unsigned dub_pad:6; 12496593Smarkm#endif 12596593Smarkm } du_bits; 12696593Smarkm unsigned du_bytes; 12796593Smarkm } dsh_u; 12896593Smarkm#define dsh_pad dsh_u.du_bits.dub_pad 12996593Smarkm#define dsh_len dsh_u.du_bits.dub_len 13096593Smarkm#define dsh_dport dsh_u.du_bits.dub_dport 13196593Smarkm#define dsh_sport dsh_u.du_bits.dub_sport 13296593Smarkm#define dsh_bytes dsh_u.du_bytes 133142429Snectar}; 13496593Smarkm 135100946Snectar#endif /* _NETATALK_DDP_H_ */ 136296341Sdelphij