Navigation


Changeset 653:34373acfbc6a in freeDiameter


Ignore:
Timestamp:
Jan 11, 2011, 12:18:09 PM (11 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Added sample C++ file in _sample extension

Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/_sample/CMakeLists.txt

    r313 r653  
    11# The sample extension
    2 PROJECT("Sample extension" C)
     2PROJECT("Sample extension")
    33
    44# Overwrite the debug level for the extension code if configured
     
    1212
    1313# Compile as a module
    14 FD_ADD_EXTENSION(dbg_sample sample.c fini.c)
     14FD_ADD_EXTENSION(dbg_sample sample.c hello.cpp fini.c)
    1515
    1616
  • extensions/_sample/sample.c

    r10 r653  
    3636/* Sample extension to test extensions mechanism in freeDiameter */
    3737#include <freeDiameter/extension.h>
     38
     39/* from sample.cpp */
     40void mycppfunc();
    3841
    3942static int sample_main(char * conffile);
     
    8689        TRACE_DEBUG(INFO, "'Example-AVP' created without error\n");
    8790       
     91        /* Call the c++ function */
     92        mycppfunc();
     93       
    8894        /* The initialization function returns an error code with the standard POSIX meaning (ENOMEM, and so on) */
    8995        return 0;
  • include/freeDiameter/libfreeDiameter.h

    r649 r653  
    114114 *  None.
    115115 */
    116 void fd_log_debug ( char * format, ... );
     116void fd_log_debug ( const char * format, ... );
    117117extern pthread_mutex_t  fd_log_lock;
    118118extern char * fd_debug_one_function;
     
    195195/* A version of __FILE__ without the full path */
    196196static char * file_bname = NULL;
    197 #define __STRIPPED_FILE__       (file_bname ?: (file_bname = basename(__FILE__)))
     197#define __STRIPPED_FILE__       (file_bname ?: (file_bname = basename((char *)__FILE__)))
    198198
    199199
     
    216216        if ( TRACE_BOOL(level) ) {                                                                                              \
    217217                char __buf[25];                                                                                                 \
    218                 char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                       \
     218                const char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                 \
    219219                fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n"                                                                \
    220220                          "\t%s|%*s" format "\n",                                                                               \
     
    229229                if (fd_g_debug_lvl > FULL) {                                                                                            \
    230230                        char __buf[25];                                                                                                 \
    231                         char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                       \
     231                        const char * __thn = ((char *)pthread_getspecific(fd_log_thname) ?: "unnamed");                                 \
    232232                        fd_log_debug("\t | tid:%-20s\t%s\tin %s@%s:%d\n"                                                                \
    233233                                  "\t%s|%*s" format "\n",                                                                               \
     
    484484
    485485/* helper macros (pre-processor hacks to allow macro arguments) */
    486 #define __str( arg )  #arg
    487 #define _stringize( arg ) __str( arg )
     486#define __tostr( arg )  #arg
     487#define _stringize( arg ) __tostr( arg )
    488488#define __agr( arg1, arg2 ) arg1 ## arg2
    489489#define _aggregate( arg1, arg2 ) __agr( arg1, arg2 )
     
    16291629 *  len         : length of the sid string (which does not need to be '\0'-terminated)
    16301630 *  session     : On success, pointer to the session object created / retrieved.
    1631  *  new         : if not NULL, set to 1 on return if the session object has been created, 0 if it was simply retrieved.
     1631 *  isnew       : if not NULL, set to 1 on return if the session object has been created, 0 if it was simply retrieved.
    16321632 *
    16331633 * DESCRIPTION:
     
    16401640 *  ENOMEM      : Not enough memory to complete the operation
    16411641 */
    1642 int fd_sess_fromsid ( char * sid, size_t len, struct session ** session, int * new);
     1642int fd_sess_fromsid ( char * sid, size_t len, struct session ** session, int * isnew);
    16431643
    16441644/*
     
    22262226 *  msg         : A valid message.
    22272227 *  session     : Location to store the session pointer when retrieved.
    2228  *  new         : Indicates if the session has been created.
     2228 *  isnew       : Indicates if the session has been created.
    22292229 *
    22302230 * DESCRIPTION:
     
    22372237 * !0 : standard error code.
    22382238 */
    2239 int fd_msg_sess_get(struct dictionary * dict, struct msg * msg, struct session ** session, int * new);
     2239int fd_msg_sess_get(struct dictionary * dict, struct msg * msg, struct session ** session, int * isnew);
    22402240
    22412241/***************************************/
     
    26642664 *
    26652665 * PARAMETERS:
    2666  *  old         : Location of a FIFO that is to be emptied.
    2667  *  new         : A FIFO that will receive the old data.
     2666 *  oldq        : Location of a FIFO that is to be emptied.
     2667 *  newq        : A FIFO that will receive the old data.
    26682668 *  loc_update  : if non NULL, a place to store the pointer to new FIFO atomically with the move.
    26692669 *
     
    26752675 *  EINVAL      : A parameter is invalid.
    26762676 */
    2677 int fd_fifo_move ( struct fifo * old, struct fifo * new, struct fifo ** loc_update );
     2677int fd_fifo_move ( struct fifo * oldq, struct fifo * newq, struct fifo ** loc_update );
    26782678
    26792679/*
  • libfreeDiameter/log.c

    r258 r653  
    5757
    5858/* Log a debug message */
    59 void fd_log_debug ( char * format, ... )
     59void fd_log_debug ( const char * format, ... )
    6060{
    6161        va_list ap;
Note: See TracChangeset for help on using the changeset viewer.