113044Sasami/* 213044Sasami * Copyright (c) 1988, 1989, 1990, 1993, 1994, 1995, 1996 313044Sasami * The Regents of the University of California. All rights reserved. 413044Sasami * 513044Sasami * Redistribution and use in source and binary forms, with or without 613044Sasami * modification, are permitted provided that: (1) source code distributions 713044Sasami * retain the above copyright notice and this paragraph in its entirety, (2) 813044Sasami * distributions including binary code include the above copyright notice and 913044Sasami * this paragraph in its entirety in the documentation or other materials 1013044Sasami * provided with the distribution, and (3) all advertising materials mentioning 1113044Sasami * features or use of this software display the following acknowledgement: 1213044Sasami * ``This product includes software developed by the University of California, 1313044Sasami * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of 1413044Sasami * the University nor the names of its contributors may be used to endorse 1513044Sasami * or promote products derived from this software without specific prior 1613044Sasami * written permission. 1713044Sasami * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED 1813044Sasami * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 1913044Sasami * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 2013044Sasami * 2113044Sasami * AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX). 2213044Sasami */ 2313044Sasami 2413044Sasamistruct LAP { 2513044Sasami nd_uint8_t dst; 2613044Sasami nd_uint8_t src; 2713044Sasami nd_uint8_t type; 2813044Sasami}; 2950476Speter#define lapShortDDP 1 /* short DDP type */ 3036628Scharnier#define lapDDP 2 /* DDP type */ 31306979Ssevan#define lapKLAP 'K' /* Kinetics KLAP type */ 3213044Sasami 3379530Sru/* Datagram Delivery Protocol */ 3413044Sasami 3513044Sasamistruct atDDP { 3613044Sasami nd_uint16_t length; 3713044Sasami nd_uint16_t checksum; 3868960Sru nd_uint16_t dstNet; 3913044Sasami nd_uint16_t srcNet; 4013044Sasami nd_uint8_t dstNode; 4113044Sasami nd_uint8_t srcNode; 4213044Sasami nd_uint8_t dstSkt; 43141611Sru nd_uint8_t srcSkt; 4468960Sru nd_uint8_t type; 4513044Sasami}; 4613044Sasami 4713044Sasamistruct atShortDDP { 4868960Sru nd_uint16_t length; 4913044Sasami nd_uint8_t dstSkt; 5013044Sasami nd_uint8_t srcSkt; 51141611Sru nd_uint8_t type; 5268960Sru}; 5313044Sasami 5413044Sasami#define ddpMaxWKS 0x7F 5513044Sasami#define ddpMaxData 586 5668960Sru#define ddpLengthMask 0x3FF 5713044Sasami#define ddpHopShift 10 58141611Sru#define ddpSize 13 /* size of DDP header (avoid struct padding) */ 5913044Sasami#define ddpSSize 5 6099501Scharnier#define ddpWKS 128 /* boundary of DDP well known sockets */ 6199501Scharnier#define ddpRTMP 1 /* RTMP type */ 6299501Scharnier#define ddpRTMPrequest 5 /* RTMP request type */ 63131488Sru#define ddpNBP 2 /* NBP type */ 64131488Sru#define ddpATP 3 /* ATP type */ 6513044Sasami#define ddpECHO 4 /* ECHO type */ 6613044Sasami#define ddpIP 22 /* IP type */ 6713044Sasami#define ddpARP 23 /* ARP type */ 6813044Sasami#define ddpEIGRP 88 /* EIGRP over Appletalk */ 6913044Sasami#define ddpKLAP 0x4b /* Kinetics KLAP type */ 70131488Sru 71131488Sru 7268960Sru/* AppleTalk Transaction Protocol */ 7313044Sasami 7413044Sasamistruct atATP { 7513044Sasami nd_uint8_t control; 7613044Sasami nd_uint8_t bitmap; 7713044Sasami nd_uint16_t transID; 7813044Sasami nd_uint32_t userData; 7913044Sasami}; 8013044Sasami 8113044Sasami#define atpReqCode 0x40 82131488Sru#define atpRspCode 0x80 83131488Sru#define atpRelCode 0xC0 84131488Sru#define atpXO 0x20 85131488Sru#define atpEOM 0x10 8613044Sasami#define atpSTS 0x08 8713044Sasami#define atpFlagMask 0x3F 8813044Sasami#define atpControlMask 0xF8 8913044Sasami#define atpMaxNum 8 9013044Sasami#define atpMaxData 578 9136628Scharnier 9236628Scharnier 9313044Sasami/* AppleTalk Echo Protocol */ 9413044Sasami 9513044Sasamistruct atEcho { 9613044Sasami nd_uint8_t echoFunction; 9713044Sasami nd_uint8_t echoData[1]; /* Should be [], C99-style */ 98131488Sru}; 99131488Sru 10013044Sasami#define echoSkt 4 /* the echoer socket */ 10113044Sasami#define echoSize 1 /* size of echo header */ 10213044Sasami#define echoRequest 1 /* echo request */ 10313044Sasami#define echoReply 2 /* echo request */ 104140289Sru 10513044Sasami 10613781Sasami/* Name Binding Protocol */ 107157740Scracauer 108157740Scracauerstruct atNBP { 10913044Sasami nd_uint8_t control; 11013044Sasami nd_uint8_t id; 11113044Sasami}; 11213044Sasami 11313044Sasamistruct atNBPtuple { 11413044Sasami nd_uint16_t net; 11513044Sasami nd_uint8_t node; 116140289Sru nd_uint8_t skt; 11713044Sasami nd_uint8_t enumerator; 11813044Sasami}; 11913044Sasami 12013044Sasami#define nbpBrRq 0x10 121140289Sru#define nbpLkUp 0x20 12213044Sasami#define nbpLkUpReply 0x30 123123295Sobrien 12413044Sasami#define nbpNIS 2 12513044Sasami#define nbpTupleMax 15 12679754Sdd 12749454Sjkoshy#define nbpHeaderSize 2 12849454Sjkoshy#define nbpTupleSize 5 12949454Sjkoshy 13049454Sjkoshy#define nbpSkt 2 /* NIS */ 13171099Sru 132157740Scracauer 133157748Sru/* Routing Table Maint. Protocol */ 134157748Sru 135157748Sru#define rtmpSkt 1 /* number of RTMP socket */ 136157748Sru#define rtmpSize 4 /* minimum size */ 137157740Scracauer#define rtmpTupleSize 3 138157740Scracauer 139140415Sru 140140415Sru/* Zone Information Protocol */ 141140415Sru 142140415Srustruct zipHeader { 143140415Sru nd_uint8_t command; 14468854Sru nd_uint8_t netcount; 14599501Scharnier}; 14699501Scharnier 147131488Sru#define zipHeaderSize 2 148131488Sru#define zipQuery 1 14999501Scharnier#define zipReply 2 15099501Scharnier#define zipTakedown 3 15199501Scharnier#define zipBringup 4 15279754Sdd#define ddpZIP 6 153131488Sru#define zipSkt 6 154131488Sru#define GetMyZone 7 155131488Sru#define GetZoneList 8 156131488Sru 15751604Sdillon/* 158123295Sobrien * UDP port range used for ddp-in-udp encapsulation is 16512-16639 159131488Sru * for client sockets (128-255) and 200-327 for server sockets 160131488Sru * (0-127). We also try to recognize the pre-April 88 server 161131488Sru * socket range of 768-895. 162306979Ssevan */ 163123295Sobrien#define atalk_port(p) \ 164140289Sru (((unsigned)((p) - 16512) < 128) || \ 165123295Sobrien ((unsigned)((p) - 200) < 128) || \ 166123295Sobrien ((unsigned)((p) - 768) < 128)) 167123295Sobrien