comparison include/freeDiameter/freeDiameter.h @ 618:1dbc4c5397d6

Attempting to improve python wrapper usability (work in progress)
author Sebastien Decugis <sdecugis@nict.go.jp>
date Fri, 03 Dec 2010 18:29:51 +0900
parents 7c9a00bfd115
children bc7328e600f0
comparison
equal deleted inserted replaced
617:c16583e80ffe 618:1dbc4c5397d6
44 /* GNUTLS version */ 44 /* GNUTLS version */
45 #ifndef GNUTLS_VERSION 45 #ifndef GNUTLS_VERSION
46 #define GNUTLS_VERSION LIBGNUTLS_VERSION 46 #define GNUTLS_VERSION LIBGNUTLS_VERSION
47 #endif /* GNUTLS_VERSION */ 47 #endif /* GNUTLS_VERSION */
48 48
49 #ifndef SWIG
49 /* GNUTLS calls debug level */ 50 /* GNUTLS calls debug level */
50 #ifndef GNUTLS_DBG_LEVEL 51 #ifndef GNUTLS_DBG_LEVEL
51 #define GNUTLS_DBG_LEVEL ANNOYING 52 #define GNUTLS_DBG_LEVEL ANNOYING
52 #endif /* GNUTLS_DBG_LEVEL */ 53 #endif /* GNUTLS_DBG_LEVEL */
53 54
65 /* For GNUTLS routines that do not return a value */ 66 /* For GNUTLS routines that do not return a value */
66 #define GNUTLS_TRACE( __call__) { \ 67 #define GNUTLS_TRACE( __call__) { \
67 TRACE_DEBUG(GNUTLS_DBG_LEVEL, "GNUTLS call: " #__call__ ); \ 68 TRACE_DEBUG(GNUTLS_DBG_LEVEL, "GNUTLS call: " #__call__ ); \
68 (__call__); \ 69 (__call__); \
69 } 70 }
70 71 #endif /* !SWIG */
71 72
72 /* Structure to hold the configuration of the freeDiameter daemon */ 73 /* Structure to hold the configuration of the freeDiameter daemon */
73 struct fd_config { 74 struct fd_config {
74 int cnf_eyec; /* Eye catcher: EYEC_CONFIG */ 75 int cnf_eyec; /* Eye catcher: EYEC_CONFIG */
75 #define EYEC_CONFIG 0xC011F16 76 #define EYEC_CONFIG 0xC011F16
124 125
125 uint32_t cnf_orstateid; /* The value to use in Origin-State-Id, default to random value */ 126 uint32_t cnf_orstateid; /* The value to use in Origin-State-Id, default to random value */
126 struct dictionary *cnf_dict; /* pointer to the global dictionary */ 127 struct dictionary *cnf_dict; /* pointer to the global dictionary */
127 struct fifo *cnf_main_ev; /* events for the daemon's main (struct fd_event items) */ 128 struct fifo *cnf_main_ev; /* events for the daemon's main (struct fd_event items) */
128 }; 129 };
130 #ifdef SWIG
131 %immutable;
132 #endif /* SWIG */
129 extern struct fd_config *fd_g_config; /* The pointer to access the global configuration, initalized in main */ 133 extern struct fd_config *fd_g_config; /* The pointer to access the global configuration, initalized in main */
134 #ifdef SWIG
135 %mutable;
136 #endif /* SWIG */
130 137
131 138
132 /***************************************/ 139 /***************************************/
133 /* Peers information */ 140 /* Peers information */
134 /***************************************/ 141 /***************************************/
172 , "STATE_OPEN_HANDSHAKE" \ 179 , "STATE_OPEN_HANDSHAKE" \
173 , "STATE_SUSPECT" \ 180 , "STATE_SUSPECT" \
174 , "STATE_REOPEN" \ 181 , "STATE_REOPEN" \
175 , "STATE_ZOMBIE" \ 182 , "STATE_ZOMBIE" \
176 }; 183 };
184 #ifndef SWIG
177 extern const char *peer_state_str[]; 185 extern const char *peer_state_str[];
186 #else /* SWIG */
187 %immutable;
188 extern const char **peer_state_str;
189 %mutable;
190 #endif /* !SWIG */
178 #define STATE_STR(state) \ 191 #define STATE_STR(state) \
179 (((unsigned)(state)) <= STATE_MAX ? peer_state_str[((unsigned)(state)) ] : "<Invalid>") 192 (((unsigned)(state)) <= STATE_MAX ? peer_state_str[((unsigned)(state)) ] : "<Invalid>")
180 193
181 /* Information about a remote peer */ 194 /* Information about a remote peer */
182 struct peer_info { 195 struct peer_info {
311 * 324 *
312 * RETURN VALUE: 325 * RETURN VALUE:
313 * 0 : *peer has been updated (to NULL if the peer is not found). 326 * 0 : *peer has been updated (to NULL if the peer is not found).
314 * !0 : An error occurred. 327 * !0 : An error occurred.
315 */ 328 */
316 int fd_peer_getbyid( char * diamid, struct peer_hdr ** peer ); 329 int fd_peer_getbyid( char * diamid, struct peer_hdr ** S_OUT(peer) );
317 330
318 /* 331 /*
319 * FUNCTION: fd_peer_validate_register 332 * FUNCTION: fd_peer_validate_register
320 * 333 *
321 * PARAMETERS: 334 * PARAMETERS:
534 * RETURN VALUE: 547 * RETURN VALUE:
535 * 0 : The callback is registered. 548 * 0 : The callback is registered.
536 * EINVAL : A parameter is invalid. 549 * EINVAL : A parameter is invalid.
537 * ENOMEM : Not enough memory to complete the operation 550 * ENOMEM : Not enough memory to complete the operation
538 */ 551 */
539 int fd_rt_fwd_register ( int (*rt_fwd_cb)(void * cbdata, struct msg ** msg), void * cbdata, enum fd_rt_fwd_dir dir, struct fd_rt_fwd_hdl ** handler ); 552 int fd_rt_fwd_register ( int (*rt_fwd_cb)(void * cbdata, struct msg ** msg), void * cbdata, enum fd_rt_fwd_dir dir, struct fd_rt_fwd_hdl ** S_OUT(handler) );
540 /* 553 /*
541 * CALLBACK: rt_fwd_cb 554 * CALLBACK: rt_fwd_cb
542 * 555 *
543 * PARAMETERS: 556 * PARAMETERS:
544 * data : pointer to some data that was passed when the callback was registered (optional). 557 * data : pointer to some data that was passed when the callback was registered (optional).
608 * RETURN VALUE: 621 * RETURN VALUE:
609 * 0 : The callback is registered. 622 * 0 : The callback is registered.
610 * EINVAL : A parameter is invalid. 623 * EINVAL : A parameter is invalid.
611 * ENOMEM : Not enough memory to complete the operation 624 * ENOMEM : Not enough memory to complete the operation
612 */ 625 */
613 int fd_rt_out_register ( int (*rt_out_cb)(void * cbdata, struct msg * msg, struct fd_list * candidates), void * cbdata, int priority, struct fd_rt_out_hdl ** handler ); 626 int fd_rt_out_register ( int (*rt_out_cb)(void * cbdata, struct msg * msg, struct fd_list * candidates), void * cbdata, int priority, struct fd_rt_out_hdl ** S_OUT(handler) );
614 /* 627 /*
615 * CALLBACK: rt_out_cb 628 * CALLBACK: rt_out_cb
616 * 629 *
617 * PARAMETERS: 630 * PARAMETERS:
618 * cbdata : pointer to some data that was registered with the callback. 631 * cbdata : pointer to some data that was registered with the callback.
668 ,FDEV_DUMP_CONFIG /* Dump the configuration */ 681 ,FDEV_DUMP_CONFIG /* Dump the configuration */
669 ,FDEV_DUMP_PEERS /* Dump the list of peers */ 682 ,FDEV_DUMP_PEERS /* Dump the list of peers */
670 }; 683 };
671 684
672 int fd_event_send(struct fifo *queue, int code, size_t datasz, void * data); 685 int fd_event_send(struct fifo *queue, int code, size_t datasz, void * data);
673 int fd_event_get(struct fifo *queue, int *code, size_t *datasz, void ** data); 686 int fd_event_get(struct fifo *queue, int * S_OUT(code), size_t * S_OUT(datasz), void ** S_OUT(data));
674 int fd_event_timedget(struct fifo *queue, struct timespec * timeout, int timeoutcode, int *code, size_t *datasz, void ** data); 687 int fd_event_timedget(struct fifo *queue, struct timespec * timeout, int timeoutcode, int * S_OUT(code), size_t * S_OUT(datasz), void ** S_OUT(data));
675 void fd_event_destroy(struct fifo **queue, void (*free_cb)(void * data)); 688 void fd_event_destroy(struct fifo **queue, void (*free_cb)(void * data));
676 const char * fd_ev_str(int event); 689 const char * fd_ev_str(int event);
677 690
678 691
679 /***************************************/ 692 /***************************************/
681 /***************************************/ 694 /***************************************/
682 695
683 struct fd_endpoint { 696 struct fd_endpoint {
684 struct fd_list chain; /* link in cnf_endpoints list */ 697 struct fd_list chain; /* link in cnf_endpoints list */
685 698
699 #ifndef SWIG
686 union { 700 union {
687 sSS ss; /* the socket information. List is always ordered by ss value (memcmp) -- see fd_ep_add_merge */ 701 sSS ss; /* the socket information. List is always ordered by ss value (memcmp) -- see fd_ep_add_merge */
688 sSA4 sin; 702 sSA4 sin;
689 sSA6 sin6; 703 sSA6 sin6;
690 sSA sa; 704 sSA sa;
691 }; 705 };
706 #else /* !SWIG */
707 /* SWIG does not support unions inside struct, we only define sa in this case */
708 sSA sa;
709 #endif /* !SWIG */
692 710
693 #define EP_FL_CONF (1 << 0) /* This endpoint is statically configured in a configuration file */ 711 #define EP_FL_CONF (1 << 0) /* This endpoint is statically configured in a configuration file */
694 #define EP_FL_DISC (1 << 1) /* This endpoint was resolved from the Diameter Identity or other DNS query */ 712 #define EP_FL_DISC (1 << 1) /* This endpoint was resolved from the Diameter Identity or other DNS query */
695 #define EP_FL_ADV (1 << 2) /* This endpoint was advertized in Diameter CER/CEA exchange */ 713 #define EP_FL_ADV (1 << 2) /* This endpoint was advertized in Diameter CER/CEA exchange */
696 #define EP_FL_LL (1 << 3) /* Lower layer mechanism provided this endpoint */ 714 #define EP_FL_LL (1 << 3) /* Lower layer mechanism provided this endpoint */
723 application_id_t appid; /* The identifier of the application */ 741 application_id_t appid; /* The identifier of the application */
724 }; 742 };
725 743
726 int fd_app_merge(struct fd_list * list, application_id_t aid, vendor_id_t vid, int auth, int acct); 744 int fd_app_merge(struct fd_list * list, application_id_t aid, vendor_id_t vid, int auth, int acct);
727 int fd_app_check(struct fd_list * list, application_id_t aid, struct fd_app **detail); 745 int fd_app_check(struct fd_list * list, application_id_t aid, struct fd_app **detail);
728 int fd_app_check_common(struct fd_list * list1, struct fd_list * list2, int * common_found); 746 int fd_app_check_common(struct fd_list * list1, struct fd_list * list2, int * S_OUT(common_found));
729 int fd_app_empty(struct fd_list * list); 747 int fd_app_empty(struct fd_list * list);
730 748
731 #endif /* _FREEDIAMETER_H */ 749 #endif /* _FREEDIAMETER_H */
"Welcome to our mercurial repository"