annotate libfdcore/fdcore-internal.h @ 740:4a9f08d6b6ba

Updated my mail address
author Sebastien Decugis <sdecugis@nict.go.jp>
date Thu, 24 Mar 2011 15:00:18 +0900
parents 4ffbc9f1e922
children fb5e0fd923ff
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
1 /*********************************************************************************************************
13530e1f02e3 Initial files imported
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: 706
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
662
2e94ef0515d7 Updated copyright information
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 658
diff changeset
5 * Copyright (c) 2011, WIDE Project and NICT *
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
6 * All rights reserved. *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
7 * *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
9 * permitted provided that the following conditions are met: *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
10 * *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
11 * * Redistributions of source code must retain the above *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
12 * copyright notice, this list of conditions and the *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
13 * following disclaimer. *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
14 * *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
15 * * Redistributions in binary form must reproduce the above *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
16 * copyright notice, this list of conditions and the *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
17 * following disclaimer in the documentation and/or other *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
18 * materials provided with the distribution. *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
19 * *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
20 * * Neither the name of the WIDE Project or NICT nor the *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
21 * names of its contributors may be used to endorse or *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
22 * promote products derived from this software without *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
23 * specific prior written permission of WIDE Project and *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
24 * NICT. *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
25 * *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
29 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
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 *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
33 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
34 *********************************************************************************************************/
13530e1f02e3 Initial files imported
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: 649
diff changeset
36 /* This file contains the definitions for internal use in the freeDiameter core library */
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
37
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
38 #ifndef _FDCORE_INTERNAL_H
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
39 #define _FDCORE_INTERNAL_H
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
40
1
bafb831ba688 Fix names to proper case for freeDiameter
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 0
diff changeset
41 #include <freeDiameter/freeDiameter-host.h>
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
42 #include <freeDiameter/libfdcore.h>
304
ad3c46016584 Added install directives for cmake; also allow default directory to seek for extensions and configuration files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 285
diff changeset
43
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
44 #ifdef DISABLE_SCTP
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
45 #undef IPPROTO_SCTP
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
46 #define IPPROTO_SCTP (2 = 4) /* some compilation error to spot the references */
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
47 #endif /* DISABLE_SCTP */
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
48
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
49 /* Timeout for establishing a connection */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
50 #ifndef CNX_TIMEOUT
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
51 #define CNX_TIMEOUT 10 /* in seconds */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
52 #endif /* CNX_TIMEOUT */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
53
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
54 /* Timeout for receiving a CER after incoming connection is established */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
55 #ifndef INCNX_TIMEOUT
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
56 #define INCNX_TIMEOUT 20 /* in seconds */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
57 #endif /* INCNX_TIMEOUT */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
58
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
59 /* Timeout for receiving a CEA after CER is sent */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
60 #ifndef CEA_TIMEOUT
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
61 #define CEA_TIMEOUT 10 /* in seconds */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
62 #endif /* CEA_TIMEOUT */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
63
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
64 /* The timeout value to wait for answer to a DPR */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
65 #ifndef DPR_TIMEOUT
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
66 #define DPR_TIMEOUT 15 /* in seconds */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
67 #endif /* DPR_TIMEOUT */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
68
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
69 /* The Vendor-Id to advertise in CER/CEA */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
70 #ifndef MY_VENDOR_ID
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
71 #define MY_VENDOR_ID 0 /* Reserved value to tell it must be ignored */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
72 #endif /* MY_VENDOR_ID */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
73
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
74
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
75
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
76 /* Configuration */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
77 int fd_conf_init();
447
097bae83b07a Forgot to cleanup the configuration on exit, spotted by valgrind
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 403
diff changeset
78 int fd_conf_deinit();
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
79 void fd_conf_dump();
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
80 int fd_conf_parse();
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
81 int fddparse(struct fd_config * conf); /* yacc generated */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
82
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
83 /* Extensions */
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
84 int fd_ext_add( char * filename, char * conffile );
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
85 int fd_ext_load();
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
86 void fd_ext_dump(void);
285
0daf6fc2b751 Added a test case for the app_acct extension
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
87 int fd_ext_term(void);
8
3e143f047f78 Backup for the week-end
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
88
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
89 /* Messages */
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
90 int fd_msg_init(void);
66
dcbd5b5ee55c Added handling for DWR/DWA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
91 struct dict_object * fd_dict_avp_OSI; /* Origin-State-Id */
dcbd5b5ee55c Added handling for DWR/DWA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
92 struct dict_object * fd_dict_cmd_CER; /* Capabilities-Exchange-Request */
dcbd5b5ee55c Added handling for DWR/DWA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
93 struct dict_object * fd_dict_cmd_DWR; /* Device-Watchdog-Request */
78
a58f0757c06a Added code for DPR/DPA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 70
diff changeset
94 struct dict_object * fd_dict_avp_DC; /* Disconnect-Cause */
66
dcbd5b5ee55c Added handling for DWR/DWA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 43
diff changeset
95 struct dict_object * fd_dict_cmd_DPR; /* Disconnect-Peer-Request */
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
96
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
97 /* Global message queues */
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
98 extern struct fifo * fd_g_incoming; /* all messages received from other peers, except local messages (CER, ...) */
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
99 extern struct fifo * fd_g_outgoing; /* messages to be sent to other peers on the network following routing procedure */
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
100 extern struct fifo * fd_g_local; /* messages to be handled to local extensions */
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
101 /* Message queues */
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
102 int fd_queues_init(void);
124
cc42d8607114 Completed cleanups of queues when the daemon is stopping
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 123
diff changeset
103 int fd_queues_fini(struct fifo ** queue);
10
c5c99c73c2bf Added some extensions and functions in the daemon
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 8
diff changeset
104
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
105 /* Trigged events */
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
106 int fd_event_trig_call_cb(int trigger_val);
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
107 int fd_event_trig_fini(void);
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
108
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
109 /* Create all the dictionary objects defined in the Diameter base RFC. */
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
110 int fd_dict_base_protocol(struct dictionary * dict);
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
111
82
b6344f1d521a Some cleanups
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 78
diff changeset
112 /* Routing */
123
960fa8048805 Merged routing and dispatch files for similarities
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 122
diff changeset
113 int fd_rtdisp_init(void);
960fa8048805 Merged routing and dispatch files for similarities
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 122
diff changeset
114 int fd_rtdisp_cleanstop(void);
960fa8048805 Merged routing and dispatch files for similarities
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 122
diff changeset
115 int fd_rtdisp_fini(void);
960fa8048805 Merged routing and dispatch files for similarities
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 122
diff changeset
116 int fd_rtdisp_cleanup(void);
82
b6344f1d521a Some cleanups
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 78
diff changeset
117
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
118 /* Sentinel for the sent requests list */
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
119 struct sr_list {
649
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
120 struct fd_list srs; /* requests ordered by hop-by-hop id */
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
121 struct fd_list exp; /* requests that have a timeout set, ordered by timeout */
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
122 pthread_mutex_t mtx; /* mutex to protect these lists */
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
123 pthread_cond_t cnd; /* cond var used by the thread that handles timeouts */
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
124 pthread_t thr; /* the thread that handles timeouts (and calls the anscb) */
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
125 };
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
126
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
127 /* Peers */
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
128 struct fd_peer { /* The "real" definition of the peer structure */
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
129
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
130 /* The public data */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
131 struct peer_hdr p_hdr;
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
132
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
133 /* Eye catcher, EYEC_PEER */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
134 int p_eyec;
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
135 #define EYEC_PEER 0x373C9336
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
136
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
137 /* Origin of this peer object, for debug */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
138 char *p_dbgorig;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
139
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
140 /* State of the peer, and its lock */
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
141 enum peer_state p_state;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
142 pthread_mutex_t p_state_mtx;
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
143
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
144 /* Chaining in peers sublists */
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
145 struct fd_list p_actives; /* list of peers in the STATE_OPEN state -- used by routing */
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
146 struct fd_list p_expiry; /* list of expiring peers, ordered by their timeout value */
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
147 struct timespec p_exp_timer; /* Timestamp where the peer will expire; updated each time activity is seen on the peer (except DW) */
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
148
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
149 /* Some flags influencing the peer state machine */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
150 struct {
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
151 unsigned pf_responder : 1; /* The peer has been created to handle incoming connection */
154
4356de61174d Small tweaks in the PSM
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 124
diff changeset
152 unsigned pf_delete : 1; /* Destroy the peer when the connection is terminated */
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
153 unsigned pf_localterm : 1; /* If the latest DPR/DPA was initiated from this side */
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
154
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
155 unsigned pf_dw_pending : 1; /* A DWR message was sent and not answered yet */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
156
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
157 unsigned pf_cnx_pb : 1; /* The peer was disconnected because of watchdogs; must exchange 3 watchdogs before putting back to normal */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
158 unsigned pf_reopen_cnt : 2; /* remaining DW to be exchanged after re-established connection */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
159
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
160 } p_flags;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
161
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
162 /* The events queue, peer state machine thread, timer for states timeouts */
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
163 struct fifo *p_events; /* The mutex of this FIFO list protects also the state and timer information */
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
164 pthread_t p_psm;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
165 struct timespec p_psm_timer;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
166
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
167 /* Outgoing message queue, and thread managing sending the messages */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
168 struct fifo *p_tosend;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
169 pthread_t p_outthr;
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
170
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
171 /* The next hop-by-hop id value for the link, only read & modified by p_outthr */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
172 uint32_t p_hbh;
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
173
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
174 /* Sent requests (for fallback), list of struct sentreq ordered by hbh */
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
175 struct sr_list p_sr;
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
176
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
177 /* Data for transitional states before the peer is in OPEN state */
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
178 struct {
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
179 struct cnxctx * p_receiver; /* Only used in case of election */
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
180 struct msg * p_cer; /* Only used in case of election */
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
181
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
182 pthread_t p_ini_thr; /* Initiator thread for establishing a connection */
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
183 struct fd_list p_connparams; /* The list of connection attempts, see p_cnx.c */
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
184 };
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
185
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
186 /* connection context: socket and related information */
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
187 struct cnxctx *p_cnxctx;
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
188
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
189 /* Callback for peer validation after the handshake */
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
190 int (*p_cb2)(struct peer_info *);
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
191
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
192 /* Callback on initial connection success / failure after the peer was added */
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
193 void (*p_cb)(struct peer_info *, void *);
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
194 void *p_cb_data;
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
195
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
196 };
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
197 #define CHECK_PEER( _p ) \
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
198 (((_p) != NULL) && (((struct fd_peer *)(_p))->p_eyec == EYEC_PEER))
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
199
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
200 #define fd_peer_getstate(peer) fd_peer_get_state((struct peer_hdr *)(peer))
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
201
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
202
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
203 /* Events codespace for struct fd_peer->p_events */
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
204 enum {
16
013ce9851131 Started including TLS code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
205 /* Dump all info about this peer in the debug log */
25
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
206 FDEVP_DUMP_ALL = 1500
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
207
16
013ce9851131 Started including TLS code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
208 /* request to terminate this peer : disconnect, requeue all messages */
013ce9851131 Started including TLS code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
209 ,FDEVP_TERMINATE
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
210
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
211 /* A connection object has received a message. (data contains the buffer) */
22
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 21
diff changeset
212 ,FDEVP_CNX_MSG_RECV
25
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
213
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
214 /* A connection object has encountered an error (disconnected). */
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
215 ,FDEVP_CNX_ERROR
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
216
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
217 /* Endpoints of a connection have been changed (multihomed SCTP). */
67ca08d5bc48 Completed connection context files
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 24
diff changeset
218 ,FDEVP_CNX_EP_CHANGE
22
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 21
diff changeset
219
228
dcb58243e91f More cleanups
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 208
diff changeset
220 /* The connection is being shutdown (SCTP notification). */
dcb58243e91f More cleanups
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 208
diff changeset
221 ,FDEVP_CNX_SHUTDOWN
dcb58243e91f More cleanups
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 208
diff changeset
222
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
223 /* A new connection (with a CER) has been received */
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
224 ,FDEVP_CNX_INCOMING
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
225
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
226 /* A new connection has been established to the remote peer (event data is the cnxctx object) */
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
227 ,FDEVP_CNX_ESTABLISHED
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
228
70
65b32c93f21e Do not wait for timeout when all connections attempts have failed
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 66
diff changeset
229 /* A connection attempt (initiator side) has failed */
65b32c93f21e Do not wait for timeout when all connections attempts have failed
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 66
diff changeset
230 ,FDEVP_CNX_FAILED
65b32c93f21e Do not wait for timeout when all connections attempts have failed
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 66
diff changeset
231
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
232 /* The PSM state is expired */
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
233 ,FDEVP_PSM_TIMEOUT
22
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 21
diff changeset
234
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
235 };
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
236 #define CHECK_PEVENT( _e ) \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
237 (((int)(_e) >= FDEVP_DUMP_ALL) && ((int)(_e) <= FDEVP_PSM_TIMEOUT))
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
238 /* The following macro is actually called in p_psm.c -- another solution would be to declare it static inline */
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
239 #define DECLARE_PEV_STR() \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
240 const char * fd_pev_str(int event) \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
241 { \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
242 switch (event) { \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
243 case_str(FDEVP_DUMP_ALL); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
244 case_str(FDEVP_TERMINATE); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
245 case_str(FDEVP_CNX_MSG_RECV); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
246 case_str(FDEVP_CNX_ERROR); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
247 case_str(FDEVP_CNX_EP_CHANGE); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
248 case_str(FDEVP_CNX_INCOMING); \
37
cc3c59fe98fe Lot of cleanups in peer structure management
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 36
diff changeset
249 case_str(FDEVP_CNX_ESTABLISHED); \
70
65b32c93f21e Do not wait for timeout when all connections attempts have failed
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 66
diff changeset
250 case_str(FDEVP_CNX_FAILED); \
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
251 case_str(FDEVP_PSM_TIMEOUT); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
252 } \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
253 TRACE_DEBUG(FULL, "Unknown event : %d", event); \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
254 return "Unknown event"; \
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
255 }
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
256 const char * fd_pev_str(int event);
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
257
229
965f5971dc23 Broadcast CEA over all streams to avoid possible race condition
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 228
diff changeset
258 /* The data structure for FDEVP_CNX_INCOMING event */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
259 struct cnx_incoming {
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
260 struct msg * cer; /* the CER message received on this connection */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
261 struct cnxctx * cnx; /* The connection context */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
262 int validate; /* The peer is new, it must be validated (by an extension) or error CEA to be sent */
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
263 };
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
264
20
277ec00d793e Backup before typhoon... Progress on server side
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 16
diff changeset
265
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
266 /* Functions */
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
267 int fd_peer_fini();
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
268 void fd_peer_dump_list(int details);
16
013ce9851131 Started including TLS code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
269 void fd_peer_dump(struct fd_peer * peer, int details);
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
270 int fd_peer_alloc(struct fd_peer ** ptr);
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
271 int fd_peer_free(struct fd_peer ** ptr);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
272 int fd_peer_handle_newCER( struct msg ** cer, struct cnxctx ** cnx );
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
273 /* fd_peer_add declared in freeDiameter.h */
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
274 int fd_peer_validate( struct fd_peer * peer );
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
275 void fd_peer_failover_msg(struct fd_peer * peer);
11
6576ef5e01eb Added some support for peers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 10
diff changeset
276
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
277 /* Peer expiry */
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
278 int fd_p_expi_init(void);
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
279 int fd_p_expi_fini(void);
14
14cf6daf716d Some progress on peers module
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 13
diff changeset
280 int fd_p_expi_update(struct fd_peer * peer );
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
281
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
282 /* Peer state machine */
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
283 int fd_psm_start();
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
284 int fd_psm_begin(struct fd_peer * peer );
78
a58f0757c06a Added code for DPR/DPA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 70
diff changeset
285 int fd_psm_terminate(struct fd_peer * peer, char * reason );
13
ef9ef3bf4752 Progress on peer state machine
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 12
diff changeset
286 void fd_psm_abord(struct fd_peer * peer );
36
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 35
diff changeset
287 void fd_psm_next_timeout(struct fd_peer * peer, int add_random, int delay);
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 35
diff changeset
288 int fd_psm_change_state(struct fd_peer * peer, int new_state);
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
289 void fd_psm_cleanup(struct fd_peer * peer, int terminate);
12
418d2ce80dc8 Added support in configuration file for peers declaration
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 11
diff changeset
290
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
291 /* Peer out */
229
965f5971dc23 Broadcast CEA over all streams to avoid possible race condition
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 228
diff changeset
292 int fd_out_send(struct msg ** msg, struct cnxctx * cnx, struct fd_peer * peer, uint32_t flags);
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
293 int fd_out_start(struct fd_peer * peer);
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
294 int fd_out_stop(struct fd_peer * peer);
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
295
38
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
296 /* Initiating connections */
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
297 int fd_p_cnx_init(struct fd_peer * peer);
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
298 void fd_p_cnx_abort(struct fd_peer * peer, int cleanup_all);
68c1890f7049 Fixed a small bug in SCTP close
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 37
diff changeset
299
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
300 /* Peer sent requests cache */
165
4679ff581d6a Fix invalid restore of the hop-by-hop id on forwarded answers
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 154
diff changeset
301 int fd_p_sr_store(struct sr_list * srlist, struct msg **req, uint32_t *hbhloc, uint32_t hbh_restore);
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
302 int fd_p_sr_fetch(struct sr_list * srlist, uint32_t hbh, struct msg **req);
649
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
303 int fd_p_sr_start(struct sr_list * srlist);
5e5d8152c229 Implemented fd_msg_send_timeout to close #10. Not tested yet.
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 447
diff changeset
304 int fd_p_sr_stop(struct sr_list * srlist);
34
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
305 void fd_p_sr_failover(struct sr_list * srlist);
0e2b57789361 Backup for the WE, some warnings remaining
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 33
diff changeset
306
36
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 35
diff changeset
307 /* Local Link messages (CER/CEA, DWR/DWA, DPR/DPA) */
40
7e1deaa89540 Some progress on the PSM
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 38
diff changeset
308 int fd_p_ce_msgrcv(struct msg ** msg, int req, struct fd_peer * peer);
36
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 35
diff changeset
309 int fd_p_ce_handle_newCER(struct msg ** msg, struct fd_peer * peer, struct cnxctx ** cnx, int valid);
40
7e1deaa89540 Some progress on the PSM
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 38
diff changeset
310 int fd_p_ce_handle_newcnx(struct fd_peer * peer, struct cnxctx * initiator);
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
311 int fd_p_ce_process_receiver(struct fd_peer * peer);
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
312 void fd_p_ce_clear_cnx(struct fd_peer * peer, struct cnxctx ** cnx_kept);
40
7e1deaa89540 Some progress on the PSM
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 38
diff changeset
313 int fd_p_dw_handle(struct msg ** msg, int req, struct fd_peer * peer);
36
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 35
diff changeset
314 int fd_p_dw_timeout(struct fd_peer * peer);
43
2db15632a63d Added a large part of connection establishment logic, to test
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 40
diff changeset
315 int fd_p_dw_reopen(struct fd_peer * peer);
40
7e1deaa89540 Some progress on the PSM
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 38
diff changeset
316 int fd_p_dp_handle(struct msg ** msg, int req, struct fd_peer * peer);
78
a58f0757c06a Added code for DPR/DPA
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 70
diff changeset
317 int fd_p_dp_initiate(struct fd_peer * peer, char * reason);
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
318 int fd_p_dp_newdelay(struct fd_peer * peer);
35
6486e97f56ae Added test for modified message parsing
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 34
diff changeset
319
33
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
320 /* Active peers -- routing process should only ever take the read lock, the write lock is managed by PSMs */
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
321 extern struct fd_list fd_g_activ_peers;
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
322 extern pthread_rwlock_t fd_g_activ_peers_rw; /* protect the list */
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
323
e6fcdf12b9a0 Added a lot of TODOs :)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 31
diff changeset
324
20
277ec00d793e Backup before typhoon... Progress on server side
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 16
diff changeset
325 /* Server sockets */
277ec00d793e Backup before typhoon... Progress on server side
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 16
diff changeset
326 void fd_servers_dump();
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
327 int fd_servers_start();
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
328 int fd_servers_stop();
20
277ec00d793e Backup before typhoon... Progress on server side
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 16
diff changeset
329
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
330 /* Connection contexts -- there are also definitions in cnxctx.h for the relevant files */
22
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 21
diff changeset
331 struct cnxctx * fd_cnx_serv_tcp(uint16_t port, int family, struct fd_endpoint * ep);
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 21
diff changeset
332 struct cnxctx * fd_cnx_serv_sctp(uint16_t port, struct fd_list * ep_list);
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
333 int fd_cnx_serv_listen(struct cnxctx * conn);
22
0b3b46da2c12 Progress on server code
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 21
diff changeset
334 struct cnxctx * fd_cnx_serv_accept(struct cnxctx * serv);
24
bd83ce9328ed Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 23
diff changeset
335 struct cnxctx * fd_cnx_cli_connect_tcp(sSA * sa, socklen_t addrlen);
bd83ce9328ed Cleanups and completed sctp code (not finished)
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 23
diff changeset
336 struct cnxctx * fd_cnx_cli_connect_sctp(int no_ip6, uint16_t port, struct fd_list * list);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
337 int fd_cnx_start_clear(struct cnxctx * conn, int loop);
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
338 void fd_cnx_sethostname(struct cnxctx * conn, DiamId_t hn);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
339 int fd_cnx_handshake(struct cnxctx * conn, int mode, char * priority, void * alt_creds);
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
340 char * fd_cnx_getid(struct cnxctx * conn);
29
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
341 int fd_cnx_getproto(struct cnxctx * conn);
5ba91682f0bc Added a test for cnxctx (tbc) and fixed some bugs
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 28
diff changeset
342 int fd_cnx_getTLS(struct cnxctx * conn);
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
343 int fd_cnx_isMultichan(struct cnxctx * conn);
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
344 int fd_cnx_getcred(struct cnxctx * conn, const gnutls_datum_t **cert_list, unsigned int *cert_list_size);
403
26aafbbc1640 Cleanup all compilation warnings in base code for 32 bit arch
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 378
diff changeset
345 int fd_cnx_get_local_eps(struct fd_list * list);
378
41e3c2a3721c Replaced old mechanism to discover local addresses by a call to getifaddrs, lot cleaner!
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 304
diff changeset
346 int fd_cnx_getremoteeps(struct cnxctx * conn, struct fd_list * eps);
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
347 char * fd_cnx_getremoteid(struct cnxctx * conn);
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
348 int fd_cnx_receive(struct cnxctx * conn, struct timespec * timeout, unsigned char **buf, size_t * len);
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
349 int fd_cnx_recv_setaltfifo(struct cnxctx * conn, struct fifo * alt_fifo); /* send FDEVP_CNX_MSG_RECV event to the fifo list */
229
965f5971dc23 Broadcast CEA over all streams to avoid possible race condition
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 228
diff changeset
350 int fd_cnx_send(struct cnxctx * conn, unsigned char * buf, size_t len, uint32_t flags);
28
3628f7d2ba88 some new functions backbones
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 25
diff changeset
351 void fd_cnx_destroy(struct cnxctx * conn);
20
277ec00d793e Backup before typhoon... Progress on server side
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 16
diff changeset
352
229
965f5971dc23 Broadcast CEA over all streams to avoid possible race condition
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 228
diff changeset
353 /* Flags for the fd_cnx_send function : */
965f5971dc23 Broadcast CEA over all streams to avoid possible race condition
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 228
diff changeset
354 #define FD_CNX_ORDERED (1 << 0) /* All messages sent with this flag set will be delivered in the same order. No guarantee on other messages */
20
277ec00d793e Backup before typhoon... Progress on server side
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 16
diff changeset
355
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 649
diff changeset
356 #endif /* _FDCORE_INTERNAL_H */
"Welcome to our mercurial repository"