117680Spst/*
217680Spst * Copyright (c) 1988, 1989, 1990, 1993, 1994, 1995, 1996
317680Spst *	The Regents of the University of California.  All rights reserved.
417680Spst *
517680Spst * Redistribution and use in source and binary forms, with or without
617680Spst * modification, are permitted provided that: (1) source code distributions
717680Spst * retain the above copyright notice and this paragraph in its entirety, (2)
817680Spst * distributions including binary code include the above copyright notice and
917680Spst * this paragraph in its entirety in the documentation or other materials
1017680Spst * provided with the distribution, and (3) all advertising materials mentioning
1117680Spst * features or use of this software display the following acknowledgement:
1217680Spst * ``This product includes software developed by the University of California,
1317680Spst * Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
1417680Spst * the University nor the names of its contributors may be used to endorse
1517680Spst * or promote products derived from this software without specific prior
1617680Spst * written permission.
1717680Spst * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
1817680Spst * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
1917680Spst * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
2017680Spst *
2117680Spst * AppleTalk protocol formats (courtesy Bill Croft of Stanford/SUMEX).
2217680Spst *
23190207Srpaulo * @(#) $Header: /tcpdump/master/tcpdump/appletalk.h,v 1.16 2004-05-01 09:41:50 hannes Exp $ (LBL)
2417680Spst */
2517680Spst
2617680Spststruct LAP {
2775115Sfenner	u_int8_t	dst;
2875115Sfenner	u_int8_t	src;
2975115Sfenner	u_int8_t	type;
3017680Spst};
3117680Spst#define lapShortDDP	1	/* short DDP type */
3217680Spst#define lapDDP		2	/* DDP type */
3317680Spst#define lapKLAP		'K'	/* Kinetics KLAP type */
3417680Spst
3517680Spst/* Datagram Delivery Protocol */
3617680Spst
3717680Spststruct atDDP {
3875115Sfenner	u_int16_t	length;
3975115Sfenner	u_int16_t	checksum;
4075115Sfenner	u_int16_t	dstNet;
4175115Sfenner	u_int16_t	srcNet;
4275115Sfenner	u_int8_t	dstNode;
4375115Sfenner	u_int8_t	srcNode;
4475115Sfenner	u_int8_t	dstSkt;
4575115Sfenner	u_int8_t	srcSkt;
4675115Sfenner	u_int8_t	type;
4717680Spst};
4817680Spst
4917680Spststruct atShortDDP {
5075115Sfenner	u_int16_t	length;
5175115Sfenner	u_int8_t	dstSkt;
5275115Sfenner	u_int8_t	srcSkt;
5375115Sfenner	u_int8_t	type;
5417680Spst};
5517680Spst
5617680Spst#define	ddpMaxWKS	0x7F
5717680Spst#define	ddpMaxData	586
5817680Spst#define	ddpLengthMask	0x3FF
5917680Spst#define	ddpHopShift	10
6017680Spst#define	ddpSize		13	/* size of DDP header (avoid struct padding) */
6117680Spst#define	ddpSSize	5
6217680Spst#define	ddpWKS		128	/* boundary of DDP well known sockets */
6317680Spst#define	ddpRTMP		1	/* RTMP type */
6417680Spst#define	ddpRTMPrequest	5	/* RTMP request type */
6517680Spst#define	ddpNBP		2	/* NBP type */
6617680Spst#define	ddpATP		3	/* ATP type */
6717680Spst#define	ddpECHO		4	/* ECHO type */
6817680Spst#define	ddpIP		22	/* IP type */
6917680Spst#define	ddpARP		23	/* ARP type */
70146773Ssam#define ddpEIGRP        88      /* EIGRP over Appletalk */
7117680Spst#define	ddpKLAP		0x4b	/* Kinetics KLAP type */
7217680Spst
7317680Spst
7417680Spst/* AppleTalk Transaction Protocol */
7517680Spst
7617680Spststruct atATP {
7775115Sfenner	u_int8_t	control;
7875115Sfenner	u_int8_t	bitmap;
7975115Sfenner	u_int16_t	transID;
8017680Spst	int32_t userData;
8117680Spst};
8217680Spst
8317680Spst#define	atpReqCode	0x40
8417680Spst#define	atpRspCode	0x80
8517680Spst#define	atpRelCode	0xC0
8617680Spst#define	atpXO		0x20
8717680Spst#define	atpEOM		0x10
8817680Spst#define	atpSTS		0x08
8917680Spst#define	atpFlagMask	0x3F
9017680Spst#define	atpControlMask	0xF8
9117680Spst#define	atpMaxNum	8
9217680Spst#define	atpMaxData	578
9317680Spst
9417680Spst
9517680Spst/* AppleTalk Echo Protocol */
9617680Spst
9717680Spststruct atEcho {
9875115Sfenner	u_int8_t	echoFunction;
9975115Sfenner	u_int8_t	*echoData;
10017680Spst};
10117680Spst
10217680Spst#define echoSkt		4		/* the echoer socket */
10317680Spst#define echoSize	1		/* size of echo header */
10417680Spst#define echoRequest	1		/* echo request */
10517680Spst#define echoReply	2		/* echo request */
10617680Spst
10717680Spst
10817680Spst/* Name Binding Protocol */
10917680Spst
11017680Spststruct atNBP {
11175115Sfenner	u_int8_t	control;
11275115Sfenner	u_int8_t	id;
11317680Spst};
11417680Spst
11517680Spststruct atNBPtuple {
11675115Sfenner	u_int16_t	net;
11775115Sfenner	u_int8_t	node;
11875115Sfenner	u_int8_t	skt;
11975115Sfenner	u_int8_t	enumerator;
12017680Spst};
12117680Spst
12217680Spst#define	nbpBrRq		0x10
12317680Spst#define	nbpLkUp		0x20
12417680Spst#define	nbpLkUpReply	0x30
12517680Spst
12617680Spst#define	nbpNIS		2
12717680Spst#define	nbpTupleMax	15
12817680Spst
12917680Spst#define	nbpHeaderSize	2
13017680Spst#define nbpTupleSize	5
13117680Spst
13217680Spst#define nbpSkt		2		/* NIS */
13317680Spst
13417680Spst
13517680Spst/* Routing Table Maint. Protocol */
13617680Spst
13717680Spst#define	rtmpSkt		1	/* number of RTMP socket */
13817680Spst#define	rtmpSize	4	/* minimum size */
13917680Spst#define	rtmpTupleSize	3
14017680Spst
14117680Spst
14217680Spst/* Zone Information Protocol */
14317680Spst
14417680Spststruct zipHeader {
14575115Sfenner	u_int8_t	command;
14675115Sfenner	u_int8_t	netcount;
14717680Spst};
14817680Spst
14917680Spst#define	zipHeaderSize	2
15017680Spst#define	zipQuery	1
15117680Spst#define	zipReply	2
15217680Spst#define	zipTakedown	3
15317680Spst#define	zipBringup	4
15417680Spst#define	ddpZIP		6
15517680Spst#define	zipSkt		6
15617680Spst#define	GetMyZone	7
15717680Spst#define	GetZoneList	8
15817680Spst
15917680Spst/*
16017680Spst * UDP port range used for ddp-in-udp encapsulation is 16512-16639
16117680Spst * for client sockets (128-255) and 200-327 for server sockets
16217680Spst * (0-127).  We also try to recognize the pre-April 88 server
16317680Spst * socket range of 768-895.
16417680Spst */
16517680Spst#define atalk_port(p) \
16617680Spst	(((unsigned)((p) - 16512) < 128) || \
16717680Spst	 ((unsigned)((p) - 200) < 128) || \
16817680Spst	 ((unsigned)((p) - 768) < 128))
169