1139749Simp/*
276479Swpaul * Copyright (c) 1988, 1989, 1990, 1993, 1994, 1995, 1996
376479Swpaul *	The Regents of the University of California.  All rights reserved.
476479Swpaul *
576479Swpaul * Redistribution and use in source and binary forms, with or without
676479Swpaul * modification, are permitted provided that: (1) source code distributions
776479Swpaul * retain the above copyright notice and this paragraph in its entirety, (2)
876479Swpaul * distributions including binary code include the above copyright notice and
976479Swpaul * this paragraph in its entirety in the documentation or other materials
1076479Swpaul * provided with the distribution, and (3) all advertising materials mentioning
1176479Swpaul * features or use of this software display the following acknowledgement:
1276479Swpaul * ``This product includes software developed by the University of California,
1376479Swpaul * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1476479Swpaul * the University nor the names of its contributors may be used to endorse
1576479Swpaul * or promote products derived from this software without specific prior
1676479Swpaul * written permission.
1776479Swpaul * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1876479Swpaul * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1976479Swpaul * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2076479Swpaul *
2176479Swpaul * AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
2276479Swpaul *
2376479Swpaul * @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.16 2004-05-01 09:41:50 hannes Exp $ (LBL)
2476479Swpaul */
2576479Swpaul
2676479Swpaulstruct LAP {
2776479Swpaul	u_int8_t	dst;
2876479Swpaul	u_int8_t	src;
2976479Swpaul	u_int8_t	type;
3076479Swpaul};
3176479Swpaul#define lapShortDDP	1	/* short DDP type */
3276479Swpaul#define lapDDP		2	/* DDP type */
3376479Swpaul#define lapKLAP		'K'	/* Kinetics KLAP type */
34119418Sobrien
35119418Sobrien/* Datagram Delivery Protocol */
36119418Sobrien
3776479Swpaulstruct atDDP {
3876479Swpaul	u_int16_t	length;
3976479Swpaul	u_int16_t	checksum;
4076479Swpaul	u_int16_t	dstNet;
4176479Swpaul	u_int16_t	srcNet;
4276479Swpaul	u_int8_t	dstNode;
4376479Swpaul	u_int8_t	srcNode;
4476479Swpaul	u_int8_t	dstSkt;
4576479Swpaul	u_int8_t	srcSkt;
4676479Swpaul	u_int8_t	type;
4776479Swpaul};
4876479Swpaul
4976479Swpaulstruct atShortDDP {
5076479Swpaul	u_int16_t	length;
5176479Swpaul	u_int8_t	dstSkt;
5276479Swpaul	u_int8_t	srcSkt;
5376479Swpaul	u_int8_t	type;
5476479Swpaul};
5576479Swpaul
5676479Swpaul#define	ddpMaxWKS	0x7F
5776479Swpaul#define	ddpMaxData	586
5876479Swpaul#define	ddpLengthMask	0x3FF
5976479Swpaul#define	ddpHopShift	10
6076479Swpaul#define	ddpSize		13	/* size of DDP header (avoid struct padding) */
6176479Swpaul#define	ddpSSize	5
6276479Swpaul#define	ddpWKS		128	/* boundary of DDP well known sockets */
6376479Swpaul#define	ddpRTMP		1	/* RTMP type */
6476479Swpaul#define	ddpRTMPrequest	5	/* RTMP request type */
6576479Swpaul#define	ddpNBP		2	/* NBP type */
6676479Swpaul#define	ddpATP		3	/* ATP type */
6776479Swpaul#define	ddpECHO		4	/* ECHO type */
6876479Swpaul#define	ddpIP		22	/* IP type */
6976479Swpaul#define	ddpARP		23	/* ARP type */
7076479Swpaul#define ddpEIGRP        88      /* EIGRP over Appletalk */
7176479Swpaul#define	ddpKLAP		0x4b	/* Kinetics KLAP type */
7276479Swpaul
7378323Swpaul
7478323Swpaul/* AppleTalk Transaction Protocol */
7578323Swpaul
7678323Swpaulstruct atATP {
7778323Swpaul	u_int8_t	control;
7878323Swpaul	u_int8_t	bitmap;
7978323Swpaul	u_int16_t	transID;
8078323Swpaul	int32_t userData;
8178323Swpaul};
8278323Swpaul
8378323Swpaul#define	atpReqCode	0x40
8478323Swpaul#define	atpRspCode	0x80
8578323Swpaul#define	atpRelCode	0xC0
8678323Swpaul#define	atpXO		0x20
8778323Swpaul#define	atpEOM		0x10
8878323Swpaul#define	atpSTS		0x08
8976479Swpaul#define	atpFlagMask	0x3F
9076479Swpaul#define	atpControlMask	0xF8
91150968Sglebius#define	atpMaxNum	8
92150968Sglebius#define	atpMaxData	578
93150968Sglebius
94150968Sglebius
9576479Swpaul/* AppleTalk Echo Protocol */
9676479Swpaul
97192506Syongaristruct atEcho {
98192506Syongari	u_int8_t	echoFunction;
99192506Syongari	u_int8_t	*echoData;
100192506Syongari};
101192506Syongari
10276479Swpaul#define echoSkt		4		/* the echoer socket */
103129879Sphk#define echoSize	1		/* size of echo header */
104192506Syongari#define echoRequest	1		/* echo request */
105192506Syongari#define echoReply	2		/* echo request */
10676479Swpaul
107192506Syongari
108192506Syongari/* Name Binding Protocol */
10976479Swpaul
110192506Syongaristruct atNBP {
11176479Swpaul	u_int8_t	control;
11276479Swpaul	u_int8_t	id;
11376479Swpaul};
11476479Swpaul
11576479Swpaulstruct atNBPtuple {
11676479Swpaul	u_int16_t	net;
11776479Swpaul	u_int8_t	node;
11876479Swpaul	u_int8_t	skt;
11976479Swpaul	u_int8_t	enumerator;
120226995Smarius};
12176479Swpaul
12276479Swpaul#define	nbpBrRq		0x10
123119285Simp#define	nbpLkUp		0x20
124119285Simp#define	nbpLkUpReply	0x30
12576479Swpaul
126192506Syongari#define	nbpNIS		2
12776479Swpaul#define	nbpTupleMax	15
12876522Swpaul
12976479Swpaul#define	nbpHeaderSize	2
130192506Syongari#define nbpTupleSize	5
131192506Syongari
132192506Syongari#define nbpSkt		2		/* NIS */
133113506Smdodd
134113506Smdodd
13576479Swpaul/* Routing Table Maint. Protocol */
13676479Swpaul
13776479Swpaul#define	rtmpSkt		1	/* number of RTMP socket */
13876479Swpaul#define	rtmpSize	4	/* minimum size */
13976479Swpaul#define	rtmpTupleSize	3
14076479Swpaul
14176479Swpaul
142242625Sdim/* Zone Information Protocol */
14376479Swpaul
14476479Swpaulstruct zipHeader {
14576479Swpaul	u_int8_t	command;
14676479Swpaul	u_int8_t	netcount;
14776479Swpaul};
14899497Salfred
14999497Salfred#define	zipHeaderSize	2
15099497Salfred#define	zipQuery	1
151192506Syongari#define	zipReply	2
152192506Syongari#define	zipTakedown	3
153192506Syongari#define	zipBringup	4
15476479Swpaul#define	ddpZIP		6
155192506Syongari#define	zipSkt		6
156192506Syongari#define	GetMyZone	7
157192506Syongari#define	GetZoneList	8
158192506Syongari
159192506Syongari/*
160135250Swpaul * UDP port range used for ddp-in-udp encapsulation is 16512-16639
161193105Sattilio * for client sockets (128-255) and 200-327 for server sockets
16299497Salfred * (0-127).  We also try to recognize the pre-April 88 server
16399497Salfred * socket range of 768-895.
16499497Salfred */
165192506Syongari#define atalk_port(p) \
16699497Salfred	(((unsigned)((p) - 16512) < 128) || \
167135250Swpaul	 ((unsigned)((p) - 200) < 128) || \
16899497Salfred	 ((unsigned)((p) - 768) < 128))
16999497Salfred