Navigation


Changeset 706:4ffbc9f1e922 in freeDiameter for include/freeDiameter/libfdcore.h


Ignore:
Timestamp:
Feb 9, 2011, 3:26:58 PM (13 years ago)
Author:
Sebastien Decugis <sdecugis@nict.go.jp>
Branch:
default
Phase:
public
Message:

Large UNTESTED commit with the following changes:

  • Improved DiameterIdentity? handling (esp. interationalization issues), and improve efficiency of some string operations in peers, sessions, and dictionary modules (closes #7)
  • Cleanup in the session module to free only unreferenced sessions (#16)
  • Removed fd_cpu_flush_cache(), replaced by more robust alternatives.
  • Improved peer state machine algorithm to counter SCTP multistream race condition.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • include/freeDiameter/libfdcore.h

    r658 r706  
    108108        char            *cnf_file;      /* Configuration file to parse, default is DEFAULT_CONF_FILE */
    109109       
    110         char            *cnf_diamid;    /* Diameter Identity of the local peer (FQDN -- UTF-8) */
    111         size_t           cnf_diamid_len;        /* length of the previous string */
    112         char            *cnf_diamrlm;   /* Diameter realm of the local peer, default to realm part of diam_id */
     110        DiamId_t         cnf_diamid;    /* Diameter Identity of the local peer (FQDN -- ASCII) */
     111        size_t           cnf_diamid_len;/* cached length of the previous string */
     112        DiamId_t         cnf_diamrlm;   /* Diameter realm of the local peer, default to realm part of cnf_diamid */
    113113        size_t           cnf_diamrlm_len;/* length of the previous string */
    114114       
     
    187187        STATE_SUSPECT,          /* A DWR was sent and not answered within TwTime. Failover in progress. */
    188188        STATE_REOPEN,           /* Connection has been re-established, waiting for 3 DWR/DWA exchanges before putting back to service */
     189       
     190        /* Ordering issues with multistream & state machine. -- see top of p_psm.c for explanation */
     191        STATE_OPEN_NEW,         /* after CEA is sent, until a new message is received. Force ordering in this state */
     192        STATE_CLOSING_GRACE,    /* after DPA is sent or received, give a short delay for messages in the pipe to be received. */
    189193       
    190194        /* Error state */
     
    205209        , "STATE_SUSPECT"               \
    206210        , "STATE_REOPEN"                \
     211        , "STATE_OPEN_NEW"              \
     212        , "STATE_CLOSING_GRACE"         \
    207213        , "STATE_ZOMBIE"                \
    208214        };
     
    237243struct peer_info {
    238244       
    239         char *          pi_diamid;      /* UTF-8, \0 terminated. The Diameter Identity of the remote peer. */
     245        DiamId_t        pi_diamid;      /* (supposedly) UTF-8, \0 terminated. The Diameter Identity of the remote peer. */
     246        size_t          pi_diamidlen;   /* cached length of pi_diamid */
    240247       
    241248        struct {
     
    250257                }               pic_flags;      /* Flags influencing the connection to the remote peer */
    251258               
    252                 char *          pic_realm;      /* If configured, the daemon will match the received realm in CER/CEA matches this. */
     259                DiamId_t        pic_realm;      /* If configured, the daemon will check the received realm in CER/CEA matches this. */
    253260                uint16_t        pic_port;       /* port to connect to. 0: default. */
    254261               
     
    263270        struct {
    264271               
    265                 enum peer_state pir_state;      /* Current state of the peer in the state machine. fd_cpu_flush_cache() might be useful before reading. */
    266                
    267                 char *          pir_realm;      /* The received realm in CER/CEA. */
     272                /* enum peer_state      pir_state; */
     273                /* Since 1.1.0, read the state with fd_peer_getstate(peer). */
     274               
     275                DiamId_t        pir_realm;      /* The received realm in CER/CEA. */
     276                size_t          pir_realmlen;   /* length of the realm */
    268277               
    269278                uint32_t        pir_vendorid;   /* Content of the Vendor-Id AVP, or 0 by default */
    270279                uint32_t        pir_orstate;    /* Origin-State-Id value */
    271                 char *          pir_prodname;   /* copy of UTF-8 Product-Name AVP (\0 terminated) */
     280                os0_t           pir_prodname;   /* copy of Product-Name AVP (\0 terminated) */
    272281                uint32_t        pir_firmrev;    /* Content of the Firmware-Revision AVP */
    273282                int             pir_relay;      /* The remote peer advertized the relay application */
     
    290299
    291300struct peer_hdr {
    292         struct fd_list   chain; /* List of all the peers, ordered by their Diameter Id */
     301        struct fd_list   chain; /* Link into the list of all the peers, ordered by their Diameter Id (fd_os_cmp) */
    293302        struct peer_info info;  /* The public data */
    294303       
     
    339348 *
    340349 * PARAMETERS:
    341  *  diamid      : A \0 terminated string.
     350 *  diamid      : an UTF8 string describing the diameter Id of the peer to seek
     351 *  diamidlen   : length of the diamid
     352 *  igncase     : perform an almost-case-insensitive search? (slower)
    342353 *  peer        : The peer is stored here if it exists.
    343354 *
     
    349360 * !0   : An error occurred.
    350361 */
    351 int fd_peer_getbyid( char * diamid, struct peer_hdr ** peer );
     362int fd_peer_getbyid( DiamId_t diamid, size_t diamidlen, int igncase, struct peer_hdr ** peer );
     363
     364/*
     365 * FUNCTION:    fd_peer_get_state
     366 *
     367 * PARAMETERS:
     368 *  peer        : The peer which state to read
     369 *
     370 * DESCRIPTION:
     371 *   Returns the current state of the peer.
     372 *
     373 * RETURN VALUE:
     374 *  -1  : peer is invalid
     375 * >=0  : the state of the peer at the time of reading.
     376 */
     377int fd_peer_get_state(struct peer_hdr *peer);
    352378
    353379/*
     
    474500/* Add Origin-Host, Origin-Realm, (if osi) Origin-State-Id AVPS at the end of the message */
    475501int fd_msg_add_origin ( struct msg * msg, int osi );
     502
     503/* Generate a new Session-Id and add it at the beginning of the message (opt is added at the end of the sid if provided) */
     504int fd_msg_new_session( struct msg * msg, os0_t opt, size_t optlen );
     505
    476506
    477507/* Parse a message against our dictionary, and in case of error log and eventually build the error reply (on return and EBADMSG, *msg == NULL or *msg is the error message ready to send) */
Note: See TracChangeset for help on using the changeset viewer.