1 /* 2 * Copyright (c) 1988 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and 9 * this paragraph in its entirety in the documentation or other materials 10 * provided with the distribution, and (3) all advertising materials mentioning 11 * features or use of this software display the following acknowledgement: 12 * ``This product includes software developed by the University of California, 13 * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 14 * the University nor the names of its contributors may be used to endorse 15 * or promote products derived from this software without specific prior 16 * written permission. 17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX). 22 * 23 * @(#) $Header: appletalk.h,v 1.6 90/10/03 22:14:26 leres Exp $ (LBL) 24 */ 25 26 /* Datagram Delivery Protocol */ 27 28 struct atDDP { 29 u_short length; 30 u_short checksum; 31 u_short dstNet; 32 u_short srcNet; 33 u_char dstNode; 34 u_char srcNode; 35 u_char dstSkt; 36 u_char srcSkt; 37 u_char type; 38 }; 39 40 struct atShortDDP { 41 u_short length; 42 u_char dstSkt; 43 u_char srcSkt; 44 u_char type; 45 }; 46 47 #define ddpMaxWKS 0x7F 48 #define ddpMaxData 586 49 #define ddpLengthMask 0x3FF 50 #define ddpHopShift 10 51 #define ddpSize 13 /* size of DDP header (avoid struct padding) */ 52 #define ddpSSize 5 53 #define ddpWKS 128 /* boundary of DDP well known sockets */ 54 #define ddpRTMP 1 /* RTMP type */ 55 #define ddpRTMPrequest 5 /* RTMP request type */ 56 #define ddpNBP 2 /* NBP type */ 57 #define ddpATP 3 /* ATP type */ 58 #define ddpECHO 4 /* ECHO type */ 59 #define ddpIP 22 /* IP type */ 60 #define ddpARP 23 /* ARP type */ 61 #define ddpKLAP 0x4b /* Kinetics KLAP type */ 62 63 64 /* AppleTalk Transaction Protocol */ 65 66 struct atATP { 67 u_char control; 68 u_char bitmap; 69 u_short transID; 70 long userData; 71 }; 72 73 #define atpReqCode 0x40 74 #define atpRspCode 0x80 75 #define atpRelCode 0xC0 76 #define atpXO 0x20 77 #define atpEOM 0x10 78 #define atpSTS 0x08 79 #define atpFlagMask 0x3F 80 #define atpControlMask 0xF8 81 #define atpMaxNum 8 82 #define atpMaxData 578 83 84 85 /* AppleTalk Echo Protocol */ 86 87 struct atEcho { 88 u_char echoFunction; 89 u_char *echoData; 90 }; 91 92 #define echoSkt 4 /* the echoer socket */ 93 #define echoSize 1 /* size of echo header */ 94 #define echoRequest 1 /* echo request */ 95 #define echoReply 2 /* echo request */ 96 97 98 /* Name Binding Protocol */ 99 100 struct atNBP { 101 u_char control; 102 u_char id; 103 }; 104 105 struct atNBPtuple { 106 u_short net; 107 u_char node; 108 u_char skt; 109 u_char enumerator; 110 }; 111 112 #define nbpBrRq 0x10 113 #define nbpLkUp 0x20 114 #define nbpLkUpReply 0x30 115 116 #define nbpNIS 2 117 #define nbpTupleMax 15 118 119 #define nbpHeaderSize 2 120 #define nbpTupleSize 5; 121 122 123 /* Routing Table Maint. Protocol */ 124 125 #define rtmpSkt 1 /* number of RTMP socket */ 126 #define rtmpSize 4 /* minimum size */ 127 #define rtmpTupleSize 3 128 129 130 /* Zone Information Protocol */ 131 132 struct zipHeader { 133 u_char command; 134 u_char netcount; 135 }; 136 137 #define zipHeaderSize 2 138 #define zipQuery 1 139 #define zipReply 2 140 #define zipTakedown 3 141 #define zipBringup 4 142 #define ddpZIP 6 143 #define zipSkt 6 144 #define GetMyZone 7 145 #define GetZoneList 8 146 147 /* 148 * UDP port range used for ddp-in-udp encapsulation is 16512-16639 149 * for client sockets (128-255) and 200-327 for server sockets 150 * (0-127). We also try to recognize the pre-April 88 server 151 * socket range of 768-895. 152 */ 153 #define atalk_port(p) \ 154 (((unsigned)((p) - 16512) < 128) || \ 155 ((unsigned)((p) - 200) < 128) || \ 156 ((unsigned)((p) - 768) < 128)) 157