4 Copyright 1995 Philip Homburg
10 #define IP_FD_NR (8*IP_PORT_MAX)
13 #define IP_42BSD_BCAST 1 /* hostnumber 0 is also network
16 #define IP_LT_NORMAL 0 /* Normal */
17 #define IP_LT_BROADCAST 1 /* Broadcast */
18 #define IP_LT_MULTICAST 2 /* Multicast */
22 typedef void (*ip_dev_t
) ARGS(( struct ip_port
*ip_port
));
23 typedef int (*ip_dev_send_t
) ARGS(( struct ip_port
*ip_port
, ipaddr_t dest
,
24 acc_t
*pack
, int type
));
26 #define IP_PROTO_HASH_NR 32
28 typedef struct ip_port
30 int ip_flags
, ip_dl_type
;
54 ipaddr_t ip_subnetmask
;
55 ipaddr_t ip_classfulmask
;
58 u16_t ip_mtu_max
; /* Max MTU for this kind of network */
60 ip_dev_t ip_dev_set_ipaddr
;
61 ip_dev_send_t ip_dev_send
;
64 event_t ip_loopb_event
;
65 acc_t
*ip_routeq_head
;
66 acc_t
*ip_routeq_tail
;
67 event_t ip_routeq_event
;
68 struct ip_fd
*ip_proto_any
;
69 struct ip_fd
*ip_proto
[IP_PROTO_HASH_NR
];
73 #define IES_SETPROTO 0x1
74 #define IES_GETIPADDR 0x2
79 #define IEF_SUSPEND 0x8
80 #define IEF_READ_IP 0x10
81 #define IEF_READ_SP 0x20
82 #define IEF_WRITE_SP 0x80
85 #define IPF_CONFIGURED 0x1
86 #define IPF_IPADDRSET 0x2
87 #define IPF_NETMASKSET 0x4
88 #define IPF_SUBNET_BCAST 0x8 /* Subset support subnet broadcasts */
90 #define IPDL_ETH NETTYPE_ETH
91 #define IPDL_PSIP NETTYPE_PSIP
99 ipaddr_t ia_srcaddr
, ia_dstaddr
;
106 struct nwio_ipopt if_ipopt
;
108 struct ip_fd
*if_proto_next
;
110 acc_t
*if_rdbuf_head
;
111 acc_t
*if_rdbuf_tail
;
112 get_userdata_t if_get_userdata
;
113 put_userdata_t if_put_userdata
;
114 put_pkt_t if_put_pkt
;
120 #define IFF_EMPTY 0x00
121 #define IFF_INUSE 0x01
122 #define IFF_OPTSET 0x02
123 #define IFF_BUSY 0x1C
124 # define IFF_READ_IP 0x04
125 # define IFF_IOCTL_IP 0x08
129 IPNT_ZERO
, /* 0.xx.xx.xx */
130 IPNT_CLASS_A
, /* 1.xx.xx.xx .. 126.xx.xx.xx */
131 IPNT_LOCAL
, /* 127.xx.xx.xx */
132 IPNT_CLASS_B
, /* 128.xx.xx.xx .. 191.xx.xx.xx */
133 IPNT_CLASS_C
, /* 192.xx.xx.xx .. 223.xx.xx.xx */
134 IPNT_CLASS_D
, /* 224.xx.xx.xx .. 239.xx.xx.xx */
135 IPNT_CLASS_E
, /* 240.xx.xx.xx .. 247.xx.xx.xx */
136 IPNT_MARTIAN
, /* 248.xx.xx.xx .. 254.xx.xx.xx + others */
137 IPNT_BROADCAST
/* 255.255.255.255 */
143 int ipeth_init
ARGS(( ip_port_t
*ip_port
));
146 void ip_hash_proto
ARGS(( ip_fd_t
*ip_fd
));
147 void ip_unhash_proto
ARGS(( ip_fd_t
*ip_fd
));
148 int ip_setconf
ARGS(( int ip_port
, struct nwio_ipconf
*ipconfp
));
151 ipaddr_t ip_get_netmask
ARGS(( ipaddr_t hostaddr
));
152 ipaddr_t ip_get_ifaddr
ARGS(( int ip_port_nr
));
153 int ip_chk_hdropt
ARGS(( u8_t
*opt
, int optlen
));
154 void ip_print_frags
ARGS(( acc_t
*acc
));
155 nettype_t ip_nettype
ARGS(( ipaddr_t ipaddr
));
156 ipaddr_t ip_netmask
ARGS(( nettype_t nettype
));
157 char *ip_nettoa
ARGS(( nettype_t nettype
));
160 int ipps_init
ARGS(( ip_port_t
*ip_port
));
161 void ipps_get
ARGS(( int ip_port_nr
));
162 void ipps_put
ARGS(( int ip_port_nr
, ipaddr_t nexthop
, acc_t
*pack
));
165 void ip_port_arrive
ARGS(( ip_port_t
*port
, acc_t
*pack
, ip_hdr_t
*ip_hdr
));
166 void ip_arrived
ARGS(( ip_port_t
*port
, acc_t
*pack
));
167 void ip_arrived_broadcast
ARGS(( ip_port_t
*port
, acc_t
*pack
));
168 void ip_process_loopb
ARGS(( event_t
*ev
, ev_arg_t arg
));
169 void ip_packet2user
ARGS(( ip_fd_t
*ip_fd
, acc_t
*pack
, time_t exp_time
,
173 void dll_eth_write_frame
ARGS(( ip_port_t
*port
));
174 acc_t
*ip_split_pack
ARGS(( ip_port_t
*ip_port
, acc_t
**ref_last
, int mtu
));
175 void ip_hdr_chksum
ARGS(( ip_hdr_t
*ip_hdr
, int ip_hdr_len
));
178 extern ip_fd_t ip_fd_table
[IP_FD_NR
];
179 extern ip_port_t
*ip_port_table
;
180 extern ip_ass_t ip_ass_table
[IP_ASS_NR
];
182 #define NWIO_DEFAULT (NWIO_EN_LOC | NWIO_EN_BROAD | NWIO_REMANY | \
183 NWIO_RWDATALL | NWIO_HDR_O_SPEC)
185 #endif /* INET_IP_INT_H */
188 * $PchId: ip_int.h,v 1.19 2004/08/03 16:24:23 philip Exp $