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