| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | /* $KAME: sctputil.h,v 1.15 2005/03/06 16:04:19 itojun Exp $ */ | | 1 | /* $KAME: sctputil.h,v 1.15 2005/03/06 16:04:19 itojun Exp $ */ |
2 | /* $NetBSD: sctputil.h,v 1.3 2020/01/19 20:51:13 riastradh Exp $ */ | | 2 | /* $NetBSD: sctputil.h,v 1.4 2024/04/14 18:02:55 andvar Exp $ */ |
3 | | | 3 | |
4 | #ifndef __SCTPUTIL_H__ | | 4 | #ifndef __SCTPUTIL_H__ |
5 | #define __SCTPUTIL_H__ | | 5 | #define __SCTPUTIL_H__ |
6 | | | 6 | |
7 | /* | | 7 | /* |
8 | * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc, | | 8 | * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc, |
9 | * All rights reserved. | | 9 | * All rights reserved. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
15 | * notice, this list of conditions and the following disclaimer. | | 15 | * notice, this list of conditions and the following disclaimer. |
| @@ -75,67 +75,67 @@ | | | @@ -75,67 +75,67 @@ |
75 | } | | 75 | } |
76 | #else | | 76 | #else |
77 | #define SCTP_ZONE_INIT(zone, name, size, number) \ | | 77 | #define SCTP_ZONE_INIT(zone, name, size, number) \ |
78 | zone = zinit(name, size, number, ZONE_INTERRUPT, 0); | | 78 | zone = zinit(name, size, number, ZONE_INTERRUPT, 0); |
79 | #endif | | 79 | #endif |
80 | #elif defined(__APPLE__) | | 80 | #elif defined(__APPLE__) |
81 | #define SCTP_ZONE_INIT(zone, name, size, number) \ | | 81 | #define SCTP_ZONE_INIT(zone, name, size, number) \ |
82 | zone = (void *)zinit(size, number * size, number, name); | | 82 | zone = (void *)zinit(size, number * size, number, name); |
83 | #elif defined(__OpenBSD__) || defined(__NetBSD__) | | 83 | #elif defined(__OpenBSD__) || defined(__NetBSD__) |
84 | #define SCTP_ZONE_INIT(zone, name, size, number) \ | | 84 | #define SCTP_ZONE_INIT(zone, name, size, number) \ |
85 | pool_init(&(zone), size, 0, 0, 0, name, NULL, IPL_NET); | | 85 | pool_init(&(zone), size, 0, 0, 0, name, NULL, IPL_NET); |
86 | #else | | 86 | #else |
87 | /* don't know this OS! */ | | 87 | /* don't know this OS! */ |
88 | force_comile_error; | | 88 | force_compile_error; |
89 | #endif | | 89 | #endif |
90 | | | 90 | |
91 | /* SCTP_ZONE_GET: allocate element from the zone */ | | 91 | /* SCTP_ZONE_GET: allocate element from the zone */ |
92 | #if defined(__FreeBSD__) | | 92 | #if defined(__FreeBSD__) |
93 | #if __FreeBSD_version >= 500000 | | 93 | #if __FreeBSD_version >= 500000 |
94 | #define SCTP_ZONE_GET(zone) \ | | 94 | #define SCTP_ZONE_GET(zone) \ |
95 | uma_zalloc(zone, M_NOWAIT); | | 95 | uma_zalloc(zone, M_NOWAIT); |
96 | #else | | 96 | #else |
97 | #define SCTP_ZONE_GET(zone) \ | | 97 | #define SCTP_ZONE_GET(zone) \ |
98 | zalloci(zone); | | 98 | zalloci(zone); |
99 | #endif | | 99 | #endif |
100 | #elif defined(__APPLE__) | | 100 | #elif defined(__APPLE__) |
101 | #define SCTP_ZONE_GET(zone) \ | | 101 | #define SCTP_ZONE_GET(zone) \ |
102 | zalloc(zone); | | 102 | zalloc(zone); |
103 | #elif defined(__NetBSD__) || defined(__OpenBSD__) | | 103 | #elif defined(__NetBSD__) || defined(__OpenBSD__) |
104 | #define SCTP_ZONE_GET(zone) \ | | 104 | #define SCTP_ZONE_GET(zone) \ |
105 | pool_get(&zone, PR_NOWAIT); | | 105 | pool_get(&zone, PR_NOWAIT); |
106 | #else | | 106 | #else |
107 | /* don't know this OS! */ | | 107 | /* don't know this OS! */ |
108 | force_comile_error; | | 108 | force_compile_error; |
109 | #endif | | 109 | #endif |
110 | | | 110 | |
111 | /* SCTP_ZONE_FREE: free element from the zone */ | | 111 | /* SCTP_ZONE_FREE: free element from the zone */ |
112 | #if defined(__FreeBSD__) | | 112 | #if defined(__FreeBSD__) |
113 | #if __FreeBSD_version >= 500000 | | 113 | #if __FreeBSD_version >= 500000 |
114 | #define SCTP_ZONE_FREE(zone, element) \ | | 114 | #define SCTP_ZONE_FREE(zone, element) \ |
115 | uma_zfree(zone, element); | | 115 | uma_zfree(zone, element); |
116 | #else | | 116 | #else |
117 | #define SCTP_ZONE_FREE(zone, element) \ | | 117 | #define SCTP_ZONE_FREE(zone, element) \ |
118 | zfreei(zone, element); | | 118 | zfreei(zone, element); |
119 | #endif | | 119 | #endif |
120 | #elif defined(__APPLE__) | | 120 | #elif defined(__APPLE__) |
121 | #define SCTP_ZONE_FREE(zone, element) \ | | 121 | #define SCTP_ZONE_FREE(zone, element) \ |
122 | zfree(zone, element); | | 122 | zfree(zone, element); |
123 | #elif defined(__NetBSD__) || defined(__OpenBSD__) | | 123 | #elif defined(__NetBSD__) || defined(__OpenBSD__) |
124 | #define SCTP_ZONE_FREE(zone, element) \ | | 124 | #define SCTP_ZONE_FREE(zone, element) \ |
125 | pool_put(&zone, element); | | 125 | pool_put(&zone, element); |
126 | #else | | 126 | #else |
127 | /* don't know this OS! */ | | 127 | /* don't know this OS! */ |
128 | force_comile_error; | | 128 | force_compile_error; |
129 | #endif | | 129 | #endif |
130 | | | 130 | |
131 | #define sctp_get_associd(stcb) ((sctp_assoc_t)stcb->asoc.my_vtag) | | 131 | #define sctp_get_associd(stcb) ((sctp_assoc_t)stcb->asoc.my_vtag) |
132 | | | 132 | |
133 | /* | | 133 | /* |
134 | * Function prototypes | | 134 | * Function prototypes |
135 | */ | | 135 | */ |
136 | struct ifaddr *sctp_find_ifa_by_addr(struct sockaddr *sa); | | 136 | struct ifaddr *sctp_find_ifa_by_addr(struct sockaddr *sa); |
137 | | | 137 | |
138 | u_int32_t sctp_select_initial_TSN(struct sctp_pcb *); | | 138 | u_int32_t sctp_select_initial_TSN(struct sctp_pcb *); |
139 | | | 139 | |
140 | u_int32_t sctp_select_a_tag(struct sctp_inpcb *); | | 140 | u_int32_t sctp_select_a_tag(struct sctp_inpcb *); |
141 | | | 141 | |