1:
2:
3:
4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
34:
35: 36: 37: 38:
39:
40: #ifndef _NETINET_IN_H_
41: #define _NETINET_IN_H_
42:
43: 44: 45:
46: #define IPPROTO_IP 0
47: #define IPPROTO_HOPOPTS IPPROTO_IP
48: #define IPPROTO_ICMP 1
49: #define IPPROTO_IGMP 2
50: #define IPPROTO_GGP 3
51: #define IPPROTO_IPIP 4
52: #define IPPROTO_IPV4 IPPROTO_IPIP
53: #define IPPROTO_TCP 6
54: #define IPPROTO_EGP 8
55: #define IPPROTO_PUP 12
56: #define IPPROTO_UDP 17
57: #define IPPROTO_IDP 22
58: #define IPPROTO_TP 29
59: #define IPPROTO_IPV6 41
60: #define IPPROTO_ROUTING 43
61: #define IPPROTO_FRAGMENT 44
62: #define IPPROTO_RSVP 46
63: #define IPPROTO_GRE 47
64: #define IPPROTO_ESP 50
65: #define IPPROTO_AH 51
66: #define IPPROTO_MOBILE 55
67: #define IPPROTO_ICMPV6 58
68: #define IPPROTO_NONE 59
69: #define IPPROTO_DSTOPTS 60
70: #define IPPROTO_EON 80
71: #define IPPROTO_ETHERIP 97
72: #define IPPROTO_ENCAP 98
73: #define IPPROTO_PIM 103
74: #define IPPROTO_IPCOMP 108
75: #define IPPROTO_CARP 112
76: #define IPPROTO_MPLS 137
77: #define IPPROTO_PFSYNC 240
78: #define IPPROTO_RAW 255
79:
80: #define IPPROTO_MAX 256
81:
82:
83: #define IPPROTO_DIVERT 258
84:
85:
86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120:
121:
122: 123: 124: 125: 126: 127:
128: #define IPPORT_RESERVED 1024
129: #define IPPORT_USERRESERVED 49151
130:
131: 132: 133:
134: #define IPPORT_HIFIRSTAUTO 49152
135: #define IPPORT_HILASTAUTO 65535
136:
137: 138: 139:
140: struct in_addr {
141: in_addr_t s_addr;
142: };
143:
144:
145: #define IPPROTO_DONE 257
146:
147: 148: 149: 150: 151: 152: 153: 154: 155:
156: #ifdef _KERNEL
157: #define __IPADDR(x) ((u_int32_t) htonl((u_int32_t)(x)))
158: #else
159: #define __IPADDR(x) ((u_int32_t)(x))
160: #endif
161:
162: #define IN_CLASSA(i) (((u_int32_t)(i) & __IPADDR(0x80000000)) == \
163: __IPADDR(0x00000000))
164: #define IN_CLASSA_NET __IPADDR(0xff000000)
165: #define IN_CLASSA_NSHIFT 24
166: #define IN_CLASSA_HOST __IPADDR(0x00ffffff)
167: #define IN_CLASSA_MAX 128
168:
169: #define IN_CLASSB(i) (((u_int32_t)(i) & __IPADDR(0xc0000000)) == \
170: __IPADDR(0x80000000))
171: #define IN_CLASSB_NET __IPADDR(0xffff0000)
172: #define IN_CLASSB_NSHIFT 16
173: #define IN_CLASSB_HOST __IPADDR(0x0000ffff)
174: #define IN_CLASSB_MAX 65536
175:
176: #define IN_CLASSC(i) (((u_int32_t)(i) & __IPADDR(0xe0000000)) == \
177: __IPADDR(0xc0000000))
178: #define IN_CLASSC_NET __IPADDR(0xffffff00)
179: #define IN_CLASSC_NSHIFT 8
180: #define IN_CLASSC_HOST __IPADDR(0x000000ff)
181:
182: #define IN_CLASSD(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
183: __IPADDR(0xe0000000))
184:
185: #define IN_CLASSD_NET __IPADDR(0xf0000000)
186: #define IN_CLASSD_NSHIFT 28
187: #define IN_CLASSD_HOST __IPADDR(0x0fffffff)
188: #define IN_MULTICAST(i) IN_CLASSD(i)
189:
190: #define IN_RFC3021_NET __IPADDR(0xfffffffe)
191: #define IN_RFC3021_NSHIFT 31
192: #define IN_RFC3021_HOST __IPADDR(0x00000001)
193: #define IN_RFC3021_SUBNET(n) (((u_int32_t)(n) & IN_RFC3021_NET) == \
194: IN_RFC3021_NET)
195:
196: #define IN_EXPERIMENTAL(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
197: __IPADDR(0xf0000000))
198: #define IN_BADCLASS(i) (((u_int32_t)(i) & __IPADDR(0xf0000000)) == \
199: __IPADDR(0xf0000000))
200:
201: #define IN_LOCAL_GROUP(i) (((u_int32_t)(i) & __IPADDR(0xffffff00)) == \
202: __IPADDR(0xe0000000))
203:
204: #ifdef _KERNEL
205: #define IN_CLASSFULBROADCAST(i, b) \
206: ((IN_CLASSC(b) && (b | IN_CLASSC_HOST) == i) || \
207: (IN_CLASSB(b) && (b | IN_CLASSB_HOST) == i) || \
208: (IN_CLASSA(b) && (b | IN_CLASSA_HOST) == i))
209: #endif
210:
211: #define INADDR_ANY __IPADDR(0x00000000)
212: #define INADDR_LOOPBACK __IPADDR(0x7f000001)
213: #define INADDR_BROADCAST __IPADDR(0xffffffff)
214: #ifndef _KERNEL
215: #define INADDR_NONE __IPADDR(0xffffffff)
216: #endif
217:
218: #define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000)
219: #define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001)
220: #define INADDR_ALLROUTERS_GROUP __IPADDR(0xe0000002)
221: #define INADDR_CARP_GROUP __IPADDR(0xe0000012)
222: #define INADDR_PFSYNC_GROUP __IPADDR(0xe00000f0)
223: #define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff)
224:
225: #define IN_LOOPBACKNET 127
226:
227: 228: 229:
230: struct sockaddr_in {
231: u_int8_t sin_len;
232: sa_family_t sin_family;
233: in_port_t sin_port;
234: struct in_addr sin_addr;
235: int8_t sin_zero[8];
236: };
237:
238: 239: 240: 241: 242: 243: 244:
245: struct ip_opts {
246: struct in_addr ip_dst;
247: #if defined(__cplusplus)
248: int8_t Ip_opts[40];
249: #else
250: int8_t ip_opts[40];
251: #endif
252: };
253:
254: 255: 256: 257:
258: #define IP_OPTIONS 1
259: #define IP_HDRINCL 2
260: #define IP_TOS 3
261: #define IP_TTL 4
262: #define IP_RECVOPTS 5
263: #define IP_RECVRETOPTS 6
264: #define IP_RECVDSTADDR 7
265: #define IP_RETOPTS 8
266: #define IP_MULTICAST_IF 9
267: #define IP_MULTICAST_TTL 10
268: #define IP_MULTICAST_LOOP 11
269: #define IP_ADD_MEMBERSHIP 12
270: #define IP_DROP_MEMBERSHIP 13
271:
272:
273:
274: #define IP_PORTRANGE 19
275: #define IP_AUTH_LEVEL 20
276: #define IP_ESP_TRANS_LEVEL 21
277: #define IP_ESP_NETWORK_LEVEL 22
278: #define IP_IPSEC_LOCAL_ID 23
279: #define IP_IPSEC_REMOTE_ID 24
280: #define IP_IPSEC_LOCAL_CRED 25
281: #define IP_IPSEC_REMOTE_CRED 26
282: #define IP_IPSEC_LOCAL_AUTH 27
283: #define IP_IPSEC_REMOTE_AUTH 28
284: #define IP_IPCOMP_LEVEL 29
285: #define IP_RECVIF 30
286: #define IP_RECVTTL 31
287: #define IP_MINTTL 32
288: #define IP_RECVDSTPORT 33
289: #define IP_PIPEX 34
290: #define IP_RECVRTABLE 35
291:
292: #define IP_RTABLE 0x1021
293:
294: 295: 296:
297:
298: #define IPSEC_LEVEL_BYPASS 0x00
299: #define IPSEC_LEVEL_NONE 0x00
300: #define IPSEC_LEVEL_AVAIL 0x01
301: #define IPSEC_LEVEL_USE 0x02
302: #define IPSEC_LEVEL_REQUIRE 0x03
303: #define IPSEC_LEVEL_UNIQUE 0x04
304: #define IPSEC_LEVEL_DEFAULT IPSEC_LEVEL_AVAIL
305:
306: #define IPSEC_AUTH_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
307: #define IPSEC_ESP_TRANS_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
308: #define IPSEC_ESP_NETWORK_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
309: #define IPSEC_IPCOMP_LEVEL_DEFAULT IPSEC_LEVEL_DEFAULT
310:
311: 312: 313:
314: #define IP_DEFAULT_MULTICAST_TTL 1
315: #define IP_DEFAULT_MULTICAST_LOOP 1
316: 317: 318: 319: 320:
321: #define IP_MIN_MEMBERSHIPS 15
322: #define IP_MAX_MEMBERSHIPS 4095
323:
324: 325: 326:
327: struct ip_mreq {
328: struct in_addr imr_multiaddr;
329: struct in_addr imr_interface;
330: };
331:
332: 333: 334: 335:
336: #define IP_PORTRANGE_DEFAULT 0
337: #define IP_PORTRANGE_HIGH 1
338: #define IP_PORTRANGE_LOW 2
339:
340: 341: 342:
343: #define INET_ADDRSTRLEN 16
344:
345: 346: 347: 348: 349: 350:
351: #define IPPROTO_MAXID (IPPROTO_DIVERT + 1)
352:
353: #define CTL_IPPROTO_NAMES { \
354: { "ip", CTLTYPE_NODE }, \
355: { "icmp", CTLTYPE_NODE }, \
356: { "igmp", CTLTYPE_NODE }, \
357: { "ggp", CTLTYPE_NODE }, \
358: { "ipip", CTLTYPE_NODE }, \
359: { 0, 0 }, \
360: { "tcp", CTLTYPE_NODE }, \
361: { 0, 0 }, \
362: { "egp", CTLTYPE_NODE }, \
363: { 0, 0 }, \
364: { 0, 0 }, \
365: { 0, 0 }, \
366: { "pup", CTLTYPE_NODE }, \
367: { 0, 0 }, \
368: { 0, 0 }, \
369: { 0, 0 }, \
370: { 0, 0 }, \
371: { "udp", CTLTYPE_NODE }, \
372: { 0, 0 }, \
373: { 0, 0 }, \
374: { 0, 0 }, \
375: { 0, 0 }, \
376: { 0, 0 }, \
377: { 0, 0 }, \
378: { 0, 0 }, \
379: { 0, 0 }, \
380: { 0, 0 }, \
381: { 0, 0 }, \
382: { 0, 0 }, \
383: { 0, 0 }, \
384: { 0, 0 }, \
385: { 0, 0 }, \
386: { 0, 0 }, \
387: { 0, 0 }, \
388: { 0, 0 }, \
389: { 0, 0 }, \
390: { 0, 0 }, \
391: { 0, 0 }, \
392: { 0, 0 }, \
393: { 0, 0 }, \
394: { 0, 0 }, \
395: { 0, 0 }, \
396: { 0, 0 }, \
397: { 0, 0 }, \
398: { 0, 0 }, \
399: { 0, 0 }, \
400: { 0, 0 }, \
401: { "gre", CTLTYPE_NODE }, \
402: { 0, 0 }, \
403: { 0, 0 }, \
404: { "esp", CTLTYPE_NODE }, \
405: { "ah", CTLTYPE_NODE }, \
406: { 0, 0 }, \
407: { 0, 0 }, \
408: { 0, 0 }, \
409: { "mobileip", CTLTYPE_NODE }, \
410: { 0, 0 }, \
411: { 0, 0 }, \
412: { 0, 0 }, \
413: { 0, 0 }, \
414: { 0, 0 }, \
415: { 0, 0 }, \
416: { 0, 0 }, \
417: { 0, 0 }, \
418: { 0, 0 }, \
419: { 0, 0 }, \
420: { 0, 0 }, \
421: { 0, 0 }, \
422: { 0, 0 }, \
423: { 0, 0 }, \
424: { 0, 0 }, \
425: { 0, 0 }, \
426: { 0, 0 }, \
427: { 0, 0 }, \
428: { 0, 0 }, \
429: { 0, 0 }, \
430: { 0, 0 }, \
431: { 0, 0 }, \
432: { 0, 0 }, \
433: { 0, 0 }, \
434: { 0, 0 }, \
435: { 0, 0 }, \
436: { 0, 0 }, \
437: { 0, 0 }, \
438: { 0, 0 }, \
439: { 0, 0 }, \
440: { 0, 0 }, \
441: { 0, 0 }, \
442: { 0, 0 }, \
443: { 0, 0 }, \
444: { 0, 0 }, \
445: { 0, 0 }, \
446: { 0, 0 }, \
447: { 0, 0 }, \
448: { 0, 0 }, \
449: { 0, 0 }, \
450: { 0, 0 }, \
451: { "etherip", CTLTYPE_NODE }, \
452: { 0, 0 }, \
453: { 0, 0 }, \
454: { 0, 0 }, \
455: { 0, 0 }, \
456: { 0, 0 }, \
457: { "pim", CTLTYPE_NODE }, \
458: { 0, 0 }, \
459: { 0, 0 }, \
460: { 0, 0 }, \
461: { 0, 0 }, \
462: { "ipcomp", CTLTYPE_NODE }, \
463: { 0, 0 }, \
464: { 0, 0 }, \
465: { 0, 0 }, \
466: { "carp", CTLTYPE_NODE }, \
467: { 0, 0 }, \
468: { 0, 0 }, \
469: { 0, 0 }, \
470: { 0, 0 }, \
471: { 0, 0 }, \
472: { 0, 0 }, \
473: { 0, 0 }, \
474: { 0, 0 }, \
475: { 0, 0 }, \
476: { 0, 0 }, \
477: { 0, 0 }, \
478: { 0, 0 }, \
479: { 0, 0 }, \
480: { 0, 0 }, \
481: { 0, 0 }, \
482: { 0, 0 }, \
483: { 0, 0 }, \
484: { 0, 0 }, \
485: { 0, 0 }, \
486: { 0, 0 }, \
487: { 0, 0 }, \
488: { 0, 0 }, \
489: { 0, 0 }, \
490: { 0, 0 }, \
491: { 0, 0 }, \
492: { 0, 0 }, \
493: { 0, 0 }, \
494: { 0, 0 }, \
495: { 0, 0 }, \
496: { 0, 0 }, \
497: { 0, 0 }, \
498: { 0, 0 }, \
499: { 0, 0 }, \
500: { 0, 0 }, \
501: { 0, 0 }, \
502: { 0, 0 }, \
503: { 0, 0 }, \
504: { 0, 0 }, \
505: { 0, 0 }, \
506: { 0, 0 }, \
507: { 0, 0 }, \
508: { 0, 0 }, \
509: { 0, 0 }, \
510: { 0, 0 }, \
511: { 0, 0 }, \
512: { 0, 0 }, \
513: { 0, 0 }, \
514: { 0, 0 }, \
515: { 0, 0 }, \
516: { 0, 0 }, \
517: { 0, 0 }, \
518: { 0, 0 }, \
519: { 0, 0 }, \
520: { 0, 0 }, \
521: { 0, 0 }, \
522: { 0, 0 }, \
523: { 0, 0 }, \
524: { 0, 0 }, \
525: { 0, 0 }, \
526: { 0, 0 }, \
527: { 0, 0 }, \
528: { 0, 0 }, \
529: { 0, 0 }, \
530: { 0, 0 }, \
531: { 0, 0 }, \
532: { 0, 0 }, \
533: { 0, 0 }, \
534: { 0, 0 }, \
535: { 0, 0 }, \
536: { 0, 0 }, \
537: { 0, 0 }, \
538: { 0, 0 }, \
539: { 0, 0 }, \
540: { 0, 0 }, \
541: { 0, 0 }, \
542: { 0, 0 }, \
543: { 0, 0 }, \
544: { 0, 0 }, \
545: { 0, 0 }, \
546: { 0, 0 }, \
547: { 0, 0 }, \
548: { 0, 0 }, \
549: { 0, 0 }, \
550: { 0, 0 }, \
551: { 0, 0 }, \
552: { 0, 0 }, \
553: { 0, 0 }, \
554: { 0, 0 }, \
555: { 0, 0 }, \
556: { 0, 0 }, \
557: { 0, 0 }, \
558: { 0, 0 }, \
559: { 0, 0 }, \
560: { 0, 0 }, \
561: { 0, 0 }, \
562: { 0, 0 }, \
563: { 0, 0 }, \
564: { 0, 0 }, \
565: { 0, 0 }, \
566: { 0, 0 }, \
567: { 0, 0 }, \
568: { 0, 0 }, \
569: { 0, 0 }, \
570: { 0, 0 }, \
571: { 0, 0 }, \
572: { 0, 0 }, \
573: { 0, 0 }, \
574: { 0, 0 }, \
575: { 0, 0 }, \
576: { 0, 0 }, \
577: { 0, 0 }, \
578: { 0, 0 }, \
579: { 0, 0 }, \
580: { 0, 0 }, \
581: { 0, 0 }, \
582: { 0, 0 }, \
583: { 0, 0 }, \
584: { 0, 0 }, \
585: { 0, 0 }, \
586: { 0, 0 }, \
587: { 0, 0 }, \
588: { 0, 0 }, \
589: { 0, 0 }, \
590: { 0, 0 }, \
591: { 0, 0 }, \
592: { 0, 0 }, \
593: { 0, 0 }, \
594: { "pfsync", CTLTYPE_NODE }, \
595: { 0, 0 }, \
596: { 0, 0 }, \
597: { 0, 0 }, \
598: { 0, 0 }, \
599: { 0, 0 }, \
600: { 0, 0 }, \
601: { 0, 0 }, \
602: { 0, 0 }, \
603: { 0, 0 }, \
604: { 0, 0 }, \
605: { 0, 0 }, \
606: { 0, 0 }, \
607: { 0, 0 }, \
608: { 0, 0 }, \
609: { 0, 0 }, \
610: { 0, 0 }, \
611: { 0, 0 }, \
612: { "divert", CTLTYPE_NODE }, \
613: }
614:
615: 616: 617:
618: #define IPCTL_FORWARDING 1
619: #define IPCTL_SENDREDIRECTS 2
620: #define IPCTL_DEFTTL 3
621: #ifdef notyet
622: #define IPCTL_DEFMTU 4
623: #endif
624: #define IPCTL_SOURCEROUTE 5
625: #define IPCTL_DIRECTEDBCAST 6
626: #define IPCTL_IPPORT_FIRSTAUTO 7
627: #define IPCTL_IPPORT_LASTAUTO 8
628: #define IPCTL_IPPORT_HIFIRSTAUTO 9
629: #define IPCTL_IPPORT_HILASTAUTO 10
630: #define IPCTL_IPPORT_MAXQUEUE 11
631: #define IPCTL_ENCDEBUG 12
632: #ifdef notdef
633: #define IPCTL_GIF_TTL 13
634: #endif
635: #define IPCTL_IPSEC_EXPIRE_ACQUIRE 14
636: #define IPCTL_IPSEC_EMBRYONIC_SA_TIMEOUT 15
637: #define IPCTL_IPSEC_REQUIRE_PFS 16
638: #define IPCTL_IPSEC_SOFT_ALLOCATIONS 17
639: #define IPCTL_IPSEC_ALLOCATIONS 18
640: #define IPCTL_IPSEC_SOFT_BYTES 19
641: #define IPCTL_IPSEC_BYTES 20
642: #define IPCTL_IPSEC_TIMEOUT 21
643: #define IPCTL_IPSEC_SOFT_TIMEOUT 22
644: #define IPCTL_IPSEC_SOFT_FIRSTUSE 23
645: #define IPCTL_IPSEC_FIRSTUSE 24
646: #define IPCTL_IPSEC_ENC_ALGORITHM 25
647: #define IPCTL_IPSEC_AUTH_ALGORITHM 26
648: #define IPCTL_MTUDISC 27
649: #define IPCTL_MTUDISCTIMEOUT 28
650: #define IPCTL_IPSEC_IPCOMP_ALGORITHM 29
651: #define IPCTL_IFQUEUE 30
652: #define IPCTL_MFORWARDING 31
653: #define IPCTL_MULTIPATH 32
654: #define IPCTL_STATS 33
655: #define IPCTL_MRTPROTO 34
656: #define IPCTL_MRTSTATS 35
657: #define IPCTL_ARPQUEUED 36
658: #define IPCTL_MAXID 37
659:
660: #define IPCTL_NAMES { \
661: { 0, 0 }, \
662: { "forwarding", CTLTYPE_INT }, \
663: { "redirect", CTLTYPE_INT }, \
664: { "ttl", CTLTYPE_INT }, \
665: { 0, 0 }, \
666: { "sourceroute", CTLTYPE_INT }, \
667: { "directed-broadcast", CTLTYPE_INT }, \
668: { "portfirst", CTLTYPE_INT }, \
669: { "portlast", CTLTYPE_INT }, \
670: { "porthifirst", CTLTYPE_INT }, \
671: { "porthilast", CTLTYPE_INT }, \
672: { "maxqueue", CTLTYPE_INT }, \
673: { "encdebug", CTLTYPE_INT }, \
674: { 0, 0 }, \
675: { "ipsec-expire-acquire", CTLTYPE_INT }, \
676: { "ipsec-invalid-life", CTLTYPE_INT }, \
677: { "ipsec-pfs", CTLTYPE_INT }, \
678: { "ipsec-soft-allocs", CTLTYPE_INT }, \
679: { "ipsec-allocs", CTLTYPE_INT }, \
680: { "ipsec-soft-bytes", CTLTYPE_INT }, \
681: { "ipsec-bytes", CTLTYPE_INT }, \
682: { "ipsec-timeout", CTLTYPE_INT }, \
683: { "ipsec-soft-timeout", CTLTYPE_INT }, \
684: { "ipsec-soft-firstuse", CTLTYPE_INT }, \
685: { "ipsec-firstuse", CTLTYPE_INT }, \
686: { "ipsec-enc-alg", CTLTYPE_STRING }, \
687: { "ipsec-auth-alg", CTLTYPE_STRING }, \
688: { "mtudisc", CTLTYPE_INT }, \
689: { "mtudisctimeout", CTLTYPE_INT }, \
690: { "ipsec-comp-alg", CTLTYPE_STRING }, \
691: { "ifq", CTLTYPE_NODE }, \
692: { "mforwarding", CTLTYPE_INT }, \
693: { "multipath", CTLTYPE_INT }, \
694: { "stats", CTLTYPE_STRUCT }, \
695: { "mrtproto", CTLTYPE_INT }, \
696: { "mrtstats", CTLTYPE_STRUCT }, \
697: { "arpqueued", CTLTYPE_INT }, \
698: }
699: #define IPCTL_VARS { \
700: NULL, \
701: &ipforwarding, \
702: &ipsendredirects, \
703: &ip_defttl, \
704: NULL, \
705: NULL, \
706: &ip_directedbcast, \
707: &ipport_firstauto, \
708: &ipport_lastauto, \
709: &ipport_hifirstauto, \
710: &ipport_hilastauto, \
711: &ip_maxqueue, \
712: &encdebug, \
713: NULL, \
714: &ipsec_expire_acquire, \
715: &ipsec_keep_invalid, \
716: &ipsec_require_pfs, \
717: &ipsec_soft_allocations, \
718: &ipsec_exp_allocations, \
719: &ipsec_soft_bytes, \
720: &ipsec_exp_bytes, \
721: &ipsec_exp_timeout, \
722: &ipsec_soft_timeout, \
723: &ipsec_soft_first_use, \
724: &ipsec_exp_first_use, \
725: NULL, \
726: NULL, \
727: NULL, \
728: NULL, \
729: NULL, \
730: NULL, \
731: &ipmforwarding, \
732: &ipmultipath, \
733: NULL, \
734: NULL, \
735: NULL, \
736: &la_hold_total \
737: }
738:
739:
740: #define __KAME_NETINET_IN_H_INCLUDED_
741: #include <netinet6/in6.h>
742: #undef __KAME_NETINET_IN_H_INCLUDED_
743:
744: #ifndef _KERNEL
745:
746: #include <sys/cdefs.h>
747:
748: __BEGIN_DECLS
749: int bindresvport(int, struct sockaddr_in *);
750: struct sockaddr;
751: int bindresvport_sa(int, struct sockaddr *);
752: __END_DECLS
753:
754: #else
755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766:
767: static __inline u_int16_t __attribute__((__unused__))
768: in_cksum_phdr(u_int32_t src, u_int32_t dst, u_int32_t lenproto)
769: {
770: u_int32_t sum;
771:
772: sum = lenproto +
773: (u_int16_t)(src >> 16) +
774: (u_int16_t)(src ) +
775: (u_int16_t)(dst >> 16) +
776: (u_int16_t)(dst );
777:
778: sum = (u_int16_t)(sum >> 16) + (u_int16_t)(sum );
779:
780: if (sum > 0xffff)
781: sum -= 0xffff;
782:
783: return (sum);
784: }
785:
786: 787: 788: 789: 790:
791: static __inline u_int16_t __attribute__((__unused__))
792: in_cksum_addword(u_int16_t a, u_int16_t b)
793: {
794: u_int32_t sum = a + b;
795:
796: if (sum > 0xffff)
797: sum -= 0xffff;
798:
799: return (sum);
800: }
801:
802: extern struct in_addr zeroin_addr;
803:
804: int in_broadcast(struct in_addr, struct ifnet *, u_int);
805: int in_canforward(struct in_addr);
806: int in_cksum(struct mbuf *, int);
807: int in4_cksum(struct mbuf *, u_int8_t, int, int);
808: void in_delayed_cksum(struct mbuf *);
809: int in_localaddr(struct in_addr, u_int);
810: void in_socktrim(struct sockaddr_in *);
811: char *inet_ntoa(struct in_addr);
812: void in_proto_cksum_out(struct mbuf *, struct ifnet *);
813:
814: #define in_hosteq(s,t) ((s).s_addr == (t).s_addr)
815: #define in_nullhost(x) ((x).s_addr == INADDR_ANY)
816:
817: #define satosin(sa) ((struct sockaddr_in *)(sa))
818: #define sintosa(sin) ((struct sockaddr *)(sin))
819: #define ifatoia(ifa) ((struct in_ifaddr *)(ifa))
820: #endif
821: #endif