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 #ifdef __cplusplus 32*7c478bd9Sstevel@tonic-gate extern "C" { 33*7c478bd9Sstevel@tonic-gate #endif 34*7c478bd9Sstevel@tonic-gate 35*7c478bd9Sstevel@tonic-gate /* 36*7c478bd9Sstevel@tonic-gate * There is a lot of alignment problems in AppleTalk packets. 37*7c478bd9Sstevel@tonic-gate * This is the reason some of the headers use uint8_t arrays instead of the 38*7c478bd9Sstevel@tonic-gate * natural datatype. 39*7c478bd9Sstevel@tonic-gate */ 40*7c478bd9Sstevel@tonic-gate 41*7c478bd9Sstevel@tonic-gate /* AARP */ 42*7c478bd9Sstevel@tonic-gate 43*7c478bd9Sstevel@tonic-gate #define AARP_REQ 1 44*7c478bd9Sstevel@tonic-gate #define AARP_RESP 2 45*7c478bd9Sstevel@tonic-gate #define AARP_PROBE 3 46*7c478bd9Sstevel@tonic-gate 47*7c478bd9Sstevel@tonic-gate 48*7c478bd9Sstevel@tonic-gate /* DDP */ 49*7c478bd9Sstevel@tonic-gate 50*7c478bd9Sstevel@tonic-gate struct ddp_hdr { 51*7c478bd9Sstevel@tonic-gate uint8_t ddp_hop_len; 52*7c478bd9Sstevel@tonic-gate uint8_t ddp_len_lo; 53*7c478bd9Sstevel@tonic-gate uint16_t ddp_cksum; 54*7c478bd9Sstevel@tonic-gate uint16_t ddp_dest_net; 55*7c478bd9Sstevel@tonic-gate uint16_t ddp_src_net; 56*7c478bd9Sstevel@tonic-gate uint8_t ddp_dest_id; 57*7c478bd9Sstevel@tonic-gate uint8_t ddp_src_id; 58*7c478bd9Sstevel@tonic-gate uint8_t ddp_dest_sock; 59*7c478bd9Sstevel@tonic-gate uint8_t ddp_src_sock; 60*7c478bd9Sstevel@tonic-gate uint8_t ddp_type; 61*7c478bd9Sstevel@tonic-gate }; 62*7c478bd9Sstevel@tonic-gate 63*7c478bd9Sstevel@tonic-gate #define ddp_pad(x) ((x)->ddp_hop_len & 0xc0) 64*7c478bd9Sstevel@tonic-gate #define ddp_hop(x) (((x)->ddp_hop_len >> 2) & 0xf) 65*7c478bd9Sstevel@tonic-gate #define ddp_len(x) ((((x)->ddp_hop_len & 0x3) << 8) + (x)->ddp_len_lo) 66*7c478bd9Sstevel@tonic-gate 67*7c478bd9Sstevel@tonic-gate #define DDPHDR_SIZE 13 68*7c478bd9Sstevel@tonic-gate 69*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_RTMPRQ 5 70*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_RTMPRESP 1 71*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_NBP 2 72*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_ATP 3 73*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_AEP 4 74*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_ZIP 6 75*7c478bd9Sstevel@tonic-gate #define DDP_TYPE_ADSP 7 76*7c478bd9Sstevel@tonic-gate 77*7c478bd9Sstevel@tonic-gate 78*7c478bd9Sstevel@tonic-gate /* AECHO */ 79*7c478bd9Sstevel@tonic-gate 80*7c478bd9Sstevel@tonic-gate #define AEP_REQ 1 81*7c478bd9Sstevel@tonic-gate #define AEP_REPLY 2 82*7c478bd9Sstevel@tonic-gate 83*7c478bd9Sstevel@tonic-gate /* NBP */ 84*7c478bd9Sstevel@tonic-gate 85*7c478bd9Sstevel@tonic-gate struct nbp_hdr { 86*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 87*7c478bd9Sstevel@tonic-gate uint8_t nbp_fun_cnt; 88*7c478bd9Sstevel@tonic-gate uint8_t nbp_id; 89*7c478bd9Sstevel@tonic-gate }; 90*7c478bd9Sstevel@tonic-gate 91*7c478bd9Sstevel@tonic-gate #define NBP_BRRQ 1 92*7c478bd9Sstevel@tonic-gate #define NBP_LKUP 2 93*7c478bd9Sstevel@tonic-gate #define NBP_LKUP_REPLY 3 94*7c478bd9Sstevel@tonic-gate #define NBP_FWDREQ 4 95*7c478bd9Sstevel@tonic-gate 96*7c478bd9Sstevel@tonic-gate 97*7c478bd9Sstevel@tonic-gate /* ZIP */ 98*7c478bd9Sstevel@tonic-gate 99*7c478bd9Sstevel@tonic-gate struct zip_hdr { 100*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 101*7c478bd9Sstevel@tonic-gate uint8_t zip_func; 102*7c478bd9Sstevel@tonic-gate uint8_t zip_netcnt; 103*7c478bd9Sstevel@tonic-gate }; 104*7c478bd9Sstevel@tonic-gate 105*7c478bd9Sstevel@tonic-gate #define ZIP_QUERY 1 106*7c478bd9Sstevel@tonic-gate #define ZIP_REPLY 2 107*7c478bd9Sstevel@tonic-gate #define ZIP_GET_NET_INFO 5 108*7c478bd9Sstevel@tonic-gate #define ZIP_GET_NET_INFO_REPLY 6 109*7c478bd9Sstevel@tonic-gate #define ZIP_NOTIFY 7 110*7c478bd9Sstevel@tonic-gate #define ZIP_EXT_REPLY 8 111*7c478bd9Sstevel@tonic-gate 112*7c478bd9Sstevel@tonic-gate #define ZIP_ATP_GETMYZONE 7 113*7c478bd9Sstevel@tonic-gate #define ZIP_ATP_GETZONELIST 8 114*7c478bd9Sstevel@tonic-gate #define ZIP_ATP_GETLOCALZONES 9 115*7c478bd9Sstevel@tonic-gate 116*7c478bd9Sstevel@tonic-gate #define ZIP_FLG_ONEZ 0x20 117*7c478bd9Sstevel@tonic-gate #define ZIP_FLG_USEBRC 0x40 118*7c478bd9Sstevel@tonic-gate #define ZIP_FLG_ZINV 0x80 119*7c478bd9Sstevel@tonic-gate 120*7c478bd9Sstevel@tonic-gate 121*7c478bd9Sstevel@tonic-gate /* ATP */ 122*7c478bd9Sstevel@tonic-gate 123*7c478bd9Sstevel@tonic-gate struct atp_hdr { 124*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 125*7c478bd9Sstevel@tonic-gate uint8_t atp_ctrl; 126*7c478bd9Sstevel@tonic-gate uint8_t atp_seq; 127*7c478bd9Sstevel@tonic-gate uint8_t atp_tid[2]; 128*7c478bd9Sstevel@tonic-gate uint8_t atp_user[4]; 129*7c478bd9Sstevel@tonic-gate }; 130*7c478bd9Sstevel@tonic-gate 131*7c478bd9Sstevel@tonic-gate #define ATPHDR_SIZE 8 132*7c478bd9Sstevel@tonic-gate 133*7c478bd9Sstevel@tonic-gate #define atp_fun(x) (((x) >> 6) & 0x3) 134*7c478bd9Sstevel@tonic-gate #define atp_tmo(x) ((x) & 0x7) 135*7c478bd9Sstevel@tonic-gate 136*7c478bd9Sstevel@tonic-gate #define ATP_TREQ 1 137*7c478bd9Sstevel@tonic-gate #define ATP_TRESP 2 138*7c478bd9Sstevel@tonic-gate #define ATP_TREL 3 139*7c478bd9Sstevel@tonic-gate #define ATP_FLG_STS 0x08 140*7c478bd9Sstevel@tonic-gate #define ATP_FLG_EOM 0x10 141*7c478bd9Sstevel@tonic-gate #define ATP_FLG_XO 0x20 142*7c478bd9Sstevel@tonic-gate 143*7c478bd9Sstevel@tonic-gate 144*7c478bd9Sstevel@tonic-gate #define NODE_ID_BROADCAST 0xff 145*7c478bd9Sstevel@tonic-gate 146*7c478bd9Sstevel@tonic-gate struct ddp_adsphdr { 147*7c478bd9Sstevel@tonic-gate uint8_t ddphdr[DDPHDR_SIZE]; 148*7c478bd9Sstevel@tonic-gate uint8_t ad_connid[2]; /* short */ 149*7c478bd9Sstevel@tonic-gate uint8_t ad_fbseq[4]; /* long */ 150*7c478bd9Sstevel@tonic-gate uint8_t ad_nrseq[4]; /* long */ 151*7c478bd9Sstevel@tonic-gate uint8_t ad_rcvwin[2]; /* short */ 152*7c478bd9Sstevel@tonic-gate uint8_t ad_desc; 153*7c478bd9Sstevel@tonic-gate }; 154*7c478bd9Sstevel@tonic-gate 155*7c478bd9Sstevel@tonic-gate #define AD_CTRL 0x80 156*7c478bd9Sstevel@tonic-gate #define AD_ACKREQ 0x40 157*7c478bd9Sstevel@tonic-gate #define AD_EOM 0x20 158*7c478bd9Sstevel@tonic-gate #define AD_ATT 0x10 159*7c478bd9Sstevel@tonic-gate #define AD_CTRL_MASK 0x0f 160*7c478bd9Sstevel@tonic-gate 161*7c478bd9Sstevel@tonic-gate #define AD_CREQ 0x81 /* Open Conn Request */ 162*7c478bd9Sstevel@tonic-gate #define AD_CACK 0x82 /* Open Conn Ack */ 163*7c478bd9Sstevel@tonic-gate #define AD_CREQ_ACK 0x83 /* Open Conn Req+Ack */ 164*7c478bd9Sstevel@tonic-gate #define AD_CDENY 0x84 /* Open Conn Denial */ 165*7c478bd9Sstevel@tonic-gate 166*7c478bd9Sstevel@tonic-gate struct ddp_adsp_att { 167*7c478bd9Sstevel@tonic-gate struct ddp_adsphdr ad; 168*7c478bd9Sstevel@tonic-gate uint8_t ad_att_code[2]; /* short */ 169*7c478bd9Sstevel@tonic-gate }; 170*7c478bd9Sstevel@tonic-gate 171*7c478bd9Sstevel@tonic-gate struct ddp_adsp_open { 172*7c478bd9Sstevel@tonic-gate struct ddp_adsphdr ad; 173*7c478bd9Sstevel@tonic-gate uint8_t ad_version[2]; /* short */ 174*7c478bd9Sstevel@tonic-gate uint8_t ad_dconnid[2]; /* short */ 175*7c478bd9Sstevel@tonic-gate uint8_t ad_attseq[4]; /* long */ 176*7c478bd9Sstevel@tonic-gate }; 177*7c478bd9Sstevel@tonic-gate 178*7c478bd9Sstevel@tonic-gate #define RTMP_REQ 1 179*7c478bd9Sstevel@tonic-gate #define RTMP_RDR_SH 2 /* Route Data Request, split horizon */ 180*7c478bd9Sstevel@tonic-gate #define RTMP_RDR_NSH 3 /* Route Data Request, no split horizon */ 181*7c478bd9Sstevel@tonic-gate 182*7c478bd9Sstevel@tonic-gate #define RTMP_DIST_MASK 0x1f 183*7c478bd9Sstevel@tonic-gate #define RTMP_EXTEND 0x80 184*7c478bd9Sstevel@tonic-gate #define RTMP_FILLER 0x82 185*7c478bd9Sstevel@tonic-gate 186*7c478bd9Sstevel@tonic-gate 187*7c478bd9Sstevel@tonic-gate uint16_t get_short(uint8_t *); 188*7c478bd9Sstevel@tonic-gate uint32_t get_long(uint8_t *); 189*7c478bd9Sstevel@tonic-gate 190*7c478bd9Sstevel@tonic-gate extern void interpret_aarp(int, char *, int); 191*7c478bd9Sstevel@tonic-gate extern void interpret_at(int, struct ddp_hdr *, int); 192*7c478bd9Sstevel@tonic-gate extern void interpret_nbp(int, struct nbp_hdr *, int); 193*7c478bd9Sstevel@tonic-gate extern void interpret_rtmp(int, struct ddp_hdr *, int); 194*7c478bd9Sstevel@tonic-gate extern void interpret_aecho(int, struct ddp_hdr *, int); 195*7c478bd9Sstevel@tonic-gate extern void interpret_atp(int, struct ddp_hdr *, int); 196*7c478bd9Sstevel@tonic-gate extern void interpret_adsp(int, struct ddp_adsphdr *, int); 197*7c478bd9Sstevel@tonic-gate extern void interpret_ddp_zip(int, struct zip_hdr *, int); 198*7c478bd9Sstevel@tonic-gate extern void interpret_atp_zip(int, struct atp_hdr *, int); 199*7c478bd9Sstevel@tonic-gate 200*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus 201*7c478bd9Sstevel@tonic-gate } 202*7c478bd9Sstevel@tonic-gate #endif 203*7c478bd9Sstevel@tonic-gate 204*7c478bd9Sstevel@tonic-gate #endif /* _AT_H */ 205