Changeset 183 for trunk/src/emx/include/net/if.h
- Timestamp:
- May 19, 2003, 4:41:00 AM (23 years ago)
- File:
-
- 1 edited
-
trunk/src/emx/include/net/if.h (modified) (19 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/emx/include/net/if.h
-
Property cvs2svn:cvs-rev
changed from
1.1to1.2
r182 r183 1 1 /* Modifed for emx by hv 1994,1996 2 2 3 * 3 4 * Copyright (c) 1982, 1986, 1989 Regents of the University of California. … … 43 44 #endif 44 45 46 47 48 49 50 45 51 /* 46 52 * Structures defining a network interface, providing a packet … … 67 73 * interfaces. These routines live in the files if.c and route.c 68 74 */ 69 /* XXX fast fix for SNMP, going away soon */70 #include <sys/time.h>71 72 #ifdef TCPIPV473 #pragma pack(1)74 #else75 #pragma pack(4)76 #endif77 78 75 79 76 /* … … 82 79 * (Would like to call this struct ``if'', but C isn't PL/1.) 83 80 */ 84 /*forward*/ struct mbuf; 85 /*forward*/ struct ifaddr; 81 #pragma pack(1) 82 struct mbuf; 83 struct ifaddr; 86 84 struct ifnet { 87 85 char *if_name; /* name, e.g. ``en'' or ``lo'' */ … … 95 93 struct mbuf *ifq_head; 96 94 struct mbuf *ifq_tail; 97 #ifndef TCPIPV498 int ifq_len;99 int ifq_maxlen;100 int ifq_drops;101 #else102 95 short ifq_len; 103 96 short ifq_maxlen; 104 97 u_short ifq_drops; 105 #endif106 98 } if_snd; /* output queue */ 107 99 /* procedure handles */ … … 112 104 int (*if_watchdog)(void); /* timer routine */ 113 105 /* generic interface statistics */ 114 #ifndef TCPIPV4115 int if_ipackets; /* packets received on interface */116 int if_ierrors; /* input errors on interface */117 int if_opackets; /* packets sent on interface */118 int if_oerrors; /* output errors on interface */119 int if_collisions; /* collisions on csma interfaces */120 #else121 106 u_short if_ipackets; /* packets received on interface */ 122 107 u_short if_ierrors; /* input errors on interface */ … … 124 109 u_short if_oerrors; /* output errors on interface */ 125 110 u_short if_collisions; /* collisions on csma interfaces */ 126 #endif127 111 /* end statistics */ 128 112 struct ifnet *if_next; 129 113 114 130 115 /* the following structures are special for OS/2 TCP/IP only */ 131 116 u_char if_adapternum; /* adapter number */ … … 134 119 u_long if_speed; 135 120 136 #define IF_RTTSCALE 1000 137 u_short if_rtt; /* Est interface rtt in ms */ 138 u_short if_rttvar; /* Est interface rttvar in ms */ 139 u_short if_rttmin; /* Fixed interface rttmin in ms */ 140 u_short if_sendpipe; /* Send socket buffer/window size */ 141 u_short if_recvpipe; /* Recv socket buffer/window size */ 142 u_short if_ssthresh; /* Gateway buffer limit (slow strt) */ 143 #ifdef TCPIPV4 144 u_long if_eflags; /* Extended flags */ 145 struct ifqueue if_traceq; /* packet trace queue */ 146 u_short if_segsize; /* segment size for interface */ 147 u_short if_use576; /* use 576 or 1460 as def. mss if */ 148 /* going through a router */ 149 u_short if_rfc1469; /* using broadcast or functional */ 150 /* addr for IP Multicast */ 151 #define IFF_RFC1469_BC 1 /* use broadcast */ 152 #define IFF_RFC1469_FA 2 /* use functional address */ 153 #define IFF_RFC1469_MA 3 /* use multicast address */ 154 #endif 155 }; 156 157 #ifndef TCPIPV4 158 struct ifmib { 159 int ifNumber; /* number of network interfaces */ 160 struct iftable { 161 int ifIndex; /* index of this interface */ 162 char ifDescr[45]; /* description */ 163 int ifType; /* type of the interface */ 164 int ifMtu; /* MTU of the interface */ 165 char ifPhysAddr[6]; /* MTU of the interface */ 166 int ifOperStatus; 167 u_long ifSpeed; 168 u_long ifLastChange; 169 u_long ifInOctets; 170 u_long ifOutOctets; 171 u_long ifOutDiscards; 172 u_long ifInDiscards; 173 u_long ifInErrors; 174 u_long ifOutErrors; 175 u_long ifInUnknownProtos; 176 u_long ifInUcastPkts; 177 u_long ifOutUcastPkts; 178 u_long ifInNUcastPkts; 179 u_long ifOutNUcastPkts; 180 } iftable[20]; 181 }; 182 #else /* TCP/IP V4 */ 121 /* Interface TCP estimates/controls. Serves the same */ 122 /* purpose as the per-route values in BSD-Reno, but I didn't */ 123 /* have to touch any of the route manipulation code. */ 124 u_short if_rtt; /* Est interface rtt in ms */ 125 u_short if_rttvar; /* Est interface rttvar in ms */ 126 u_short if_rttmin; /* Fixed interface rttmin in ms */ 127 u_short if_sendpipe; /* Send socket buffer/window size */ 128 u_short if_recvpipe; /* Recv socket buffer/window size */ 129 u_short if_ssthresh; /* Gateway buffer limit (slow strt) */ 130 u_long if_eflags; /* Extended Flags */ 131 struct ifqueue if_traceq; /* packet trace queue */ 132 u_short if_segsize; /* segment size for interface*/ 133 u_short if_use576; /* use 576 or 1460 as def. mss if going thru a router */ 134 /* Token Ring IP multicast flag */ 135 u_short if_rfc1469; /* using broadcast or functional address */ 136 /* for IP Mulitcast */ 137 #define IF_RTTSCALE 1000 138 #endif /* __OS2__ */ 139 }; 140 #pragma pack() 141 #endif /*TCPV40HDRS*/ 183 142 184 143 #ifndef IFMIB_ENTRIES … … 186 145 #endif 187 146 147 148 188 149 struct ifmib { 189 150 short ifNumber; /* number of network interfaces */ … … 210 171 } iftable[IFMIB_ENTRIES]; 211 172 }; 212 #endif /* TCP/IP V4 */ 213 #pragma pack() 173 #pragma pack() 174 175 #else /*TCPV40HDRS*/ 176 177 #pragma pack(1) /* force on doubleword boundary */ 178 struct iftable { 179 short iftIndex; /* index of this interface */ 180 char iftDescr[45]; /* description */ 181 short iftType; /* type of the interface */ 182 short iftMtu; /* MTU of the interface */ 183 char iftPhysAddr[6]; /* MTU of the interface */ 184 short iftOperStatus; 185 u_long iftSpeed; 186 u_long iftLastChange; 187 u_long iftInOctets; 188 u_long iftOutOctets; 189 u_long iftOutDiscards; 190 u_long iftInDiscards; 191 u_long iftInErrors; 192 u_long iftOutErrors; 193 u_long iftInUnknownProtos; 194 u_long iftInUcastPkts; 195 u_long iftOutUcastPkts; 196 u_long iftInNUcastPkts; 197 u_long iftOutNUcastPkts; 198 }; 199 struct ifmib { 200 short ifNumber; 201 struct iftable iftable[IFMIB_ENTRIES]; 202 }; 203 #pragma pack() /* reset to default packing */ 204 205 #define IFC_ALLRTSBCAST 0x0001 206 #define IFC_802_3 0x0002 207 #define IFC_FDDI 0x0004 208 #define IFC_NOREDIR 0x0010 209 210 #define OPERSTATUS_UP 0x1 211 #define OPERSTATUS_DOWN 0x2 212 #define OPERSTATUS_TESTING 0x3 213 #endif /*TCPV40HDRS*/ 214 214 215 215 #define IFF_UP 0x1 /* interface is up */ … … 219 219 #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ 220 220 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 221 222 223 221 224 #define IFF_RUNNING 0x40 /* resources allocated */ 222 225 #define IFF_NOARP 0x80 /* no address resolution protocol */ 223 /* next two not supported now, but reserved: */224 226 #define IFF_PROMISC 0x100 /* receive all packets */ 225 227 #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ 226 #define IFF_OACTIVE 0x400 /* transmission in progress */ 227 #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ 228 #define IFF_DEFMTU 0x400 /* default mtu of 1500 */ 229 #define IFF_MULTICAST 0x800 /* supports multicast */ 230 /* 231 * The IFF_MULTICAST flag indicates that the network can support the 232 * transmission and reception of higher-level (e.g., IP) multicast packets. 233 * It is independent of hardware support for multicasting; for example, 234 * point-to-point links or pure broadcast networks may well support 235 * higher-level multicasts. 236 */ 228 237 #define IFF_BRIDGE 0x1000 /* support token ring routine field */ 229 #define IFF_SNAP 0x2000 /* support extended S NAP header */238 #define IFF_SNAP 0x2000 /* support extended SAP header */ 230 239 #define IFF_ETHER 0x4000 /* ethernet interface */ 231 240 #define IFF_LOOPBRD 0x8000 /* ethernet interface */ 241 242 243 244 245 246 247 248 249 250 251 232 252 233 253 /*hv: flags set internally only */ 234 #ifdef BSD_TCPCOMPAT 254 #ifdef TCPV40HDRS 255 #define IFF_CANTCHANGE (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING) 256 #else 235 257 #define IFF_CANTCHANGE \ 236 258 (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE| \ 237 IFF_SIMPLEX|IFF_MULTICAST) 238 #else 239 #define IFF_CANTCHANGE (IFF_BROADCAST | IFF_POINTOPOINT | IFF_RUNNING) 240 #endif 241 242 #ifdef TCPIPV4 259 IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) 260 #endif 261 243 262 /* packet tracing extension */ 244 263 #define IFFE_PKTTRACE 0x00000001 /* trace datalink where possible */ 245 264 #define IFFE_IPTRACE 0x00000002 /* trace ONLY IP packets */ 246 265 266 267 268 247 269 struct pkt_trace_hdr { 248 270 u_short pt_htype; /* header type */ 249 #define HT_IP 0x01 /* IP */250 #define HT_ETHER 0x06 /* Ethernet */251 #define HT_ISO88023 0x07 /* CSMA CD */252 #define HT_ISO88025 0x09 /* Token Ring */253 #define HT_SLIP 0x1c /* Serial Line IP */254 #define HT_PPP 0x18 /* PPP IP */255 271 u_short pt_len; /* in: pt_buf len, out: packet len */ 256 272 caddr_t pt_data; /* packet ATTN: This is a _Seg16 addr! */ 257 273 u_long pt_tstamp; /* time stamp in milliseconds */ 258 274 }; 259 260 #endif /* TCP/IP V4 */ 261 275 #ifndef TCPV40HDRS 276 #pragma pack() 277 #endif 278 #define HT_IP 0x01 /* IP */ 279 #define HT_ETHER 0x06 /* Ethernet */ 280 #define HT_ISO88023 0x07 /* CSMA CD */ 281 #define HT_ISO88025 0x09 /* Token Ring */ 282 #define HT_SLIP 0x1c /* Serial Line IP */ 283 #define HT_PPP 0x18 /* PPP IP */ 284 285 #ifndef TCPV40HDRS 286 /* genric interface information */ 287 #pragma pack(1) 288 struct if_data { 289 u_char ifi_type; /* ethernet, tokenring, etc */ 290 u_char ifi_addrlen; /* media address length */ 291 u_char ifi_hdrlen; /* media header length */ 292 u_long ifi_mtu; /* maximum transmission unit */ 293 u_long ifi_metric; /* routing metric (external only) */ 294 u_long ifi_baudrate; /* linespeed */ 295 /* volatile statistics */ 296 u_long ifi_collisions; /* collisions on csma interfaces */ 297 u_long ifi_ibytes; /* total number of octets received */ 298 u_long ifi_obytes; /* total number of octets sent */ 299 u_long ifi_oqdrops; /* dropped on output, this interface */ 300 u_long ifi_iqdrops; /* dropped on input, this interface */ 301 u_long ifi_ierrors; /* input errors on interface */ 302 u_long ifi_oerrors; /* output errors on interface */ 303 u_long ifi_noproto; /* destined for unsupported protocol */ 304 u_long ifi_ipackets; /* packets received on interface */ 305 u_long ifi_opackets; /* packets sent on interface */ 306 u_long ifi_imcasts; /* packets received via multicast */ 307 u_long ifi_omcasts; /* packets sent via multicast */ 308 short ifi_OperStatus; /* SNMP Oper Status */ 309 struct timeval ifi_lastchange;/* last updated */ 310 u_char ifi_descr[45]; /* description of the interface */ 311 }; 312 #pragma pack() 313 314 /* 315 * Message format for use in obtaining information about interfaces 316 * from getkerninfo and the routing socket 317 */ 318 #pragma pack(1) 319 struct if_msghdr { 320 u_short ifm_msglen; /* to skip over non-understood messages */ 321 u_char ifm_version; /* future binary compatability */ 322 u_char ifm_type; /* message type */ 323 int ifm_addrs; /* like rtm_addrs */ 324 int ifm_flags; /* value of if_flags */ 325 u_short ifm_index; /* index for associated ifp */ 326 struct if_data ifm_data;/* statistics and other data about if */ 327 }; 328 #pragma pack() 329 330 /* 331 * Message format for use in obtaining information about interface addresses 332 * from getkerninfo and the routing socket 333 */ 334 #pragma pack(1) 335 struct ifa_msghdr { 336 u_short ifam_msglen; /* to skip over non-understood messages */ 337 u_char ifam_version; /* future binary compatability */ 338 u_char ifam_type; /* message type */ 339 int ifam_addrs; /* like rtm_addrs */ 340 int ifam_flags; /* value of ifa_flags */ 341 u_short ifam_index; /* index for associated ifp */ 342 int ifam_metric; /* value of ifa_metric */ 343 }; 344 #pragma pack() 345 #endif /*!TCPV40HDRS*/ 346 347 #ifdef TCPV40HDRS 262 348 /* 263 349 * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) … … 284 370 (ifq)->ifq_len++;\ 285 371 } 286 #define IF_DEQUEUE(ifq, m) {\ 287 (m)=(ifq)->ifq_head;\ 288 if (m) {\ 289 if (((ifq)->ifq_head=(m)->m_act)==0)\ 290 (ifq)->ifq_tail=0;\ 291 (m)->m_act=0;\ 292 (ifq)->ifq_len--;\ 293 }\ 294 } 372 /* 373 * Packets destined for level-1 protocol input routines 374 * have a pointer to the receiving interface prepended to the data. 375 * IF_DEQUEUEIF extracts and returns this pointer when dequeueing the packet. 376 * IF_ADJ should be used otherwise to adjust for its presence. 377 */ 295 378 #define IF_ADJ(m) {\ 296 379 (m)->m_off+=sizeof(struct ifnet*);\ … … 313 396 }\ 314 397 } 398 399 400 401 402 403 404 405 406 315 407 316 408 #define IFQ_MAXLEN 50 … … 334 426 struct ifaddr *ifa_next; /* next address for interface */ 335 427 }; 428 336 429 337 430 /* … … 341 434 * remainder may be interface specific. 342 435 */ 436 437 438 343 439 struct ifreq { 344 440 #define IFNAMSIZ 16 … … 358 454 #define ifr_metric ifr_ifru.ifru_metric /* metric */ 359 455 #define ifr_data ifr_ifru.ifru_data /* for use by interface */ 360 }; 456 #ifndef TCPV40HDRS 457 #define ifr_eflags ifr_ifru.ifru_data /* Extended flags */ 458 #endif 459 }; 460 #ifndef TCPV40HDRS 461 #pragma pack() 462 #endif 463 464 #ifndef TCPV40HDRS 465 #pragma pack(1) 466 struct ifaliasreq { 467 char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 468 struct sockaddr ifra_addr; 469 struct sockaddr ifra_broadaddr; 470 struct sockaddr ifra_mask; 471 }; 472 #pragma pack() 473 #endif 361 474 362 475 /* … … 366 479 * must know all networks accessible). 367 480 */ 481 482 483 368 484 struct ifconf { 369 485 int ifc_len; /* size of associated buffer */ … … 375 491 #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ 376 492 }; 493 494 495 377 496 378 497 #include <net/if_arp.h> … … 382 501 #endif 383 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 384 550 #endif /* _NET_IF_H_ */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
