Navigation



Ignore:
Timestamp:
Sep 30, 2009, 6:25:46 PM (15 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Progress on peer state machine

File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/freeDiameter.h

    r12 r13  
    8181        struct fd_list  chain;  /* link in cnf_endpoints list */
    8282        sSS             ss;     /* the socket information. */
     83        struct {
     84                unsigned conf : 1; /* This endpoint is statically configured in a configuration file */
     85                unsigned disc : 1; /* This endpoint was resolved from the Diameter Identity or other DNS query */
     86                unsigned adv  : 1; /* This endpoint was advertized in Diameter CER/CEA exchange */
     87                unsigned ll   : 1; /* Lower layer mechanism provided this endpoint */
     88               
     89                /* To add: a validity timestamp for DNS records ? How do we retrieve this lifetime from DNS ? */
     90
     91        }               meta;   /* Additional information about the endpoint */
    8392};
    8493
     
    164173        peer_state_str[ ((unsigned)(state)) <= STATE_REOPEN ? ((unsigned)(state)) : 0 ]
    165174
    166 /* Information about a remote peer, used both for query and for creating a new entry */
     175/* Information about a remote peer. Same structure is used for creating a new entry, but not all fields are meaningful in that case */
    167176struct peer_info {
    168177       
    169         char * pi_diamid;       /* UTF-8, \0 terminated. The Diameter Identity of the remote peer */
    170         char * pi_realm;        /* idem, its realm. */
     178        char *          pi_diamid;      /* UTF-8, \0 terminated. The Diameter Identity of the remote peer */
     179        char *          pi_realm;       /* Its realm, as received in CER/CEA exchange. */
    171180       
    172181        struct {
     
    191200               
    192201                #define PI_EXP_NONE     0       /* the peer entry does not expire */
    193                 #define PI_EXP_INACTIVE 1       /* the peer entry expires after pi_lft seconds without activity */
     202                #define PI_EXP_INACTIVE 1       /* the peer entry expires (i.e. is deleted) after pi_lft seconds without activity */
    194203                unsigned        exp :1;
    195204               
     
    199208                unsigned        inband :2;      /* This is only meaningful with pi_flags.sec == 3 */
    200209               
    201                 unsigned        relay :1;       /* The remote peer advertized the relay application */         
    202         } pi_flags;
     210                unsigned        relay :1;       /* The remote peer advertized the relay application */
     211
     212        }               pi_flags;       /* Some flags */
    203213       
    204214        /* Additional parameters */
    205         uint32_t        pi_lft;         /* lifetime of entry without activity (except watchdogs) (see pi_flags.exp definition) */
     215        uint32_t        pi_lft;         /* lifetime of this peer when inactive (see pi_flags.exp definition) */
    206216        uint16_t        pi_streams;     /* number of streams for SCTP. 0 = default */
    207217        uint16_t        pi_port;        /* port to connect to. 0: default. */
     
    209219        int             pi_twtimer;     /* use this value for TwTimer instead of global, if != 0 */
    210220       
    211         struct fd_list  pi_endpoints;   /* Endpoint(s) of the remote peer (discovered or advertized). list of struct fd_endpoint. DNS resolved if empty. */
     221        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;
    212239       
    213240        /* The remaining information is read-only, not used for peer creation */
     
    244271 * DESCRIPTION:
    245272 *  Add a peer to the list of peers to which the daemon must maintain a connexion.
    246  * If cb is not null, the callback is called when the connection is in OPEN state or
     273 *
     274 *  The content of info parameter is copied, except for the list of endpoints if
     275 * not empty, which is simply moved into the created object. It means that the list
     276 * items must have been malloc'd, so that they can be freed.
     277 *
     278 *  If cb is not null, the callback is called when the connection is in OPEN state or
    247279 * when an error has occurred. The callback should use the pi_state information to
    248  * determine which one it is.
     280 * determine which one it is. If the first parameter of the called callback is NULL, it
     281 * means that the peer is being destroyed before attempt success / failure.
     282 * cb is called to allow freeing cb_data in  * this case.
     283 *
     284 *  The orig_dbg string is only useful for easing debug, and can be left to NULL.
    249285 *
    250286 * RETURN VALUE:
Note: See TracChangeset for help on using the changeset viewer.