1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * CDDL HEADER START 3*7c478bd9Sstevel@tonic-gate * 4*7c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*7c478bd9Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*7c478bd9Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*7c478bd9Sstevel@tonic-gate * with the License. 8*7c478bd9Sstevel@tonic-gate * 9*7c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*7c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*7c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 12*7c478bd9Sstevel@tonic-gate * and limitations under the License. 13*7c478bd9Sstevel@tonic-gate * 14*7c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*7c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*7c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*7c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*7c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*7c478bd9Sstevel@tonic-gate * 20*7c478bd9Sstevel@tonic-gate * CDDL HEADER END 21*7c478bd9Sstevel@tonic-gate */ 22*7c478bd9Sstevel@tonic-gate /* 23*7c478bd9Sstevel@tonic-gate * Copyright (c) 2001 by Sun Microsystems, Inc. 24*7c478bd9Sstevel@tonic-gate * All rights reserved. 25*7c478bd9Sstevel@tonic-gate * 26*7c478bd9Sstevel@tonic-gate */ 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate #ifndef _AT_H 29*7c478bd9Sstevel@tonic-gate #define _AT_H 30*7c478bd9Sstevel@tonic-gate 31*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 32*7c478bd9Sstevel@tonic-gate 33*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 34*7c478bd9Sstevel@tonic-gate extern "C" { 35*7c478bd9Sstevel@tonic-gate #endif 36*7c478bd9Sstevel@tonic-gate 37*7c478bd9Sstevel@tonic-gate /* 38*7c478bd9Sstevel@tonic-gate * There is a lot of alignment problems in AppleTalk packets. 39*7c478bd9Sstevel@tonic-gate * This is the reason some of the headers use uint8_t arrays instead of the 40*7c478bd9Sstevel@tonic-gate * natural datatype. 41*7c478bd9Sstevel@tonic-gate */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate /* AARP */ 44*7c478bd9Sstevel@tonic-gate 45*7c478bd9Sstevel@tonic-gate #define AARP_REQ 1 46*7c478bd9Sstevel@tonic-gate #define AARP_RESP 2 47*7c478bd9Sstevel@tonic-gate #define AARP_PROBE 3 48*7c478bd9Sstevel@tonic-gate 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate /* DDP */ 51*7c478bd9Sstevel@tonic-gate 52*7c478bd9Sstevel@tonic-gate struct ddp_hdr { 53*7c478bd9Sstevel@tonic-gate uint8_t ddp_hop_len; 54*7c478bd9Sstevel@tonic-gate uint8_t ddp_len_lo; 55*7c478bd9Sstevel@tonic-gate uint16_t ddp_cksum; 56*7c478bd9Sstevel@tonic-gate uint16_t ddp_dest_net; 57*7c478bd9Sstevel@tonic-gate uint16_t ddp_src_net; 58*7c478bd9Sstevel@tonic-gate uint8_t ddp_dest_id; 59*7c478bd9Sstevel@tonic-gate uint8_t ddp_src_id; 60*7c478bd9Sstevel@tonic-gate uint8_t ddp_dest_sock; 61*7c478bd9Sstevel@tonic-gate uint8_t ddp_src_sock; 62*7c478bd9Sstevel@tonic-gate uint8_t ddp_type; 63*7c478bd9Sstevel@tonic-gate }; 64*7c478bd9Sstevel@tonic-gate 65*7c478bd9Sstevel@tonic-gate #define ddp_pad(x) ((x)->ddp_hop_len & 0xc0) 66*7c478bd9Sstevel@tonic-gate #define ddp_hop(x) (((x)->ddp_hop_len >> 2) & 0xf) 67*7c478bd9Sstevel@tonic-gate #define ddp_len(x) ((((x)->ddp_hop_len & 0x3) << 8) + (x)->ddp_len_lo) 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate #define DDPHDR_SIZE 13 70*7c478bd9Sstevel@tonic-gate 71*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_RTMPRQ 5 72*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_RTMPRESP 1 73*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_NBP 2 74*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_ATP 3 75*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_AEP 4 76*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_ZIP 6 77*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_ADSP 7 78*7c478bd9Sstevel@tonic-gate 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate /* AECHO */ 81*7c478bd9Sstevel@tonic-gate 82*7c478bd9Sstevel@tonic-gate #define AEP_REQ 1 83*7c478bd9Sstevel@tonic-gate #define AEP_REPLY 2 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate /* NBP */ 86*7c478bd9Sstevel@tonic-gate 87*7c478bd9Sstevel@tonic-gate struct nbp_hdr { 88*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 89*7c478bd9Sstevel@tonic-gate uint8_t nbp_fun_cnt; 90*7c478bd9Sstevel@tonic-gate uint8_t nbp_id; 91*7c478bd9Sstevel@tonic-gate }; 92*7c478bd9Sstevel@tonic-gate 93*7c478bd9Sstevel@tonic-gate #define NBP_BRRQ 1 94*7c478bd9Sstevel@tonic-gate #define NBP_LKUP 2 95*7c478bd9Sstevel@tonic-gate #define NBP_LKUP_REPLY 3 96*7c478bd9Sstevel@tonic-gate #define NBP_FWDREQ 4 97*7c478bd9Sstevel@tonic-gate 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate /* ZIP */ 100*7c478bd9Sstevel@tonic-gate 101*7c478bd9Sstevel@tonic-gate struct zip_hdr { 102*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 103*7c478bd9Sstevel@tonic-gate uint8_t zip_func; 104*7c478bd9Sstevel@tonic-gate uint8_t zip_netcnt; 105*7c478bd9Sstevel@tonic-gate }; 106*7c478bd9Sstevel@tonic-gate 107*7c478bd9Sstevel@tonic-gate #define ZIP_QUERY 1 108*7c478bd9Sstevel@tonic-gate #define ZIP_REPLY 2 109*7c478bd9Sstevel@tonic-gate #define ZIP_GET_NET_INFO 5 110*7c478bd9Sstevel@tonic-gate #define ZIP_GET_NET_INFO_REPLY 6 111*7c478bd9Sstevel@tonic-gate #define ZIP_NOTIFY 7 112*7c478bd9Sstevel@tonic-gate #define ZIP_EXT_REPLY 8 113*7c478bd9Sstevel@tonic-gate 114*7c478bd9Sstevel@tonic-gate #define ZIP_ATP_GETMYZONE 7 115*7c478bd9Sstevel@tonic-gate #define ZIP_ATP_GETZONELIST 8 116*7c478bd9Sstevel@tonic-gate #define ZIP_ATP_GETLOCALZONES 9 117*7c478bd9Sstevel@tonic-gate 118*7c478bd9Sstevel@tonic-gate #define ZIP_FLG_ONEZ 0x20 119*7c478bd9Sstevel@tonic-gate #define ZIP_FLG_USEBRC 0x40 120*7c478bd9Sstevel@tonic-gate #define ZIP_FLG_ZINV 0x80 121*7c478bd9Sstevel@tonic-gate 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate /* ATP */ 124*7c478bd9Sstevel@tonic-gate 125*7c478bd9Sstevel@tonic-gate struct atp_hdr { 126*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 127*7c478bd9Sstevel@tonic-gate uint8_t atp_ctrl; 128*7c478bd9Sstevel@tonic-gate uint8_t atp_seq; 129*7c478bd9Sstevel@tonic-gate uint8_t atp_tid[2]; 130*7c478bd9Sstevel@tonic-gate uint8_t atp_user[4]; 131*7c478bd9Sstevel@tonic-gate }; 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate #define ATPHDR_SIZE 8 134*7c478bd9Sstevel@tonic-gate 135*7c478bd9Sstevel@tonic-gate #define atp_fun(x) (((x) >> 6) & 0x3) 136*7c478bd9Sstevel@tonic-gate #define atp_tmo(x) ((x) & 0x7) 137*7c478bd9Sstevel@tonic-gate 138*7c478bd9Sstevel@tonic-gate #define ATP_TREQ 1 139*7c478bd9Sstevel@tonic-gate #define ATP_TRESP 2 140*7c478bd9Sstevel@tonic-gate #define ATP_TREL 3 141*7c478bd9Sstevel@tonic-gate #define ATP_FLG_STS 0x08 142*7c478bd9Sstevel@tonic-gate #define ATP_FLG_EOM 0x10 143*7c478bd9Sstevel@tonic-gate #define ATP_FLG_XO 0x20 144*7c478bd9Sstevel@tonic-gate 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate #define NODE_ID_BROADCAST 0xff 147*7c478bd9Sstevel@tonic-gate 148*7c478bd9Sstevel@tonic-gate struct ddp_adsphdr { 149*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 150*7c478bd9Sstevel@tonic-gate uint8_t ad_connid[2]; /* short */ 151*7c478bd9Sstevel@tonic-gate uint8_t ad_fbseq[4]; /* long */ 152*7c478bd9Sstevel@tonic-gate uint8_t ad_nrseq[4]; /* long */ 153*7c478bd9Sstevel@tonic-gate uint8_t ad_rcvwin[2]; /* short */ 154*7c478bd9Sstevel@tonic-gate uint8_t ad_desc; 155*7c478bd9Sstevel@tonic-gate }; 156*7c478bd9Sstevel@tonic-gate 157*7c478bd9Sstevel@tonic-gate #define AD_CTRL 0x80 158*7c478bd9Sstevel@tonic-gate #define AD_ACKREQ 0x40 159*7c478bd9Sstevel@tonic-gate #define AD_EOM 0x20 160*7c478bd9Sstevel@tonic-gate #define AD_ATT 0x10 161*7c478bd9Sstevel@tonic-gate #define AD_CTRL_MASK 0x0f 162*7c478bd9Sstevel@tonic-gate 163*7c478bd9Sstevel@tonic-gate #define AD_CREQ 0x81 /* Open Conn Request */ 164*7c478bd9Sstevel@tonic-gate #define AD_CACK 0x82 /* Open Conn Ack */ 165*7c478bd9Sstevel@tonic-gate #define AD_CREQ_ACK 0x83 /* Open Conn Req+Ack */ 166*7c478bd9Sstevel@tonic-gate #define AD_CDENY 0x84 /* Open Conn Denial */ 167*7c478bd9Sstevel@tonic-gate 168*7c478bd9Sstevel@tonic-gate struct ddp_adsp_att { 169*7c478bd9Sstevel@tonic-gate struct ddp_adsphdr ad; 170*7c478bd9Sstevel@tonic-gate uint8_t ad_att_code[2]; /* short */ 171*7c478bd9Sstevel@tonic-gate }; 172*7c478bd9Sstevel@tonic-gate 173*7c478bd9Sstevel@tonic-gate struct ddp_adsp_open { 174*7c478bd9Sstevel@tonic-gate struct ddp_adsphdr ad; 175*7c478bd9Sstevel@tonic-gate uint8_t ad_version[2]; /* short */ 176*7c478bd9Sstevel@tonic-gate uint8_t ad_dconnid[2]; /* short */ 177*7c478bd9Sstevel@tonic-gate uint8_t ad_attseq[4]; /* long */ 178*7c478bd9Sstevel@tonic-gate }; 179*7c478bd9Sstevel@tonic-gate 180*7c478bd9Sstevel@tonic-gate #define RTMP_REQ 1 181*7c478bd9Sstevel@tonic-gate #define RTMP_RDR_SH 2 /* Route Data Request, split horizon */ 182*7c478bd9Sstevel@tonic-gate #define RTMP_RDR_NSH 3 /* Route Data Request, no split horizon */ 183*7c478bd9Sstevel@tonic-gate 184*7c478bd9Sstevel@tonic-gate #define RTMP_DIST_MASK 0x1f 185*7c478bd9Sstevel@tonic-gate #define RTMP_EXTEND 0x80 186*7c478bd9Sstevel@tonic-gate #define RTMP_FILLER 0x82 187*7c478bd9Sstevel@tonic-gate 188*7c478bd9Sstevel@tonic-gate 189*7c478bd9Sstevel@tonic-gate uint16_t get_short(uint8_t *); 190*7c478bd9Sstevel@tonic-gate uint32_t get_long(uint8_t *); 191*7c478bd9Sstevel@tonic-gate 192*7c478bd9Sstevel@tonic-gate extern void interpret_aarp(int, char *, int); 193*7c478bd9Sstevel@tonic-gate extern void interpret_at(int, struct ddp_hdr *, int); 194*7c478bd9Sstevel@tonic-gate extern void interpret_nbp(int, struct nbp_hdr *, int); 195*7c478bd9Sstevel@tonic-gate extern void interpret_rtmp(int, struct ddp_hdr *, int); 196*7c478bd9Sstevel@tonic-gate extern void interpret_aecho(int, struct ddp_hdr *, int); 197*7c478bd9Sstevel@tonic-gate extern void interpret_atp(int, struct ddp_hdr *, int); 198*7c478bd9Sstevel@tonic-gate extern void interpret_adsp(int, struct ddp_adsphdr *, int); 199*7c478bd9Sstevel@tonic-gate extern void interpret_ddp_zip(int, struct zip_hdr *, int); 200*7c478bd9Sstevel@tonic-gate extern void interpret_atp_zip(int, struct atp_hdr *, int); 201*7c478bd9Sstevel@tonic-gate 202*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 203*7c478bd9Sstevel@tonic-gate } 204*7c478bd9Sstevel@tonic-gate #endif 205*7c478bd9Sstevel@tonic-gate 206*7c478bd9Sstevel@tonic-gate #endif /* _AT_H */ 207