Mercurial > hg > freeDiameter
annotate libfdcore/endpoints.c @ 1562:6219359a36a9 default tip
Merge latest changes from proposed branch
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Mon, 21 Jun 2021 19:08:18 +0800 |
parents | 140450615773 |
children |
rev | line source |
---|---|
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
1 /********************************************************************************************************* |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
2 * Software License Agreement (BSD License) * |
740
4a9f08d6b6ba
Updated my mail address
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
662
diff
changeset
|
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> * |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
4 * * |
1127
1af09cc156d6
Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1122
diff
changeset
|
5 * Copyright (c) 2013, WIDE Project and NICT * |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
6 * All rights reserved. * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
7 * * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
8 * Redistribution and use of this software in source and binary forms, with or without modification, are * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
9 * permitted provided that the following conditions are met: * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
10 * * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
11 * * Redistributions of source code must retain the above * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
12 * copyright notice, this list of conditions and the * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
13 * following disclaimer. * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
14 * * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
15 * * Redistributions in binary form must reproduce the above * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
16 * copyright notice, this list of conditions and the * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
17 * following disclaimer in the documentation and/or other * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
18 * materials provided with the distribution. * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
19 * * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
20 * * Neither the name of the WIDE Project or NICT nor the * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
21 * names of its contributors may be used to endorse or * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
22 * promote products derived from this software without * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
23 * specific prior written permission of WIDE Project and * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
24 * NICT. * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
25 * * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
26 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
27 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
28 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
30 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
32 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
34 *********************************************************************************************************/ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
35 |
658
f198d16fa7f4
Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
640
diff
changeset
|
36 #include "fdcore-internal.h" |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
37 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
38 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
39 /* Add an endpoint information in a list */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
40 int fd_ep_add_merge( struct fd_list * list, sSA * sa, socklen_t sl, uint32_t flags ) |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
41 { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
42 struct fd_endpoint * ep; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
43 struct fd_list * li; |
133
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
44 union { |
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
45 sSA * sa; |
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
46 sSA4 *sin; |
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
47 sSA6 *sin6; |
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
48 } ptr; |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
49 in_port_t * port; |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
50 int cmp = -1; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
51 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
52 TRACE_ENTRY("%p %p %u %x", list, sa, sl, flags); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
53 CHECK_PARAMS( list && sa && (sl <= sizeof(sSS)) ); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
54 |
640
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
559
diff
changeset
|
55 if (list->next == NULL) { |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
559
diff
changeset
|
56 /* the list is not initialized yet, do it */ |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
559
diff
changeset
|
57 fd_list_init(list, NULL); |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
559
diff
changeset
|
58 } |
237cf6339546
dbg_interactive almost complete
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
559
diff
changeset
|
59 |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
60 ptr.sa = sa; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
61 |
178
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
62 /* Filter out a bunch of invalid addresses */ |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
63 switch (sa->sa_family) { |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
64 case AF_INET: |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
65 if (! (flags & EP_ACCEPTALL)) { |
178
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
66 if (IN_IS_ADDR_UNSPECIFIED(&ptr.sin->sin_addr) |
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
67 || IN_IS_ADDR_LOOPBACK(&ptr.sin->sin_addr) |
512
16224de837fd
Fix problem reported by ????? ????????? on dev@freediameter.net
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
383
diff
changeset
|
68 /* the next one filters both EXPERIMENTAL, BADCLASS and MULTICAST. */ |
559 | 69 || ((ntohl(ptr.sin->sin_addr.s_addr) & 0xe0000000) == 0xe0000000) |
382
7f042dc6c6e9
Added debug information for endpoints
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
379
diff
changeset
|
70 || (ptr.sin->sin_addr.s_addr == INADDR_BROADCAST)) { |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
71 LOG_A(" DEBUG:fd_ep_add_merge Address was ignored, not added."); |
140 | 72 return 0; |
382
7f042dc6c6e9
Added debug information for endpoints
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
379
diff
changeset
|
73 } |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
74 } |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
75 port = &ptr.sin->sin_port; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
76 break; |
140 | 77 |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
78 case AF_INET6: |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
79 if (! (flags & EP_ACCEPTALL)) { |
178
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
80 if (IN6_IS_ADDR_UNSPECIFIED(&ptr.sin6->sin6_addr) |
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
81 || IN6_IS_ADDR_LOOPBACK(&ptr.sin6->sin6_addr) |
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
82 || IN6_IS_ADDR_MULTICAST(&ptr.sin6->sin6_addr) |
a32646b7e7d7
Filter more addresses out, such as link-local
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
140
diff
changeset
|
83 || IN6_IS_ADDR_LINKLOCAL(&ptr.sin6->sin6_addr) |
382
7f042dc6c6e9
Added debug information for endpoints
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
379
diff
changeset
|
84 || IN6_IS_ADDR_SITELOCAL(&ptr.sin6->sin6_addr)) { |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
85 LOG_A(" DEBUG:fd_ep_add_merge Address was ignored, not added."); |
140 | 86 return 0; |
382
7f042dc6c6e9
Added debug information for endpoints
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
379
diff
changeset
|
87 } |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
88 } |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
89 port = &ptr.sin6->sin6_port; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
90 break; |
140 | 91 |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
92 default: |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
93 LOG_A(" DEBUG:fd_ep_add_merge Address family was unknown, not added."); |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
94 return 0; |
133
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
95 } |
1122
d4371b7aa0ff
New CMake option: ADDRESS_AVP_INCLUDE_PORT. Turn off for standard Host-IP-Address AVPs
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1119
diff
changeset
|
96 |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
97 /* remove the ACCEPTALL flag */ |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
98 flags &= ~EP_ACCEPTALL; |
133
5a21124536b4
Fix: remove loopback addresses from lists
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
43
diff
changeset
|
99 |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
100 /* Search place in the list */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
101 for (li = list->next; li != list; li = li->next) { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
102 ep = (struct fd_endpoint *)li; |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
103 in_port_t * ep_port; |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
104 |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
105 /* First, compare the address family */ |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
106 if (ep->sa.sa_family < sa->sa_family) |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
107 continue; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
108 if (ep->sa.sa_family > sa->sa_family) |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
109 break; |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
110 |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
111 /* Then compare the address field */ |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
112 switch (sa->sa_family) { |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
113 case AF_INET: |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
114 cmp = memcmp(&ep->sin.sin_addr, &ptr.sin->sin_addr, sizeof(struct in_addr)); |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
115 ep_port = &ep->sin.sin_port; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
116 break; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
117 case AF_INET6: |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
118 cmp = memcmp(&ep->sin6.sin6_addr, &ptr.sin6->sin6_addr, sizeof(struct in6_addr)); |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
119 ep_port = &ep->sin6.sin6_port; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
120 break; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
121 default: |
382
7f042dc6c6e9
Added debug information for endpoints
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
379
diff
changeset
|
122 ASSERT( 0 ); /* we got a different value previously in this same function */ |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
123 } |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
124 if (cmp < 0) |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
125 continue; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
126 if (cmp > 0) |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
127 break; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
128 |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
129 /* Finally compare the port, only if not 0 */ |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
130 if (*port == 0) |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
131 break; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
132 if (*ep_port == 0) { |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
133 /* save the port information in the list, and break */ |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
134 *ep_port = *port; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
135 break; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
136 } |
1122
d4371b7aa0ff
New CMake option: ADDRESS_AVP_INCLUDE_PORT. Turn off for standard Host-IP-Address AVPs
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1119
diff
changeset
|
137 if (*ep_port < *port) { |
d4371b7aa0ff
New CMake option: ADDRESS_AVP_INCLUDE_PORT. Turn off for standard Host-IP-Address AVPs
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1119
diff
changeset
|
138 cmp = -1; |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
139 continue; |
1122
d4371b7aa0ff
New CMake option: ADDRESS_AVP_INCLUDE_PORT. Turn off for standard Host-IP-Address AVPs
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1119
diff
changeset
|
140 } |
210
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
141 if (*ep_port > *port) |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
142 cmp = 1; |
2b5027949f85
Fix issue where the same address can be added several times in a list
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
178
diff
changeset
|
143 break; |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
144 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
145 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
146 if (cmp) { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
147 /* new item to be added */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
148 CHECK_MALLOC( ep = malloc(sizeof(struct fd_endpoint)) ); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
149 memset(ep, 0, sizeof(struct fd_endpoint)); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
150 fd_list_init(&ep->chain, NULL); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
151 memcpy(&ep->ss, sa, sl); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
152 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
153 /* Insert in the list */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
154 fd_list_insert_before(li, &ep->chain); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
155 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
156 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
157 /* Merge the flags */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
158 ep->flags |= flags; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
159 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
160 return 0; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
161 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
162 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
163 /* Delete endpoints that do not have a matching flag from a list (0: delete all endpoints) */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
164 int fd_ep_filter( struct fd_list * list, uint32_t flags ) |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
165 { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
166 struct fd_list * li; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
167 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
168 TRACE_ENTRY("%p %x", list, flags); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
169 CHECK_PARAMS(list); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
170 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
171 for (li = list->next; li != list; li = li->next) { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
172 struct fd_endpoint * ep = (struct fd_endpoint *)li; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
173 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
174 if (! (ep->flags & flags)) { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
175 li = li->prev; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
176 fd_list_unlink(&ep->chain); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
177 free(ep); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
178 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
179 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
180 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
181 return 0; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
182 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
183 |
38
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
184 /* Keep only endpoints of the same family as af */ |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
185 int fd_ep_filter_family( struct fd_list * list, int af ) |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
186 { |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
187 struct fd_list * li; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
188 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
189 TRACE_ENTRY("%p %d", list, af); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
190 CHECK_PARAMS(list); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
191 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
192 for (li = list->next; li != list; li = li->next) { |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
193 struct fd_endpoint * ep = (struct fd_endpoint *)li; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
194 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
195 if (ep->sa.sa_family != af) { |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
196 li = li->prev; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
197 fd_list_unlink(&ep->chain); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
198 free(ep); |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
199 } |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
200 } |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
201 |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
202 return 0; |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
203 } |
68c1890f7049
Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
33
diff
changeset
|
204 |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
205 /* Reset the given flag(s) from all items in the list */ |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
206 int fd_ep_clearflags( struct fd_list * list, uint32_t flags ) |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
207 { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
208 struct fd_list * li; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
209 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
210 TRACE_ENTRY("%p %x", list, flags); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
211 CHECK_PARAMS(list); |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
212 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
213 for (li = list->next; li != list; li = li->next) { |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
214 struct fd_endpoint * ep = (struct fd_endpoint *)li; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
215 ep->flags &= ~flags; |
43
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
38
diff
changeset
|
216 if (ep->flags == 0) { |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
38
diff
changeset
|
217 li = li->prev; |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
38
diff
changeset
|
218 fd_list_unlink(&ep->chain); |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
38
diff
changeset
|
219 free(ep); |
2db15632a63d
Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
38
diff
changeset
|
220 } |
24
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
221 } |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
222 |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
223 return 0; |
bd83ce9328ed
Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff
changeset
|
224 } |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
225 |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
226 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump_one, int preamble, struct fd_endpoint * ep ) |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
227 { |
1093
44f3e48dfe27
Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1085
diff
changeset
|
228 FD_DUMP_HANDLE_OFFSET(); |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
229 |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
230 if (preamble) { |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
231 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{ep}(@%p): ", ep), return NULL); |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
232 } |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
233 |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
234 if (!ep) { |
1093
44f3e48dfe27
Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1085
diff
changeset
|
235 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "INVALID/NULL"), return NULL); |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
236 return *buf; |
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
237 } |
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
238 |
1122
d4371b7aa0ff
New CMake option: ADDRESS_AVP_INCLUDE_PORT. Turn off for standard Host-IP-Address AVPs
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1119
diff
changeset
|
239 CHECK_MALLOC_DO( fd_sa_dump( FD_DUMP_STD_PARAMS, &ep->sa, NI_NUMERICHOST | NI_NUMERICSERV ), return NULL); |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
240 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "{%s%s%s%s%s}", |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
241 (ep->flags & EP_FL_CONF) ? "C" : "-", |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
242 (ep->flags & EP_FL_DISC) ? "D" : "-", |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
243 (ep->flags & EP_FL_ADV) ? "A" : "-", |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
244 (ep->flags & EP_FL_LL) ? "L" : "-", |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
245 (ep->flags & EP_FL_PRIMARY) ? "P" : "-"), return NULL); |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
246 return *buf; |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
247 } |
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
248 |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
249 DECLARE_FD_DUMP_PROTOTYPE(fd_ep_dump, int preamble, int indent, struct fd_list * eps ) |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
250 { |
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
251 struct fd_list * li; |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
252 |
1093
44f3e48dfe27
Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1085
diff
changeset
|
253 FD_DUMP_HANDLE_OFFSET(); |
44f3e48dfe27
Align the behavior of all fd_*dump functions wrt final \n
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1085
diff
changeset
|
254 |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
255 if (preamble) { |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
256 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "%*s{eps}(@%p):", indent, "", eps), return NULL); |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
257 } |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
258 if (eps) { |
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
259 for (li = eps->next; li != eps; li = li->next) { |
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
260 struct fd_endpoint * ep = (struct fd_endpoint *)li; |
1113
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
261 if (preamble) { |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
262 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\n%*s", indent+1, ""), return NULL); |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
263 } else if (li->prev != eps) { |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
264 CHECK_MALLOC_DO( fd_dump_extend( FD_DUMP_STD_PARAMS, "\t"), return NULL); |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
265 } |
eb4ce68b6e5c
Added calls to remaining hooks
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1093
diff
changeset
|
266 CHECK_MALLOC_DO( fd_ep_dump_one( FD_DUMP_STD_PARAMS, preamble, ep ), return NULL); |
1085
7d7266115a34
Cleaning of the traces in progress
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1033
diff
changeset
|
267 } |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
268 } |
1119
79dd22145f52
Fix a number of compilation warnings
Sebastien Decugis <sdecugis@freediameter.net>
parents:
1113
diff
changeset
|
269 return *buf; |
33
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
270 } |
e6fcdf12b9a0
Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
24
diff
changeset
|
271 |