annotate libfdproto/fdproto-internal.h @ 882:ae96ae28f3dd 1.1.5

Limit python version to avoid using python3 (not compatible)
author Sebastien Decugis <sdecugis@freediameter.net>
date Sat, 03 Nov 2012 18:45:41 +0100
parents c0a88c1bcc1e
children 047f99b09632
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: 710
diff changeset
3 * Author: Sebastien Decugis <sdecugis@freediameter.net> *
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
4 * *
808
c0a88c1bcc1e Updated copyright information
Sebastien Decugis <sdecugis@freediameter.net>
parents: 804
diff changeset
5 * Copyright (c) 2012, 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: 291
diff changeset
36 /* This file contains the definitions for internal use in the freeDiameter protocol 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: 291
diff changeset
38 #ifndef _LIBFDPROTO_INTERNAL_H
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 291
diff changeset
39 #define _LIBFDPROTO_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: 291
diff changeset
42 #include <freeDiameter/libfdproto.h>
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
43
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
44 /* Internal to the library */
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
45 extern const char * type_base_name[];
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
46 void fd_msg_eteid_init(void);
3
ef303f1078ab Progress; added session module; testsess to be completed
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 2
diff changeset
47 int fd_sess_init(void);
235
8773740401a5 Centralized signal handlers management in the library
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 156
diff changeset
48 void fd_sess_fini(void);
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
49
687
026802543f57 Prepare for new message log facility
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
50 /* Where debug messages are sent */
026802543f57 Prepare for new message log facility
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
51 FILE * fd_g_debug_fstr;
026802543f57 Prepare for new message log facility
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 662
diff changeset
52
689
933d098fc75d Cleanups in msg_log feature
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 687
diff changeset
53 /* Special message dump function */
710
e60376cb15e8 Minor changes
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 706
diff changeset
54 void fd_msg_dump_fstr_one ( struct msg * msg, FILE * fstr );
689
933d098fc75d Cleanups in msg_log feature
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 687
diff changeset
55 void fd_msg_dump_fstr ( struct msg * msg, FILE * fstr );
933d098fc75d Cleanups in msg_log feature
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 687
diff changeset
56
2
d8ce06172629 Added a global debug level var
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
57 /* Iterator on the rules of a parent object */
d8ce06172629 Added a global debug level var
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
58 int fd_dict_iterate_rules ( struct dict_object *parent, void * data, int (*cb)(void *, struct dict_rule_data *) );
d8ce06172629 Added a global debug level var
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 1
diff changeset
59
7
e5af94b04946 Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 3
diff changeset
60 /* Dispatch / messages / dictionary API */
e5af94b04946 Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 3
diff changeset
61 int fd_dict_disp_cb(enum dict_object_type type, struct dict_object *obj, struct fd_list ** cb_list);
804
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
62 int fd_dict_dump_avp_value(union avp_value *avp_value, struct dict_object * model, int indent, char **outstr, size_t *offset, size_t *outlen);
7
e5af94b04946 Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 3
diff changeset
63 int fd_disp_call_cb_int( struct fd_list * cb_list, struct msg ** msg, struct avp *avp, struct session *sess, enum disp_action *action,
e5af94b04946 Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 3
diff changeset
64 struct dict_object * obj_app, struct dict_object * obj_cmd, struct dict_object * obj_avp, struct dict_object * obj_enu);
e5af94b04946 Added dispatch module and tests
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 3
diff changeset
65 extern pthread_rwlock_t fd_disp_lock;
0
13530e1f02e3 Initial files imported
Sebastien Decugis <sdecugis@nict.go.jp>
parents:
diff changeset
66
85
e5fcd672caff Added new function to retrieve messages sessions easily
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
67 /* Messages / sessions API */
706
4ffbc9f1e922 Large UNTESTED commit with the following changes:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 689
diff changeset
68 int fd_sess_fromsid_msg ( uint8_t * sid, size_t len, struct session ** session, int * new);
291
2d3a799ad29c Cache the session pointer in answers when it was present in queries
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 258
diff changeset
69 int fd_sess_ref_msg ( struct session * session );
85
e5fcd672caff Added new function to retrieve messages sessions easily
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
70 int fd_sess_reclaim_msg ( struct session ** session );
e5fcd672caff Added new function to retrieve messages sessions easily
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 14
diff changeset
71
804
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
72 /* For dump routines into string buffers */
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
73 #include <stdarg.h>
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
74 static __inline__ int dump_init_str(char **outstr, size_t *offset, size_t *outlen)
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
75 {
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
76 *outlen = 1<<12;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
77 CHECK_MALLOC( *outstr = malloc(*outlen) );
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
78 *offset = 0;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
79 (*outstr)[0] = 0;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
80 return 0;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
81 }
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
82 static __inline__ int dump_add_str(char **outstr, size_t *offset, size_t *outlen, char * fmt, ...)
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
83 {
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
84 va_list argp;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
85 int len;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
86 va_start(argp, fmt);
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
87 len = vsnprintf(*outstr + *offset, *outlen - *offset, fmt, argp);
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
88 va_end(argp);
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
89 if ((len + *offset) >= *outlen) {
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
90 char * newstr;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
91 /* buffer was too short, extend */
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
92 size_t newsize = ((len + *offset) + (1<<12)) & ~((1<<12) - 1); /* next multiple of 4k */
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
93 CHECK_MALLOC( newstr = realloc(*outstr, newsize) );
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
94
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
95 /* redo */
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
96 *outstr = newstr;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
97 *outlen = newsize;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
98 va_start(argp, fmt);
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
99 len = vsnprintf(*outstr + *offset, *outlen - *offset, fmt, argp);
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
100 va_end(argp);
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
101 }
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
102 *offset += len;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
103 return 0;
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
104 }
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
105
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
106
c5b7d4a2cc77 Log message dumps in one call to the dump function to avoid fragmentation in the log files, as per Zack comment
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 740
diff changeset
107
658
f198d16fa7f4 Initial commit for 1.1.0:
Sebastien Decugis <sdecugis@nict.go.jp>
parents: 291
diff changeset
108 #endif /* _LIBFDPROTO_INTERNAL_H */
"Welcome to our mercurial repository"