xref: /original-bsd/sys/netinet/in_var.h (revision c73c5200)
1 /*
2  * Copyright (c) 1985, 1986 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that the above copyright notice and this paragraph are
7  * duplicated in all such forms and that any documentation,
8  * advertising materials, and other materials related to such
9  * distribution and use acknowledge that the software was developed
10  * by the University of California, Berkeley.  The name of the
11  * University may not be used to endorse or promote products derived
12  * from this software without specific prior written permission.
13  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
16  *
17  *	@(#)in_var.h	7.4 (Berkeley) 04/22/89
18  */
19 
20 /*
21  * Interface address, Internet version.  One of these structures
22  * is allocated for each interface with an Internet address.
23  * The ifaddr structure contains the protocol-independent part
24  * of the structure and is assumed to be first.
25  */
26 struct in_ifaddr {
27 	struct	ifaddr ia_ifa;		/* protocol-independent info */
28 #define	ia_ifp		ia_ifa.ifa_ifp
29 					/* ia_{,sub}net{,mask} in host order */
30 	u_long	ia_net;			/* network number of interface */
31 	u_long	ia_netmask;		/* mask of net part */
32 	u_long	ia_subnet;		/* subnet number, including net */
33 	u_long	ia_subnetmask;		/* mask of subnet part */
34 	int	ia_flags;
35 	struct	in_addr ia_netbroadcast; /* to recognize net broadcasts */
36 	struct	in_ifaddr *ia_next;	/* next in list of internet addresses */
37 	struct	sockaddr_in ia_addr;	/* reserve space for interface name */
38 	struct	sockaddr_in ia_dstaddr; /* reserve space for broadcast addr */
39 #define	ia_broadaddr	ia_dstaddr
40 	struct	sockaddr_in ia_sockmask; /* reserve space for general netmask */
41 };
42 
43 struct	in_aliasreq {
44 	char	ifra_name[IFNAMSIZ];		/* if name, e.g. "en0" */
45 	struct	sockaddr_in ifra_addr;
46 	struct	sockaddr_in ifra_broadaddr;
47 #define ifra_dstaddr ifra_broadaddr
48 	struct	sockaddr_in ifra_mask;
49 };
50 /*
51  * Given a pointer to an in_ifaddr (ifaddr),
52  * return a pointer to the addr as a sockadd_in.
53  */
54 #define	IA_SIN(ia) (&(((struct in_ifaddr *)(ia))->ia_addr))
55 /*
56  * ia_flags
57  */
58 #define	IFA_ROUTE	0x01		/* routing entry installed */
59 
60 #ifdef	KERNEL
61 struct	in_ifaddr *in_ifaddr;
62 struct	in_ifaddr *in_iaonnetof();
63 struct	ifqueue	ipintrq;		/* ip packet input queue */
64 #endif
65