Navigation


Changeset 658:f198d16fa7f4 in freeDiameter for include


Ignore:
Timestamp:
Jan 14, 2011, 3:15:23 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Initial commit for 1.1.0:

  • Restructuring:
    • libfreeDiameter:
      • renamed folder & binary into libfdproto
      • renamed libfD.h into fdproto-internal.h
      • removed signals management (replaced by triggers in libfdcore)
  • freeDiameter split into:
    • libfdcore (most contents)
      • renamed fD.h into fdcore-internal.h
      • added core.c for framework init/shutdown.
      • new triggers mechanism in events.c.
  • freeDiameterd (main, command line parsing, signals management)
  • tests:
    • now in top-level directory tests.
  • other changes:
    • fd_dict_new now returns 0 on duplicate identical entries.
    • fixes in dict_legacy_xml
    • fixes in some dictionaries
    • moved FD_DEFAULT_CONF_FILENAME definition to freeDiameter-host.h
Location:
include/freeDiameter
Files:
3 edited
2 moved

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/CMakeLists.txt

    r561 r658  
    11#CMake configuration for freeDiameter include directory
    22
    3 Project("freeDiameter include directory" C)
     3Project("freeDiameter includes directory" C)
    44
    55########################
     
    6868ENDIF (HAVE_CLOCK_GETTIME)
    6969
    70 # LFD_LIBS = libraries required by the libfreeDiameter.
    71 SET(LFD_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT})
     70# LFDPROTO_LIBS = libraries required by the libfdproto.
     71SET(LFDPROTO_LIBS ${CLOCK_GETTIME_LIBS} ${CMAKE_THREAD_LIBS_INIT})
    7272
    7373
     
    9898
    9999
    100 # FD_LIBS = libraries required by the daemon
    101 SET(FD_LIBS ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES})
     100# Require GNU TLS for building the library
     101FIND_PACKAGE(GnuTLS REQUIRED)
     102INCLUDE_DIRECTORIES(${GNUTLS_INCLUDE_DIR})
     103
     104find_path(GCRYPT_INCLUDE_DIR NAMES gcrypt.h)
     105If ( NOT GCRYPT_INCLUDE_DIR )
     106        MESSAGE(SEND_ERROR "Unable to find gcrypt.h, please install libgcrypt-dev or equivalent")
     107Endif ( NOT GCRYPT_INCLUDE_DIR )
     108MARK_AS_ADVANCED(GCRYPT_INCLUDE_DIR)
     109INCLUDE_DIRECTORIES(${GCRYPT_INCLUDE_DIR})
     110
     111# Also we need libgcrypt to... display its version :(
     112find_library(GCRYPT_LIBRARY
     113  NAMES gcrypt
     114)
     115If ( NOT GCRYPT_LIBRARY )
     116        MESSAGE(SEND_ERROR "Unable to find libgcrypt, please install libgcrypt or equivalent")
     117Endif ( NOT GCRYPT_LIBRARY )
     118
     119
     120# LFDCORE_LIBS = libraries required by the libfdcore
     121SET(LFDCORE_LIBS ${CMAKE_DL_LIBS} ${SCTP_LIBRARIES} ${GCRYPT_LIBRARY} ${GNUTLS_LIBRARIES})
    102122
    103123##########################
     
    111131
    112132# Save some variables for the other directories
    113 SET(FD_LIBS  ${FD_LIBS} PARENT_SCOPE)
    114 SET(LFD_LIBS ${LFD_LIBS} PARENT_SCOPE)
     133SET(LFDPROTO_LIBS ${LFDPROTO_LIBS} PARENT_SCOPE)
     134SET(LFDCORE_LIBS  ${LFDCORE_LIBS} PARENT_SCOPE)
    115135SET(CMAKE_THREAD_LIBS_INIT ${CMAKE_THREAD_LIBS_INIT} PARENT_SCOPE)
    116136
     
    119139
    120140# The headers from this directory are required to develop new extensions for freeDiameter.
    121 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h libfreeDiameter.h freeDiameter.h extension.h
     141INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/freeDiameter-host.h libfdproto.h libfdcore.h extension.h
    122142        DESTINATION ${INSTALL_HEADERS_SUFFIX}
    123143        COMPONENT freeDiameter-dev)
  • include/freeDiameter/extension.h

    r8 r658  
    33* Author: Sebastien Decugis <sdecugis@nict.go.jp>                                                        *
    44*                                                                                                        *
    5 * Copyright (c) 2009, WIDE Project and NICT                                                              *
     5* Copyright (c) 2011, WIDE Project and NICT                                                              *
    66* All rights reserved.                                                                                   *
    77*                                                                                                        *
     
    3939/* Include definition of freeDiameter API */
    4040#include <freeDiameter/freeDiameter-host.h>
    41 #include <freeDiameter/freeDiameter.h>
     41#include <freeDiameter/libfdcore.h>
    4242
    4343/* Macro that define the entry point of the extension */
  • include/freeDiameter/freeDiameter-host.h.in

    r648 r658  
    7575#cmakedefine DEFAULT_EXTENSIONS_PATH "@DEFAULT_EXTENSIONS_PATH@"
    7676
     77#ifndef FD_DEFAULT_CONF_FILENAME
     78#define FD_DEFAULT_CONF_FILENAME "freeDiameter.conf"
     79#endif /* FD_DEFAULT_CONF_FILENAME */
     80
    7781#endif /* FD_IS_CONFIG */
  • include/freeDiameter/libfdcore.h

    r648 r658  
    3434*********************************************************************************************************/
    3535
    36 #ifndef _FREEDIAMETER_H
    37 #define _FREEDIAMETER_H
    38 
    39 
    40 #include <freeDiameter/libfreeDiameter.h>
     36#ifndef _LIBFDCORE_H
     37#define _LIBFDCORE_H
     38
     39
     40#include <freeDiameter/libfdproto.h>
    4141#include <gnutls/gnutls.h>
    4242#include <gnutls/x509.h>
     
    6868        (__call__);                                                     \
    6969}
     70
     71
     72/*============================================================*/
     73/*                      INITIALIZATION                        */
     74/*============================================================*/
     75
     76
     77/* Initialize the libfdcore internals. This also initializes libfdproto */
     78int fd_core_initialize(void);
     79
     80/* Return a string describing the version of the library */
     81const char *fd_core_version(void);
     82
     83/* Parse the freeDiameter.conf configuration file, load the extensions */
     84int fd_core_parseconf(char * conffile);
     85
     86/* Start the server & client threads */
     87int fd_core_start(void);
     88
     89/* Block until the framework has completed its initialization -- useful for extensions */
     90int fd_core_waitstartcomplete(void);
     91
     92/* Initialize shutdown of the framework */
     93int fd_core_shutdown(void);
     94
     95/* Wait for the shutdown to be complete -- this should always be called after fd_core_shutdown */
     96int fd_core_wait_shutdown_complete(void);
     97
     98
     99/*============================================================*/
     100/*                          CONFIG                            */
     101/*============================================================*/
    70102
    71103/* Structure to hold the configuration of the freeDiameter daemon */
     
    129161
    130162
    131 /***************************************/
    132 /*   Peers information                 */
    133 /***************************************/
     163
     164/*============================================================*/
     165/*                         PEERS                              */
     166/*============================================================*/
    134167
    135168/* States of a peer */
     
    366399 */
    367400
    368 /***************************************/
    369 /*   Sending a message on the network  */
    370 /***************************************/
     401
     402
     403/*============================================================*/
     404/*                         MESSAGES                           */
     405/*============================================================*/
    371406
    372407/*
     
    444479
    445480
    446 /***************************************/
    447 /*   Dispatch module, daemon's part    */
    448 /***************************************/
     481
     482
     483/*============================================================*/
     484/*                         DISPATCH                           */
     485/*============================================================*/
    449486
    450487/*
     
    471508
    472509
    473 /***************************************/
    474 /*          Routing module             */
    475 /***************************************/
     510/*============================================================*/
     511/*                         ROUTING                            */
     512/*============================================================*/
    476513
    477514/* This file contains the definitions of types and functions involved in the routing decisions in freeDiameter,
     
    661698
    662699
    663 /***************************************/
    664 /*   Events helpers                    */
    665 /***************************************/
     700/*============================================================*/
     701/*                         EVENTS                             */
     702/*============================================================*/
    666703
    667704struct fd_event {
     
    671708};
    672709
    673 /* Daemon's codespace: 1000->1999 (1500->1999 defined in fD.h) */
     710/* Daemon's codespace: 1000->1999 (1500->1999 defined in fdcore-internal.h) */
    674711enum {
    675712         FDEV_TERMINATE = 1000  /* request to terminate */
     
    680717        ,FDEV_DUMP_CONFIG       /* Dump the configuration */
    681718        ,FDEV_DUMP_PEERS        /* Dump the list of peers */
     719        ,FDEV_TRIGGER           /* Trigger available for extensions. size is sizeof(int), data is int * */
    682720};
    683721
     
    688726const char * fd_ev_str(int event);
    689727
    690 
    691 /* The following function does not really use events, but it may be used
    692 by extensions that need to start an action when the framework is fully initialized.
    693 This function will block until all initializations are performed in the daemon.
    694 It is meant to be used as follow by extensions:
    695  - in initialization callback, create a new thread.
    696  - this new thread calls this function.
    697  - when the function returns, the thread can start working and using all framework features.
    698 */
    699 int fd_wait_initialization_complete(void);
    700 
    701 
    702 /***************************************/
    703 /*   Endpoints lists helpers           */
    704 /***************************************/
     728/* for extensions */
     729int fd_event_trig_regcb(int trigger_val, const char * module, void (*cb)(void));
     730void fd_event_trig_dump();
     731
     732
     733/*============================================================*/
     734/*                         ENDPOINTS                          */
     735/*============================================================*/
    705736
    706737struct fd_endpoint {
     
    737768void fd_ep_dump( int indent, struct fd_list * eps );
    738769
    739 /***************************************/
    740 /*   Applications lists helpers        */
    741 /***************************************/
     770
     771/*============================================================*/
     772/*                         APPLICATIONS IDs                   */
     773/*============================================================*/
    742774
    743775struct fd_app {
     
    756788int fd_app_empty(struct fd_list * list);
    757789
    758 #endif /* _FREEDIAMETER_H */
     790#endif /* _LIBFDCORE_H */
  • include/freeDiameter/libfdproto.h

    r653 r658  
    5454 */
    5555
    56 #ifndef _LIBFREEDIAMETER_H
    57 #define _LIBFREEDIAMETER_H
     56#ifndef _LIBFDPROTO_H
     57#define _LIBFDPROTO_H
    5858
    5959#ifndef FD_IS_CONFIG
     
    8383
    8484/* This function must be called first, before any call to another library function */
    85 /* If the parameter is not 0, the support for signals (fd_sig_register) is enabled, otherwise it is disabled */
    86 /* The function must be called while the application is single-threaded to enable support for signals */
    87 int fd_lib_init(int support_signals);
     85int fd_libproto_init(void); /* note if you are using libfdcore, it handles this already */
    8886
    8987/* Call this one when the application terminates, to destroy internal threads */
    90 void fd_lib_fini(void);
     88void fd_libproto_fini(void);
    9189
    9290
     
    633631}
    634632
    635 /*============================================================*/
    636 /*                          SIGNALS                           */
    637 /*============================================================*/
    638 
    639 /* Register a new callback to be called on reception of a given signal (it receives the signal as parameter) */
    640 /* EALREADY will be returned if there is already a callback registered on this signal */
    641 /* NOTE: the signal handler will be called from a new detached thread */
    642 int fd_sig_register(int signal, char * modname, void (*callback)(int signal));
    643 
    644 /* Remove the handler for a given signal */
    645 int fd_sig_unregister(int signal);
    646 
    647 /* Dump list of handlers */
    648 void fd_sig_dump(int level, int indent);
    649 
    650 /* Name of signals */
    651 const char * fd_sig_abbrev(int signal);
    652 
    653633
    654634/*============================================================*/
     
    28122792void fd_fifo_dump(int level, char * name, struct fifo * queue, void (*dump_item)(int level, void * item));
    28132793
    2814 #endif /* _LIBFREEDIAMETER_H */
     2794#endif /* _LIBFDPROTO_H */
Note: See TracChangeset for help on using the changeset viewer.