|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1988 University of Utah. ! 3: * Copyright (c) 1990 The Regents of the University of California. ! 4: * All rights reserved. ! 5: * ! 6: * This code is derived from software contributed to Berkeley by ! 7: * the Systems Programming Group of the University of Utah Computer ! 8: * Science Department. ! 9: * ! 10: * Redistribution is only permitted until one year after the first shipment ! 11: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and ! 12: * binary forms are permitted provided that: (1) source distributions retain ! 13: * this entire copyright notice and comment, and (2) distributions including ! 14: * binaries display the following acknowledgement: This product includes ! 15: * software developed by the University of California, Berkeley and its ! 16: * contributors'' in the documentation or other materials provided with the ! 17: * distribution and in all advertising materials mentioning features or use ! 18: * of this software. Neither the name of the University nor the names of ! 19: * its contributors may be used to endorse or promote products derived from ! 20: * this software without specific prior written permission. ! 21: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED ! 22: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF ! 23: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ! 24: * ! 25: * from: Utah $Hdr: rmp_var.h 1.3 89/06/07$ ! 26: * ! 27: * @(#)rmp_var.h 7.1 (Berkeley) 5/8/90 ! 28: */ ! 29: ! 30: /* ! 31: * WARNING: rmp_packet is defined assuming alignment on 16-bit boundaries. ! 32: * Data will be contiguous on HP's (MC68000), but there may be holes if ! 33: * this is used elsewhere (e.g. VAXen). Or, in other words: ! 34: * ! 35: * if (sizeof(struct rmp_packet) != 1504) error("AlignmentProblem"); ! 36: */ ! 37: ! 38: /* ! 39: * Possible values for "rmp_type" fields. ! 40: */ ! 41: ! 42: #define RMP_BOOT_REQ 1 /* boot request packet */ ! 43: #define RMP_BOOT_REPL 129 /* boot reply packet */ ! 44: #define RMP_READ_REQ 2 /* read request packet */ ! 45: #define RMP_READ_REPL 130 /* read reply packet */ ! 46: #define RMP_BOOT_DONE 3 /* boot complete packet */ ! 47: ! 48: /* ! 49: * Useful constants. ! 50: */ ! 51: ! 52: #define RMP_VERSION 2 /* protocol version */ ! 53: #define RMP_TIMEOUT 600 /* timeout connection after ten minutes */ ! 54: #define RMP_PROBESID 0xffff /* session ID for probes */ ! 55: #define RMP_HOSTLEN 13 /* max length of server's name */ ! 56: ! 57: /* ! 58: * RMP error codes ! 59: */ ! 60: ! 61: #define RMP_E_OKAY 0 ! 62: #define RMP_E_EOF 2 /* read reply: returned end of file */ ! 63: #define RMP_E_ABORT 3 /* abort operation */ ! 64: #define RMP_E_BUSY 4 /* boot reply: server busy */ ! 65: #define RMP_E_TIMEOUT 5 /* lengthen time out (not implemented) */ ! 66: #define RMP_E_NOFILE 16 /* boot reply: file does not exist */ ! 67: #define RMP_E_OPENFILE 17 /* boot reply: file open failed */ ! 68: #define RMP_E_NODFLT 18 /* boot reply: default file does not exist */ ! 69: #define RMP_E_OPENDFLT 19 /* boot reply: default file open failed */ ! 70: #define RMP_E_BADSID 25 /* read reply: bad session ID */ ! 71: #define RMP_E_BADPACKET 27 /* Bad packet detected */ ! 72: ! 73: /* ! 74: * Assorted field sizes. ! 75: */ ! 76: ! 77: #define RMPADDRLEN 6 /* size of ethernet address */ ! 78: #define RMPLENGTHLEN 2 /* size of ethernet length field (802.3) */ ! 79: #define RMPMACHLEN 20 /* length of machine type field */ ! 80: ! 81: /* ! 82: * RMPDATALEN is the maximum number of data octets that can be stuffed ! 83: * into an RMP packet. This excludes the 802.2 LLC w/HP extensions. ! 84: */ ! 85: ! 86: #define RMPDATALEN (RMP_MAX_PACKET - (2*RMPADDRLEN + RMPLENGTHLEN + \ ! 87: sizeof(struct hp_llc)) ) ! 88: ! 89: /* ! 90: * Define sizes of packets we send. Boot and Read replies are variable ! 91: * in length depending on the length of `s'. ! 92: * ! 93: * Also, define how much space `restofpkt' can take up for outgoing ! 94: * Boot and Read replies. Boot Request packets are effectively ! 95: * limited to 255 bytes due to the preceding 1-byte length field. ! 96: */ ! 97: ! 98: #define RMPBOOTSIZE(s) (sizeof(struct hp_llc) + sizeof(struct ifnet *) + \ ! 99: sizeof(struct rmp_boot_repl) + s - \ ! 100: sizeof(restofpkt)) ! 101: #define RMPREADSIZE(s) (sizeof(struct hp_llc) + sizeof(struct ifnet *) + \ ! 102: sizeof(struct rmp_read_repl) + s - \ ! 103: sizeof(restofpkt) - sizeof(u_char)) ! 104: #define RMPDONESIZE (sizeof(struct hp_llc) + sizeof(struct ifnet *) + \ ! 105: sizeof(struct rmp_boot_done)) ! 106: #define RMPBOOTDATA 255 ! 107: #define RMPREADDATA (RMPDATALEN - \ ! 108: (2*sizeof(u_char)+sizeof(u_short)+sizeof(u_long))) ! 109: ! 110: ! 111: /* ! 112: * This protocol defines some field sizes as "rest of ethernet packet". ! 113: * There is no easy way to specify this in C, so we use a one character ! 114: * field to denote it, and index past it to the end of the packet. ! 115: */ ! 116: ! 117: typedef char restofpkt; ! 118: ! 119: /* ! 120: * Packet structures. ! 121: */ ! 122: ! 123: struct rmp_raw { ! 124: u_char rmp_type; /* packet type */ ! 125: u_char rmp_rawdata[RMPDATALEN-1]; ! 126: }; ! 127: ! 128: struct rmp_boot_req { /* boot request */ ! 129: u_char rmp_type; /* packet type (RMP_BOOT_REQ) */ ! 130: u_char rmp_retcode; /* return code (0) */ ! 131: u_long rmp_seqno; /* sequence number (real time clock) */ ! 132: u_short rmp_session; /* session id (normally 0) */ ! 133: u_short rmp_version; /* protocol version (RMP_VERSION) */ ! 134: char rmp_machtype[RMPMACHLEN]; /* machine type */ ! 135: u_char rmp_flnmsize; /* length of rmp_flnm */ ! 136: restofpkt rmp_flnm; /* name of file to be read */ ! 137: }; ! 138: ! 139: struct rmp_boot_repl { /* boot reply */ ! 140: u_char rmp_type; /* packet type (RMP_BOOT_REPL) */ ! 141: u_char rmp_retcode; /* return code (normally 0) */ ! 142: u_long rmp_seqno; /* sequence number (from boot req) */ ! 143: u_short rmp_session; /* session id (generated) */ ! 144: u_short rmp_version; /* protocol version (RMP_VERSION) */ ! 145: u_char rmp_flnmsize; /* length of rmp_flnm */ ! 146: restofpkt rmp_flnm; /* name of file (from boot req) */ ! 147: }; ! 148: ! 149: struct rmp_read_req { /* read request */ ! 150: u_char rmp_type; /* packet type (RMP_READ_REQ) */ ! 151: u_char rmp_retcode; /* return code (0) */ ! 152: u_long rmp_offset; /* file relative byte offset */ ! 153: u_short rmp_session; /* session id (from boot repl) */ ! 154: u_short rmp_size; /* max no of bytes to send */ ! 155: }; ! 156: ! 157: struct rmp_read_repl { /* read reply */ ! 158: u_char rmp_type; /* packet type (RMP_READ_REPL) */ ! 159: u_char rmp_retcode; /* return code (normally 0) */ ! 160: u_long rmp_offset; /* byte offset (from read req) */ ! 161: u_short rmp_session; /* session id (from read req) */ ! 162: restofpkt rmp_data; /* data (max size from read req) */ ! 163: u_char rmp_unused; /* padding to 16-bit boundary */ ! 164: }; ! 165: ! 166: struct rmp_boot_done { /* boot complete */ ! 167: u_char rmp_type; /* packet type (RMP_BOOT_DONE) */ ! 168: u_char rmp_retcode; /* return code (0) */ ! 169: u_long rmp_unused; /* not used (0) */ ! 170: u_short rmp_session; /* session id (from read repl) */ ! 171: }; ! 172: ! 173: struct rmp_packet { ! 174: struct ifnet *ifp; /* ptr to intf packet arrived on */ ! 175: struct hp_llc hp_llc; ! 176: union { ! 177: struct rmp_boot_req rmp_brq; /* boot request */ ! 178: struct rmp_boot_repl rmp_brpl; /* boot reply */ ! 179: struct rmp_read_req rmp_rrq; /* read request */ ! 180: struct rmp_read_repl rmp_rrpl; /* read reply */ ! 181: struct rmp_boot_done rmp_done; /* boot complete */ ! 182: struct rmp_raw rmp_raw; /* raw data */ ! 183: } rmp_proto; ! 184: }; ! 185: ! 186: /* ! 187: * Make life easier... ! 188: */ ! 189: ! 190: #define r_type rmp_proto.rmp_raw.rmp_type ! 191: #define r_data rmp_proto.rmp_raw.rmp_data ! 192: #define r_brq rmp_proto.rmp_brq ! 193: #define r_brpl rmp_proto.rmp_brpl ! 194: #define r_rrq rmp_proto.rmp_rrq ! 195: #define r_rrpl rmp_proto.rmp_rrpl ! 196: #define r_done rmp_proto.rmp_done ! 197: ! 198: /* ! 199: * RMP socket address: just family & destination addr. ! 200: */ ! 201: ! 202: struct sockaddr_rmp { ! 203: short srmp_family; /* address family (AF_RMP) */ ! 204: u_char srmp_dhost[RMPADDRLEN]; /* ethernet destination addr */ ! 205: };
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.