1 /* $OpenBSD: if.h,v 1.31 2001/07/05 08:34:46 angelos Exp $ */ 2 /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ 3 4 /* 5 * Copyright (c) 1982, 1986, 1989, 1993 6 * The Regents of the University of California. All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. All advertising materials mentioning features or use of this software 17 * must display the following acknowledgement: 18 * This product includes software developed by the University of 19 * California, Berkeley and its contributors. 20 * 4. Neither the name of the University nor the names of its contributors 21 * may be used to endorse or promote products derived from this software 22 * without specific prior written permission. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 * 36 * @(#)if.h 8.1 (Berkeley) 6/10/93 37 */ 38 39 #ifndef _NET_IF_H_ 40 #define _NET_IF_H_ 41 42 #include <sys/queue.h> 43 44 /* 45 * Always include ALTQ glue here -- we use the ALTQ interface queue 46 * structure even when ALTQ is not configured into the kernel so that 47 * the size of struct ifnet does not changed based on the option. The 48 * ALTQ queue structure is API-compatible with the legacy ifqueue. 49 */ 50 #include <altq/if_altq.h> 51 52 /* 53 * Structures defining a network interface, providing a packet 54 * transport mechanism (ala level 0 of the PUP protocols). 55 * 56 * Each interface accepts output datagrams of a specified maximum 57 * length, and provides higher level routines with input datagrams 58 * received from its medium. 59 * 60 * Output occurs when the routine if_output is called, with four parameters: 61 * (*ifp->if_output)(ifp, m, dst, rt) 62 * Here m is the mbuf chain to be sent and dst is the destination address. 63 * The output routine encapsulates the supplied datagram if necessary, 64 * and then transmits it on its medium. 65 * 66 * On input, each interface unwraps the data received by it, and either 67 * places it on the input queue of a internetwork datagram routine 68 * and posts the associated software interrupt, or passes the datagram to a raw 69 * packet input routine. 70 * 71 * Routines exist for locating interfaces by their addresses 72 * or for locating a interface on a certain network, as well as more general 73 * routing and gateway routines maintaining information used to locate 74 * interfaces. These routines live in the files if.c and route.c 75 */ 76 /* XXX fast fix for SNMP, going away soon */ 77 #include <sys/time.h> 78 79 struct mbuf; 80 struct proc; 81 struct rtentry; 82 struct socket; 83 struct ether_header; 84 struct arpcom; 85 struct rt_addrinfo; 86 87 /* 88 * Structure defining statistics and other data kept regarding a network 89 * interface. 90 */ 91 struct if_data { 92 /* generic interface information */ 93 u_char ifi_type; /* ethernet, tokenring, etc. */ 94 u_char ifi_addrlen; /* media address length */ 95 u_char ifi_hdrlen; /* media header length */ 96 u_char ifi_link_state; /* current link state */ 97 u_long ifi_mtu; /* maximum transmission unit */ 98 u_long ifi_metric; /* routing metric (external only) */ 99 u_long ifi_baudrate; /* linespeed */ 100 /* volatile statistics */ 101 u_long ifi_ipackets; /* packets received on interface */ 102 u_long ifi_ierrors; /* input errors on interface */ 103 u_long ifi_opackets; /* packets sent on interface */ 104 u_long ifi_oerrors; /* output errors on interface */ 105 u_long ifi_collisions; /* collisions on csma interfaces */ 106 u_long ifi_ibytes; /* total number of octets received */ 107 u_long ifi_obytes; /* total number of octets sent */ 108 u_long ifi_imcasts; /* packets received via multicast */ 109 u_long ifi_omcasts; /* packets sent via multicast */ 110 u_long ifi_iqdrops; /* dropped on input, this interface */ 111 u_long ifi_noproto; /* destined for unsupported protocol */ 112 struct timeval ifi_lastchange; /* last operational state change */ 113 }; 114 115 /* 116 * Structure defining a queue for a network interface. 117 */ 118 struct ifqueue { 119 struct mbuf *ifq_head; 120 struct mbuf *ifq_tail; 121 int ifq_len; 122 int ifq_maxlen; 123 int ifq_drops; 124 }; 125 126 /* 127 * Values for if_link_state. 128 */ 129 #define LINK_STATE_UNKNOWN 0 /* link invalid/unknown */ 130 #define LINK_STATE_DOWN 1 /* link is down */ 131 #define LINK_STATE_UP 2 /* link is up */ 132 133 /* 134 * Structure defining a queue for a network interface. 135 * 136 * (Would like to call this struct ``if'', but C isn't PL/1.) 137 */ 138 TAILQ_HEAD(ifnet_head, ifnet); /* the actual queue head */ 139 140 /* 141 * Length of interface external name, including terminating '\0'. 142 * Note: this is the same size as a generic device's external name. 143 */ 144 #define IFNAMSIZ 16 145 #define IF_NAMESIZE IFNAMSIZ 146 147 struct ifnet { /* and the entries */ 148 void *if_softc; /* lower-level data for this if */ 149 TAILQ_ENTRY(ifnet) if_list; /* all struct ifnets are chained */ 150 TAILQ_HEAD(, ifaddr) if_addrlist; /* linked list of addresses per if */ 151 char if_xname[IFNAMSIZ]; /* external name (name + unit) */ 152 int if_pcount; /* number of promiscuous listeners */ 153 caddr_t if_bpf; /* packet filter structure */ 154 caddr_t if_bridge; /* bridge structure */ 155 u_short if_index; /* numeric abbreviation for this if */ 156 short if_timer; /* time 'til if_watchdog called */ 157 short if_flags; /* up/down, broadcast, etc. */ 158 struct if_data if_data; /* stats and other data about if */ 159 int if_capabilities; /* interface capabilities */ 160 161 /* procedure handles */ 162 int (*if_output) /* output routine (enqueue) */ 163 __P((struct ifnet *, struct mbuf *, struct sockaddr *, 164 struct rtentry *)); 165 void (*if_start) /* initiate output routine */ 166 __P((struct ifnet *)); 167 int (*if_ioctl) /* ioctl routine */ 168 __P((struct ifnet *, u_long, caddr_t)); 169 int (*if_reset) /* XXX bus reset routine */ 170 __P((struct ifnet *)); 171 void (*if_watchdog) /* timer routine */ 172 __P((struct ifnet *)); 173 struct ifaltq if_snd; /* output queue (includes altq) */ 174 struct ifprefix *if_prefixlist; /* linked list of prefixes per if */ 175 }; 176 #define if_mtu if_data.ifi_mtu 177 #define if_type if_data.ifi_type 178 #define if_addrlen if_data.ifi_addrlen 179 #define if_hdrlen if_data.ifi_hdrlen 180 #define if_metric if_data.ifi_metric 181 #define if_link_state if_data.ifi_link_state 182 #define if_baudrate if_data.ifi_baudrate 183 #define if_ipackets if_data.ifi_ipackets 184 #define if_ierrors if_data.ifi_ierrors 185 #define if_opackets if_data.ifi_opackets 186 #define if_oerrors if_data.ifi_oerrors 187 #define if_collisions if_data.ifi_collisions 188 #define if_ibytes if_data.ifi_ibytes 189 #define if_obytes if_data.ifi_obytes 190 #define if_imcasts if_data.ifi_imcasts 191 #define if_omcasts if_data.ifi_omcasts 192 #define if_iqdrops if_data.ifi_iqdrops 193 #define if_noproto if_data.ifi_noproto 194 #define if_lastchange if_data.ifi_lastchange 195 196 #define IFF_UP 0x1 /* interface is up */ 197 #define IFF_BROADCAST 0x2 /* broadcast address valid */ 198 #define IFF_DEBUG 0x4 /* turn on debugging */ 199 #define IFF_LOOPBACK 0x8 /* is a loopback net */ 200 #define IFF_POINTOPOINT 0x10 /* interface is point-to-point link */ 201 #define IFF_NOTRAILERS 0x20 /* avoid use of trailers */ 202 #define IFF_RUNNING 0x40 /* resources allocated */ 203 #define IFF_NOARP 0x80 /* no address resolution protocol */ 204 #define IFF_PROMISC 0x100 /* receive all packets */ 205 #define IFF_ALLMULTI 0x200 /* receive all multicast packets */ 206 #define IFF_OACTIVE 0x400 /* transmission in progress */ 207 #define IFF_SIMPLEX 0x800 /* can't hear own transmissions */ 208 #define IFF_LINK0 0x1000 /* per link layer defined bit */ 209 #define IFF_LINK1 0x2000 /* per link layer defined bit */ 210 #define IFF_LINK2 0x4000 /* per link layer defined bit */ 211 #define IFF_MULTICAST 0x8000 /* supports multicast */ 212 213 /* flags set internally only: */ 214 #define IFF_CANTCHANGE \ 215 (IFF_BROADCAST|IFF_POINTOPOINT|IFF_RUNNING|IFF_OACTIVE|\ 216 IFF_SIMPLEX|IFF_MULTICAST|IFF_ALLMULTI) 217 218 /* 219 * Some convenience macros used for setting ifi_baudrate. 220 */ 221 #define IF_Kbps(x) ((x) * 1000) /* kilobits/sec. */ 222 #define IF_Mbps(x) (IF_Kbps((x) * 1000)) /* megabits/sec. */ 223 #define IF_Gbps(x) (IF_Mbps((x) * 1000)) /* gigabits/sec. */ 224 225 /* Capabilities that interfaces can advertise. */ 226 #define IFCAP_CSUM_IPv4 0x00000001 /* can do IPv4 header csum */ 227 #define IFCAP_CSUM_TCPv4 0x00000002 /* can do IPv4/TCP csum */ 228 #define IFCAP_CSUM_UDPv4 0x00000004 /* can do IPv4/UDP csum */ 229 #define IFCAP_IPSEC 0x00000008 /* can do IPsec */ 230 #define IFCAP_VLAN_MTU 0x00000010 /* VLAN-compatible MTU */ 231 #define IFCAP_VLAN_HWTAGGING 0x00000020 /* hardware VLAN tag support */ 232 #define IFCAP_IPCOMP 0x00000040 /* can do IPcomp */ 233 234 /* 235 * Output queues (ifp->if_snd) and internetwork datagram level (pup level 1) 236 * input routines have queues of messages stored on ifqueue structures 237 * (defined above). Entries are added to and deleted from these structures 238 * by these macros, which should be called with ipl raised to splimp(). 239 */ 240 #define IF_QFULL(ifq) ((ifq)->ifq_len >= (ifq)->ifq_maxlen) 241 #define IF_DROP(ifq) ((ifq)->ifq_drops++) 242 #define IF_ENQUEUE(ifq, m) { \ 243 (m)->m_nextpkt = 0; \ 244 if ((ifq)->ifq_tail == 0) \ 245 (ifq)->ifq_head = m; \ 246 else \ 247 (ifq)->ifq_tail->m_nextpkt = m; \ 248 (ifq)->ifq_tail = m; \ 249 (ifq)->ifq_len++; \ 250 } 251 #define IF_PREPEND(ifq, m) { \ 252 (m)->m_nextpkt = (ifq)->ifq_head; \ 253 if ((ifq)->ifq_tail == 0) \ 254 (ifq)->ifq_tail = (m); \ 255 (ifq)->ifq_head = (m); \ 256 (ifq)->ifq_len++; \ 257 } 258 #define IF_DEQUEUE(ifq, m) { \ 259 (m) = (ifq)->ifq_head; \ 260 if (m) { \ 261 if (((ifq)->ifq_head = (m)->m_nextpkt) == 0) \ 262 (ifq)->ifq_tail = 0; \ 263 (m)->m_nextpkt = 0; \ 264 (ifq)->ifq_len--; \ 265 } \ 266 } 267 #define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head) 268 #define IF_PURGE(ifq) \ 269 do { \ 270 struct mbuf *__m0; \ 271 \ 272 for (;;) { \ 273 IF_DEQUEUE((ifq), __m0); \ 274 if (__m0 == NULL) \ 275 break; \ 276 else \ 277 m_freem(__m0); \ 278 } \ 279 } while (0) 280 #define IF_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) 281 282 #define IFQ_MAXLEN 50 283 #define IFNET_SLOWHZ 1 /* granularity is 1 second */ 284 285 /* 286 * The ifaddr structure contains information about one address 287 * of an interface. They are maintained by the different address families, 288 * are allocated and attached when an address is set, and are linked 289 * together so all addresses for an interface can be located. 290 */ 291 struct ifaddr { 292 struct sockaddr *ifa_addr; /* address of interface */ 293 struct sockaddr *ifa_dstaddr; /* other end of p-to-p link */ 294 #define ifa_broadaddr ifa_dstaddr /* broadcast address interface */ 295 struct sockaddr *ifa_netmask; /* used to determine subnet */ 296 struct ifnet *ifa_ifp; /* back-pointer to interface */ 297 TAILQ_ENTRY(ifaddr) ifa_list; /* list of addresses for interface */ 298 void (*ifa_rtrequest) /* check or clean routes (+ or -)'d */ 299 __P((int, struct rtentry *, struct rt_addrinfo *)); 300 u_int ifa_flags; /* mostly rt_flags for cloning */ 301 u_int ifa_refcnt; /* count of references */ 302 int ifa_metric; /* cost of going out this interface */ 303 }; 304 #define IFA_ROUTE RTF_UP /* route installed */ 305 306 /* 307 * The prefix structure contains information about one prefix 308 * of an interface. They are maintained by the different address families, 309 * are allocated and attached when an prefix or an address is set, 310 * and are linked together so all prfefixes for an interface can be located. 311 */ 312 struct ifprefix { 313 struct sockaddr *ifpr_prefix; /* prefix of interface */ 314 struct ifnet *ifpr_ifp; /* back-pointer to interface */ 315 struct ifprefix *ifpr_next; 316 u_char ifpr_plen; /* prefix length in bits */ 317 u_char ifpr_type; /* protocol dependent prefix type */ 318 }; 319 320 /* 321 * Message format for use in obtaining information about interfaces 322 * from sysctl and the routing socket. 323 */ 324 struct if_msghdr { 325 u_short ifm_msglen; /* to skip over non-understood messages */ 326 u_char ifm_version; /* future binary compatability */ 327 u_char ifm_type; /* message type */ 328 int ifm_addrs; /* like rtm_addrs */ 329 int ifm_flags; /* value of if_flags */ 330 u_short ifm_index; /* index for associated ifp */ 331 struct if_data ifm_data;/* statistics and other data about if */ 332 }; 333 334 /* 335 * Message format for use in obtaining information about interface addresses 336 * from sysctl and the routing socket. 337 */ 338 struct ifa_msghdr { 339 u_short ifam_msglen; /* to skip over non-understood messages */ 340 u_char ifam_version; /* future binary compatability */ 341 u_char ifam_type; /* message type */ 342 int ifam_addrs; /* like rtm_addrs */ 343 int ifam_flags; /* value of ifa_flags */ 344 u_short ifam_index; /* index for associated ifp */ 345 int ifam_metric; /* value of ifa_metric */ 346 }; 347 348 /* 349 * Interface request structure used for socket 350 * ioctl's. All interface ioctl's must have parameter 351 * definitions which begin with ifr_name. The 352 * remainder may be interface specific. 353 */ 354 struct ifreq { 355 char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 356 union { 357 struct sockaddr ifru_addr; 358 struct sockaddr ifru_dstaddr; 359 struct sockaddr ifru_broadaddr; 360 short ifru_flags; 361 int ifru_metric; 362 caddr_t ifru_data; 363 } ifr_ifru; 364 #define ifr_addr ifr_ifru.ifru_addr /* address */ 365 #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ 366 #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ 367 #define ifr_flags ifr_ifru.ifru_flags /* flags */ 368 #define ifr_metric ifr_ifru.ifru_metric /* metric */ 369 #define ifr_mtu ifr_ifru.ifru_metric /* mtu (overload) */ 370 #define ifr_media ifr_ifru.ifru_metric /* media options (overload) */ 371 #define ifr_data ifr_ifru.ifru_data /* for use by interface */ 372 }; 373 374 struct ifaliasreq { 375 char ifra_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 376 struct sockaddr ifra_addr; 377 struct sockaddr ifra_dstaddr; 378 #define ifra_broadaddr ifra_dstaddr 379 struct sockaddr ifra_mask; 380 }; 381 382 struct ifmediareq { 383 char ifm_name[IFNAMSIZ]; /* if name, e.g. "en0" */ 384 int ifm_current; /* current media options */ 385 int ifm_mask; /* don't care mask */ 386 int ifm_status; /* media status */ 387 int ifm_active; /* active options */ 388 int ifm_count; /* # entries in ifm_ulist 389 array */ 390 int *ifm_ulist; /* media words */ 391 }; 392 393 /* 394 * Structure used in SIOCGIFCONF request. 395 * Used to retrieve interface configuration 396 * for machine (useful for programs which 397 * must know all networks accessible). 398 */ 399 struct ifconf { 400 int ifc_len; /* size of associated buffer */ 401 union { 402 caddr_t ifcu_buf; 403 struct ifreq *ifcu_req; 404 } ifc_ifcu; 405 #define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */ 406 #define ifc_req ifc_ifcu.ifcu_req /* array of structures returned */ 407 }; 408 409 /* 410 * Structure for SIOC[AGD]LIFADDR 411 */ 412 struct if_laddrreq { 413 char iflr_name[IFNAMSIZ]; 414 unsigned int flags; 415 #define IFLR_PREFIX 0x8000 /* in: prefix given out: kernel fills id */ 416 unsigned int prefixlen; /* in/out */ 417 struct sockaddr_storage addr; /* in/out */ 418 struct sockaddr_storage dstaddr; /* out */ 419 }; 420 421 struct if_nameindex { 422 unsigned int if_index; 423 char *if_name; 424 }; 425 426 #ifndef _KERNEL 427 __BEGIN_DECLS 428 unsigned int if_nametoindex __P((const char *)); 429 char *if_indextoname __P((unsigned int, char *)); 430 struct if_nameindex *if_nameindex __P((void)); 431 __END_DECLS 432 #define if_freenameindex(x) free(x) 433 #endif 434 435 #include <net/if_arp.h> 436 437 #ifdef _KERNEL 438 #define IFAFREE(ifa) \ 439 do { \ 440 if ((ifa)->ifa_refcnt <= 0) \ 441 ifafree(ifa); \ 442 else \ 443 (ifa)->ifa_refcnt--; \ 444 } while (0) 445 446 #ifdef ALTQ 447 #define ALTQ_DECL(x) x 448 449 #define IFQ_ENQUEUE(ifq, m, pattr, err) \ 450 do { \ 451 if (ALTQ_IS_ENABLED((ifq))) \ 452 ALTQ_ENQUEUE((ifq), (m), (pattr), (err)); \ 453 else { \ 454 if (IF_QFULL((ifq))) { \ 455 m_freem((m)); \ 456 (err) = ENOBUFS; \ 457 } else { \ 458 IF_ENQUEUE((ifq), (m)); \ 459 (err) = 0; \ 460 } \ 461 } \ 462 if ((err)) \ 463 (ifq)->ifq_drops++; \ 464 } while (0) 465 466 #define IFQ_DEQUEUE(ifq, m) \ 467 do { \ 468 if (TBR_IS_ENABLED((ifq))) \ 469 (m) = tbr_dequeue((ifq), ALTDQ_REMOVE); \ 470 else if (ALTQ_IS_ENABLED((ifq))) \ 471 ALTQ_DEQUEUE((ifq), (m)); \ 472 else \ 473 IF_DEQUEUE((ifq), (m)); \ 474 } while (0) 475 476 #define IFQ_POLL(ifq, m) \ 477 do { \ 478 if (TBR_IS_ENABLED((ifq))) \ 479 (m) = tbr_dequeue((ifq), ALTDQ_POLL); \ 480 else if (ALTQ_IS_ENABLED((ifq))) \ 481 ALTQ_POLL((ifq), (m)); \ 482 else \ 483 IF_POLL((ifq), (m)); \ 484 } while (0) 485 486 #define IFQ_PURGE(ifq) \ 487 do { \ 488 if (ALTQ_IS_ENABLED((ifq))) \ 489 ALTQ_PURGE((ifq)); \ 490 else \ 491 IF_PURGE((ifq)); \ 492 } while (0) 493 494 #define IFQ_SET_READY(ifq) \ 495 do { ((ifq)->altq_flags |= ALTQF_READY); } while (0) 496 497 #define IFQ_CLASSIFY(ifq, m, af, pa) \ 498 do { \ 499 if (ALTQ_IS_ENABLED((ifq))) { \ 500 if (ALTQ_NEEDS_CLASSIFY((ifq))) \ 501 (pa)->pattr_class = (*(ifq)->altq_classify) \ 502 ((ifq)->altq_clfier, (m), (af)); \ 503 (pa)->pattr_af = (af); \ 504 (pa)->pattr_hdr = mtod((m), caddr_t); \ 505 } \ 506 } while (0) 507 508 #else /* !ALTQ */ 509 #define ALTQ_DECL(x) /* nothing */ 510 511 #define IFQ_ENQUEUE(ifq, m, pattr, err) \ 512 do { \ 513 if (IF_QFULL((ifq))) { \ 514 m_freem((m)); \ 515 (err) = ENOBUFS; \ 516 } else { \ 517 IF_ENQUEUE((ifq), (m)); \ 518 (err) = 0; \ 519 } \ 520 if ((err)) \ 521 (ifq)->ifq_drops++; \ 522 } while (0) 523 524 #define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m)) 525 526 #define IFQ_POLL(ifq, m) IF_POLL((ifq), (m)) 527 528 #define IFQ_PURGE(ifq) IF_PURGE((ifq)) 529 530 #define IFQ_SET_READY(ifq) /* nothing */ 531 532 #define IFQ_CLASSIFY(ifq, m, af, pa) /* nothing */ 533 534 #endif /* ALTQ */ 535 536 #define IFQ_IS_EMPTY(ifq) ((ifq)->ifq_len == 0) 537 #define IFQ_INC_LEN(ifq) ((ifq)->ifq_len++) 538 #define IFQ_DEC_LEN(ifq) (--(ifq)->ifq_len) 539 #define IFQ_INC_DROPS(ifq) ((ifq)->ifq_drops++) 540 #define IFQ_SET_MAXLEN(ifq, len) ((ifq)->ifq_maxlen = (len)) 541 542 struct ifnet_head ifnet; 543 struct ifnet **ifindex2ifnet; 544 struct ifnet *lo0ifp; 545 int if_index; 546 547 void ether_ifattach __P((struct ifnet *)); 548 void ether_ifdetach __P((struct ifnet *)); 549 int ether_ioctl __P((struct ifnet *, struct arpcom *, u_long, caddr_t)); 550 void ether_input_mbuf __P((struct ifnet *, struct mbuf *)); 551 void ether_input __P((struct ifnet *, struct ether_header *, struct mbuf *)); 552 int ether_output __P((struct ifnet *, 553 struct mbuf *, struct sockaddr *, struct rtentry *)); 554 char *ether_sprintf __P((u_char *)); 555 556 void if_attach __P((struct ifnet *)); 557 void if_attachtail __P((struct ifnet *)); 558 void if_attachhead __P((struct ifnet *)); 559 void if_detach __P((struct ifnet *)); 560 void if_down __P((struct ifnet *)); 561 void if_qflush __P((struct ifqueue *)); 562 void if_slowtimo __P((void *)); 563 void if_up __P((struct ifnet *)); 564 int ifconf __P((u_long, caddr_t)); 565 void ifinit __P((void)); 566 int ifioctl __P((struct socket *, u_long, caddr_t, struct proc *)); 567 int ifpromisc __P((struct ifnet *, int)); 568 struct ifnet *ifunit __P((char *)); 569 570 struct ifaddr *ifa_ifwithaddr __P((struct sockaddr *)); 571 struct ifaddr *ifa_ifwithaf __P((int)); 572 struct ifaddr *ifa_ifwithdstaddr __P((struct sockaddr *)); 573 struct ifaddr *ifa_ifwithnet __P((struct sockaddr *)); 574 struct ifaddr *ifa_ifwithroute __P((int, struct sockaddr *, 575 struct sockaddr *)); 576 struct ifaddr *ifaof_ifpforaddr __P((struct sockaddr *, struct ifnet *)); 577 void ifafree __P((struct ifaddr *)); 578 void link_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *)); 579 580 int loioctl __P((struct ifnet *, u_long, caddr_t)); 581 void loopattach __P((int)); 582 int looutput __P((struct ifnet *, 583 struct mbuf *, struct sockaddr *, struct rtentry *)); 584 void lortrequest __P((int, struct rtentry *, struct rt_addrinfo *)); 585 #endif /* _KERNEL */ 586 #endif /* _NET_IF_H_ */ 587