Navigation


Changeset 621:04dbea46c7a2 in freeDiameter


Ignore:
Timestamp:
Dec 7, 2010, 11:13:58 AM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Cleanup many SWIG definitions from main .h files

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/dbg_interactive/dbg_interactive.c

    r618 r621  
    6666       
    6767        Py_Initialize();
     68       
     69#if PY_VERSION_HEX >= 0x03000000
     70        PyInit__diwrap();
     71#else /* PY_VERSION_HEX */
    6872        init_diwrap();
     73#endif /* PY_VERSION_HEX */
    6974       
     75        /* In future version, it might be better to use the diwrap.py file generated by SWIG here to get the proxy classes definitions */
    7076        PyRun_SimpleString("from _diwrap import *\n");
    7177        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");
    7379        }
    7480       
    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         */
    8081        CHECK_POSIX( pthread_create(&pyinterp, NULL, myinterp, conffile) );
    8182 
  • extensions/dbg_interactive/diwrap.i

    r618 r621  
    3737%module diwrap
    3838
    39 /* Include standard types used in freeDiameter headers */
     39/* Include standard types & functions used in freeDiameter headers */
    4040%include <stdint.i>
    41  
    42 /* Allow modification of the wrapper for OUTPUT vars */
    43 %include "typemaps.i"
    4441
    4542%{
    4643/* Define types etc. */
     44#define SWIG
    4745#include <freeDiameter/extension.h>
    4846%}
     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 */
     62extern void fd_list_init ( struct fd_list * list, void * obj = NULL );
     63
    4964
    5065/* Retrieve the compile-time definitions of freeDiameter */
     
    5368%include "freeDiameter/freeDiameter.h"
    5469
     70
  • include/freeDiameter/freeDiameter.h

    r620 r621  
    4747#endif /* GNUTLS_VERSION */
    4848
    49 #ifndef SWIG
    5049/* GNUTLS calls debug level */
    5150#ifndef GNUTLS_DBG_LEVEL
     
    6968        (__call__);                                                     \
    7069}
    71 #endif /* !SWIG */
    7270
    7371/* Structure to hold the configuration of the freeDiameter daemon */
     
    128126        struct fifo       *cnf_main_ev; /* events for the daemon's main (struct fd_event items) */
    129127};
    130 #ifdef SWIG
    131 %immutable;
    132 #endif /* SWIG */
    133128extern struct fd_config *fd_g_config; /* The pointer to access the global configuration, initalized in main */
    134 #ifdef SWIG
    135 %mutable;
    136 #endif /* SWIG */
    137129
    138130
     
    182174        , "STATE_ZOMBIE"                \
    183175        };
    184 #ifndef SWIG
    185176extern const char *peer_state_str[];
    186 #else /* SWIG */
    187 %immutable;
    188 extern const char **peer_state_str;
    189 %mutable;
    190 #endif /* !SWIG */
    191177#define STATE_STR(state) \
    192178        (((unsigned)(state)) <= STATE_MAX ? peer_state_str[((unsigned)(state)) ] : "<Invalid>")
     
    697683        struct fd_list  chain;  /* link in cnf_endpoints list */
    698684       
    699 #ifndef SWIG
    700685        union {
    701686                sSS             ss;     /* the socket information. List is always ordered by ss value (memcmp) -- see fd_ep_add_merge */
     
    703688                sSA6            sin6;
    704689                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        ;
    710695       
    711696#define EP_FL_CONF      (1 << 0)        /* This endpoint is statically configured in a configuration file */
  • include/freeDiameter/libfreeDiameter.h

    r620 r621  
    8181/*                          INIT                              */
    8282/*============================================================*/
    83 #ifndef SWIG  /* This section is not included in wrapper */
    84 
    8583
    8684/* This function must be called first, before any call to another library function */
     
    9391
    9492
    95 #endif /* !SWIG */
    9693/*============================================================*/
    9794/*                          DEBUG                             */
     
    118115 */
    119116void fd_log_debug ( char * format, ... );
    120 #ifndef SWIG
    121117extern pthread_mutex_t  fd_log_lock;
    122 #endif /* !SWIG */
    123118extern char * fd_debug_one_function;
    124119extern char * fd_debug_one_file;
     
    139134 *  None.
    140135 */
    141 #ifndef SWIG
    142136void fd_log_threadname ( char * name );
    143137extern pthread_key_t    fd_log_thname;
    144 #endif /* !SWIG */
    145138
    146139/*
     
    165158/*============================================================*/
    166159
    167 #ifndef SWIG
    168160#ifndef ASSERT
    169161#define ASSERT(x) assert(x)
    170162#endif /* ASSERT */
    171 #endif /* !SWIG */
    172163
    173164/* levels definitions */
     
    180171
    181172/* Default level is INFO */
    182 #ifndef SWIG
    183173#ifndef TRACE_LEVEL
    184174#define TRACE_LEVEL INFO
    185175#endif /* TRACE_LEVEL */
    186 #endif /* !SWIG */
    187176
    188177/* The level of the file being compiled. */
    189 #ifndef SWIG
    190178static int local_debug_level = TRACE_LEVEL;
    191 #endif /* !SWIG */
    192179
    193180/* A global level, changed by configuration or cmd line for example. default is 0. */
     
    195182
    196183/* Some portability code to get nice function name in __PRETTY_FUNCTION__ */
    197 #ifndef SWIG
    198184#if __STDC_VERSION__ < 199901L
    199185# if __GNUC__ >= 2
     
    206192#define __PRETTY_FUNCTION__ __func__
    207193#endif /* __PRETTY_FUNCTION__ */
    208 #endif /* !SWIG */
    209194
    210195/* A version of __FILE__ without the full path */
    211 #ifndef SWIG
    212196static char * file_bname = NULL;
    213197#define __STRIPPED_FILE__       (file_bname ?: (file_bname = basename(__FILE__)))
    214 #endif /* !SWIG */
    215198
    216199
    217200/* Boolean for tracing at a certain level */
    218 #ifndef SWIG
    219201#ifdef DEBUG
    220202#define TRACE_BOOL(_level_) ( ((_level_) <= local_debug_level + fd_g_debug_lvl)                                         \
     
    224206#define TRACE_BOOL(_level_) ((_level_) <= local_debug_level + fd_g_debug_lvl)
    225207#endif /* DEBUG */
    226 #endif /* !SWIG */
    227208
    228209
     
    230211 The general debug macro, each call results in two lines of debug messages (change the macro for more compact output)
    231212 *************/
    232 #ifndef SWIG
    233213#ifdef DEBUG
    234214/* In DEBUG mode, we add (a lot of) meta-information along each trace. This makes multi-threading problems easier to debug. */
     
    260240}
    261241#endif /* DEBUG */
    262 #endif /* !SWIG */
    263242
    264243/*************
    265244 Derivatives from this macro
    266245 ************/
    267 #ifndef SWIG
    268246/* Helper for function entry -- for very detailed trace of the execution */
    269247#define TRACE_ENTRY(_format,_args... ) \
     
    397375#endif /* STRIP_DEBUG_CODE */
    398376
    399 #endif /* !SWIG */
    400377
    401378/*============================================================*/
     
    406383 * These macro should be used only when errors are improbable, not for expected errors.
    407384 */
    408 #ifndef SWIG
    409385
    410386/* Check the return value of a system function and execute fallback in case of error */
     
    500476}
    501477
    502 #endif /* !SWIG */
    503478
    504479
     
    507482/*============================================================*/
    508483
    509 #ifndef SWIG
    510484
    511485/* helper macros (pre-processor hacks to allow macro arguments) */
     
    591565#endif /* BUFSIZ */
    592566
    593 #endif /* !SWIG */
    594567
    595568
     
    597570/*                          THREADS                           */
    598571/*============================================================*/
    599 #ifndef SWIG
    600572
    601573/* Terminate a thread */
     
    660632        }
    661633}
    662 #endif /* !SWIG */
    663634
    664635/*============================================================*/
     
    669640/* EALREADY will be returned if there is already a callback registered on this signal */
    670641/* NOTE: the signal handler will be called from a new detached thread */
    671 #ifndef SWIG
    672642int fd_sig_register(int signal, char * modname, void (*callback)(int signal));
    673 #endif /* !SWIG */
    674643
    675644/* Remove the handler for a given signal */
     
    15821551
    15831552/* The following function must be called to activate the session expiry mechanism */
    1584 #ifndef SWIG
    15851553int fd_sess_start(void);
    1586 #endif /* !SWIG */
    15871554
    15881555/*
     
    21722139 *  EINVAL: a parameter is invalid
    21732140 */
    2174 #ifndef SWIG
    21752141int fd_msg_anscb_associate( struct msg * msg, void ( *anscb)(void *, struct msg **), void  * data );
    21762142int fd_msg_anscb_get      ( struct msg * msg, void (**anscb)(void *, struct msg **), void ** data );
    2177 #endif /* !SWIG */
    21782143
    21792144/*
     
    21922157 *  EINVAL: a parameter is invalid
    21932158 */
    2194 #ifndef SWIG
    21952159int fd_msg_rt_associate( struct msg * msg, struct rt_data ** rtd );
    2196 #endif /* !SWIG */
    21972160int fd_msg_rt_get      ( struct msg * msg, struct rt_data ** rtd );
    21982161
     
    22322195 *  !0          : an error occurred.
    22332196 */
    2234 #ifndef SWIG
    22352197int fd_msg_source_set( struct msg * msg, char * diamid, int add_rr, struct dictionary * dict );
    2236 #endif /* !SWIG */
    22372198int fd_msg_source_get( struct msg * msg, char ** diamid );
    22382199
     
    23102271 *  ENOTSUP     : There is no appropriate callback registered with this AVP's type.
    23112272 */
    2312 #ifndef SWIG
    23132273int fd_msg_avp_value_encode ( void *data, struct avp *avp );
    2314 #endif /* !SWIG */
    23152274/*
    23162275 * FUNCTION:    fd_msg_avp_value_interpret
     
    23302289 *  ENOTSUP     : There is no appropriate callback registered with this AVP's type.
    23312290 */
    2332 #ifndef SWIG
    23332291int fd_msg_avp_value_interpret ( struct avp *avp, void *data );
    2334 #endif /* !SWIG */
    23352292
    23362293
Note: See TracChangeset for help on using the changeset viewer.