Changeset 621:04dbea46c7a2 in freeDiameter
- Timestamp:
- Dec 7, 2010, 11:13:58 AM (13 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/dbg_interactive/dbg_interactive.c
r618 r621 66 66 67 67 Py_Initialize(); 68 69 #if PY_VERSION_HEX >= 0x03000000 70 PyInit__diwrap(); 71 #else /* PY_VERSION_HEX */ 68 72 init_diwrap(); 73 #endif /* PY_VERSION_HEX */ 69 74 75 /* In future version, it might be better to use the diwrap.py file generated by SWIG here to get the proxy classes definitions */ 70 76 PyRun_SimpleString("from _diwrap import *\n"); 71 77 if (TRACE_BOOL(INFO)) { 72 PyRun_SimpleString("print \"[dbg_interactive] fD \",FD_PROJECT_VERSION_MAJOR,\".\",FD_PROJECT_VERSION_MINOR,\".\",FD_PROJECT_VERSION_REV\n");78 PyRun_SimpleString("print \"[dbg_interactive] \",FD_PROJECT_NAME,FD_PROJECT_VERSION_MAJOR,FD_PROJECT_VERSION_MINOR,FD_PROJECT_VERSION_REV\n"); 73 79 } 74 80 75 /*76 PyRun_SimpleString("config = cvar.fd_g_config\n");77 PyRun_SimpleString("dict = fd_config_cnf_dict_get(config)\n");78 PyRun_SimpleString("fd_dict_dump(dict)\n");79 */80 81 CHECK_POSIX( pthread_create(&pyinterp, NULL, myinterp, conffile) ); 81 82 -
extensions/dbg_interactive/diwrap.i
r618 r621 37 37 %module diwrap 38 38 39 /* Include standard types used in freeDiameter headers */39 /* Include standard types & functions used in freeDiameter headers */ 40 40 %include <stdint.i> 41 42 /* Allow modification of the wrapper for OUTPUT vars */43 %include "typemaps.i"44 41 45 42 %{ 46 43 /* Define types etc. */ 44 #define SWIG 47 45 #include <freeDiameter/extension.h> 48 46 %} 47 48 /* Some functions are not available through the wrapper */ 49 %ignore fd_lib_init; 50 %ignore fd_lib_fini; 51 %ignore fd_sess_start; 52 53 /* Inline functions seems to give problems to SWIG -- just remove the inline definition */ 54 %define __inline__ 55 %enddef 56 57 /* Make some global-variables read-only */ 58 %immutable fd_g_config; 59 %immutable peer_state_str; 60 61 /* Overwrite a few functions prototypes for usability */ 62 extern void fd_list_init ( struct fd_list * list, void * obj = NULL ); 63 49 64 50 65 /* Retrieve the compile-time definitions of freeDiameter */ … … 53 68 %include "freeDiameter/freeDiameter.h" 54 69 70 -
include/freeDiameter/freeDiameter.h
r620 r621 47 47 #endif /* GNUTLS_VERSION */ 48 48 49 #ifndef SWIG50 49 /* GNUTLS calls debug level */ 51 50 #ifndef GNUTLS_DBG_LEVEL … … 69 68 (__call__); \ 70 69 } 71 #endif /* !SWIG */72 70 73 71 /* Structure to hold the configuration of the freeDiameter daemon */ … … 128 126 struct fifo *cnf_main_ev; /* events for the daemon's main (struct fd_event items) */ 129 127 }; 130 #ifdef SWIG131 %immutable;132 #endif /* SWIG */133 128 extern struct fd_config *fd_g_config; /* The pointer to access the global configuration, initalized in main */ 134 #ifdef SWIG135 %mutable;136 #endif /* SWIG */137 129 138 130 … … 182 174 , "STATE_ZOMBIE" \ 183 175 }; 184 #ifndef SWIG185 176 extern const char *peer_state_str[]; 186 #else /* SWIG */187 %immutable;188 extern const char **peer_state_str;189 %mutable;190 #endif /* !SWIG */191 177 #define STATE_STR(state) \ 192 178 (((unsigned)(state)) <= STATE_MAX ? peer_state_str[((unsigned)(state)) ] : "<Invalid>") … … 697 683 struct fd_list chain; /* link in cnf_endpoints list */ 698 684 699 #ifndef SWIG700 685 union { 701 686 sSS ss; /* the socket information. List is always ordered by ss value (memcmp) -- see fd_ep_add_merge */ … … 703 688 sSA6 sin6; 704 689 sSA sa; 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 */ 690 } 691 #ifdef SWIG /* nested anonymous unions are not supported yet */ 692 s 693 #endif /* SWIG */ 694 ; 710 695 711 696 #define EP_FL_CONF (1 << 0) /* This endpoint is statically configured in a configuration file */ -
include/freeDiameter/libfreeDiameter.h
r620 r621 81 81 /* INIT */ 82 82 /*============================================================*/ 83 #ifndef SWIG /* This section is not included in wrapper */84 85 83 86 84 /* This function must be called first, before any call to another library function */ … … 93 91 94 92 95 #endif /* !SWIG */96 93 /*============================================================*/ 97 94 /* DEBUG */ … … 118 115 */ 119 116 void fd_log_debug ( char * format, ... ); 120 #ifndef SWIG121 117 extern pthread_mutex_t fd_log_lock; 122 #endif /* !SWIG */123 118 extern char * fd_debug_one_function; 124 119 extern char * fd_debug_one_file; … … 139 134 * None. 140 135 */ 141 #ifndef SWIG142 136 void fd_log_threadname ( char * name ); 143 137 extern pthread_key_t fd_log_thname; 144 #endif /* !SWIG */145 138 146 139 /* … … 165 158 /*============================================================*/ 166 159 167 #ifndef SWIG168 160 #ifndef ASSERT 169 161 #define ASSERT(x) assert(x) 170 162 #endif /* ASSERT */ 171 #endif /* !SWIG */172 163 173 164 /* levels definitions */ … … 180 171 181 172 /* Default level is INFO */ 182 #ifndef SWIG183 173 #ifndef TRACE_LEVEL 184 174 #define TRACE_LEVEL INFO 185 175 #endif /* TRACE_LEVEL */ 186 #endif /* !SWIG */187 176 188 177 /* The level of the file being compiled. */ 189 #ifndef SWIG190 178 static int local_debug_level = TRACE_LEVEL; 191 #endif /* !SWIG */192 179 193 180 /* A global level, changed by configuration or cmd line for example. default is 0. */ … … 195 182 196 183 /* Some portability code to get nice function name in __PRETTY_FUNCTION__ */ 197 #ifndef SWIG198 184 #if __STDC_VERSION__ < 199901L 199 185 # if __GNUC__ >= 2 … … 206 192 #define __PRETTY_FUNCTION__ __func__ 207 193 #endif /* __PRETTY_FUNCTION__ */ 208 #endif /* !SWIG */209 194 210 195 /* A version of __FILE__ without the full path */ 211 #ifndef SWIG212 196 static char * file_bname = NULL; 213 197 #define __STRIPPED_FILE__ (file_bname ?: (file_bname = basename(__FILE__))) 214 #endif /* !SWIG */215 198 216 199 217 200 /* Boolean for tracing at a certain level */ 218 #ifndef SWIG219 201 #ifdef DEBUG 220 202 #define TRACE_BOOL(_level_) ( ((_level_) <= local_debug_level + fd_g_debug_lvl) \ … … 224 206 #define TRACE_BOOL(_level_) ((_level_) <= local_debug_level + fd_g_debug_lvl) 225 207 #endif /* DEBUG */ 226 #endif /* !SWIG */227 208 228 209 … … 230 211 The general debug macro, each call results in two lines of debug messages (change the macro for more compact output) 231 212 *************/ 232 #ifndef SWIG233 213 #ifdef DEBUG 234 214 /* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */ … … 260 240 } 261 241 #endif /* DEBUG */ 262 #endif /* !SWIG */263 242 264 243 /************* 265 244 Derivatives from this macro 266 245 ************/ 267 #ifndef SWIG268 246 /* Helper for function entry -- for very detailed trace of the execution */ 269 247 #define TRACE_ENTRY(_format,_args... ) \ … … 397 375 #endif /* STRIP_DEBUG_CODE */ 398 376 399 #endif /* !SWIG */400 377 401 378 /*============================================================*/ … … 406 383 * These macro should be used only when errors are improbable, not for expected errors. 407 384 */ 408 #ifndef SWIG409 385 410 386 /* Check the return value of a system function and execute fallback in case of error */ … … 500 476 } 501 477 502 #endif /* !SWIG */503 478 504 479 … … 507 482 /*============================================================*/ 508 483 509 #ifndef SWIG510 484 511 485 /* helper macros (pre-processor hacks to allow macro arguments) */ … … 591 565 #endif /* BUFSIZ */ 592 566 593 #endif /* !SWIG */594 567 595 568 … … 597 570 /* THREADS */ 598 571 /*============================================================*/ 599 #ifndef SWIG600 572 601 573 /* Terminate a thread */ … … 660 632 } 661 633 } 662 #endif /* !SWIG */663 634 664 635 /*============================================================*/ … … 669 640 /* EALREADY will be returned if there is already a callback registered on this signal */ 670 641 /* NOTE: the signal handler will be called from a new detached thread */ 671 #ifndef SWIG672 642 int fd_sig_register(int signal, char * modname, void (*callback)(int signal)); 673 #endif /* !SWIG */674 643 675 644 /* Remove the handler for a given signal */ … … 1582 1551 1583 1552 /* The following function must be called to activate the session expiry mechanism */ 1584 #ifndef SWIG1585 1553 int fd_sess_start(void); 1586 #endif /* !SWIG */1587 1554 1588 1555 /* … … 2172 2139 * EINVAL: a parameter is invalid 2173 2140 */ 2174 #ifndef SWIG2175 2141 int fd_msg_anscb_associate( struct msg * msg, void ( *anscb)(void *, struct msg **), void * data ); 2176 2142 int fd_msg_anscb_get ( struct msg * msg, void (**anscb)(void *, struct msg **), void ** data ); 2177 #endif /* !SWIG */2178 2143 2179 2144 /* … … 2192 2157 * EINVAL: a parameter is invalid 2193 2158 */ 2194 #ifndef SWIG2195 2159 int fd_msg_rt_associate( struct msg * msg, struct rt_data ** rtd ); 2196 #endif /* !SWIG */2197 2160 int fd_msg_rt_get ( struct msg * msg, struct rt_data ** rtd ); 2198 2161 … … 2232 2195 * !0 : an error occurred. 2233 2196 */ 2234 #ifndef SWIG2235 2197 int fd_msg_source_set( struct msg * msg, char * diamid, int add_rr, struct dictionary * dict ); 2236 #endif /* !SWIG */2237 2198 int fd_msg_source_get( struct msg * msg, char ** diamid ); 2238 2199 … … 2310 2271 * ENOTSUP : There is no appropriate callback registered with this AVP's type. 2311 2272 */ 2312 #ifndef SWIG2313 2273 int fd_msg_avp_value_encode ( void *data, struct avp *avp ); 2314 #endif /* !SWIG */2315 2274 /* 2316 2275 * FUNCTION: fd_msg_avp_value_interpret … … 2330 2289 * ENOTSUP : There is no appropriate callback registered with this AVP's type. 2331 2290 */ 2332 #ifndef SWIG2333 2291 int fd_msg_avp_value_interpret ( struct avp *avp, void *data ); 2334 #endif /* !SWIG */2335 2292 2336 2293
Note: See TracChangeset
for help on using the changeset viewer.