Navigation



Ignore:
Timestamp:
Oct 2, 2009, 6:57:06 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Started including TLS code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/freeDiameter.h

    r14 r16  
    3939
    4040#include <freeDiameter/libfreeDiameter.h>
     41#include <gnutls/gnutls.h>
     42#include <gnutls/x509.h>
     43
     44/* GNUTLS version */
     45#ifndef GNUTLS_VERSION
     46#define GNUTLS_VERSION LIBGNUTLS_VERSION
     47#endif /* GNUTLS_VERSION */
     48
     49/* Check the return value of a GNUTLS function, log and propagate */
     50#define CHECK_GNUTLS_DO( __call__, __fallback__ ) {                                             \
     51        int __ret__;                                                                            \
     52        TRACE_DEBUG_ALL( "Check FCT: " #__call__ );                                             \
     53        __ret__ = (__call__);                                                                   \
     54        if (__ret__ < 0) {                                                                      \
     55                TRACE_DEBUG(INFO, "Error in '" #__call__ "':\t%s", gnutls_strerror(__ret__));   \
     56                __fallback__;                                                                   \
     57        }                                                                                       \
     58}
    4159
    4260
     
    7088                unsigned tls_alg: 1;    /* TLS algorithm for initiated cnx. 0: separate port. 1: inband-security (old) */
    7189        }                cnf_flags;
     90       
     91        struct {
     92                        /* GNUTLS global state */
     93                        /* Server credential(s) */
     94        }                cnf_sec_data;
    7295       
    7396        uint32_t         cnf_orstateid; /* The value to use in Origin-State-Id, default to random value */
     
    151174enum peer_state {
    152175        /* Stable states */
    153         STATE_ZOMBIE = 0,       /* The threads handling the peer are not running for some reason */
     176        STATE_NEW = 0,          /* The peer has been just been created, PSM thread not started yet */
    154177        STATE_OPEN,             /* Connexion established */
    155178       
     
    168191        STATE_SUSPECT,          /* A DWR was sent and not answered within TwTime. Failover in progress. */
    169192        STATE_REOPEN,           /* Connection has been re-established, waiting for 3 DWR/DWA exchanges before putting back to service */
     193       
     194        /* Error state */
     195        STATE_ZOMBIE            /* The PSM thread is not running anymore; it must be re-started or peer should be deleted. */
     196#define STATE_MAX STATE_ZOMBIE
    170197};
    171198extern const char *peer_state_str[];
    172199#define STATE_STR(state) \
    173         (((unsigned)(state)) <= STATE_REOPEN ? peer_state_str[((unsigned)(state)) ] : "<Invalid>")
     200        (((unsigned)(state)) <= STATE_MAX ? peer_state_str[((unsigned)(state)) ] : "<Invalid>")
    174201
    175202/* Information about a remote peer. Same structure is used for creating a new entry, but not all fields are meaningful in that case */
     
    220247       
    221248        struct fd_list  pi_endpoints;   /* Endpoint(s) of the remote peer (configured, discovered, or advertized). list of struct fd_endpoint. DNS resolved if empty. */
    222        
    223         /* TLS specific data -- the exact data pointed here depends on the security module in use (ex: gnutls, ...) */
    224         enum {
    225                 PI_SEC_GNUTLS = 0,      /* The security module is GNUTLS, this is the default */
    226                 PI_SEC_OTHER            /* Another security module (TBD) */
    227         }               pi_sec_module;
    228         union {
    229                 /* Security data when pi_sec_module == PI_SEC_GNUTLS */
    230                 struct {
    231                         void *  CA;     /* Authority to use to validate this peer credentials (a CA or root certificate) -- use default if NULL */
    232                         void *  cred;   /* The (valid) credentials that the peer has presented */
    233                 }       gnutls;
    234                 /* Security data when pi_sec_module == PI_SEC_OTHER */
    235                 struct {
    236                         void * dummy;   /* Something meaningful for the other security module */
    237                 }       other;
    238         }               pi_sec_data;
    239249       
    240250        /* The remaining information must not be modified, and is not used for peer creation */
     
    245255        uint32_t        pi_firmrev;     /* Content of the Firmware-Revision AVP */
    246256        struct fd_list  pi_apps;        /* applications advertised by the remote peer, except relay (pi_flags.relay) */
     257        struct {
     258                /* This is inspired from http://www.gnu.org/software/gnutls/manual/gnutls.html#ex_003ax509_002dinfo */
     259                const gnutls_datum_t    *cert_list;     /* The (valid) credentials that the peer has presented */
     260                unsigned int             cert_list_size;/* Number of certificates in the list */
     261        }               pi_sec_data;
    247262};
    248263
Note: See TracChangeset for help on using the changeset viewer.