Navigation


Changeset 21:bef197f6826f in freeDiameter for freeDiameter/cnxctx.c


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

Backup before week-end, cnxctx and server in progress

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freeDiameter/cnxctx.c

    r20 r21  
    3636#include "fD.h"
    3737
    38 /* Initialize a connection context */
     38/* The connection context structure */
     39struct cnxctx {
     40        int             cc_socket;      /* The socket object of the connection -- <=0 if no socket is created */
     41       
     42        int             cc_proto;       /* IPPROTO_TCP or IPPROTO_SCTP */
     43        int             cc_tls;         /* Is TLS already started ? */
     44       
     45        struct fifo *   cc_events;      /* Events occuring on the connection */
     46        pthread_t       cc_mgr;         /* manager thread for the connection */
     47        struct fifo *   cc_incoming;    /* FIFO queue of messages received on the connection */
     48       
     49        uint16_t        cc_port;        /* Remote port of the connection, when we are client */
     50        struct fd_list  cc_ep_remote;   /* The remote address(es) of the connection */
     51        struct fd_list  cc_ep_local;    /* The local address(es) of the connection */
     52       
     53        /* If cc_proto == SCTP */
     54        struct  {
     55                int             str_out;/* Out streams */
     56                int             str_in; /* In streams */
     57                int             pairs;  /* max number of pairs ( = min(in, out)) */
     58                int             next;   /* # of stream the next message will be sent to */
     59        }               cc_sctp_para;
     60       
     61        /* If cc_tls == true */
     62        struct {
     63                int                              mode;          /* GNUTLS_CLIENT / GNUTLS_SERVER */
     64                gnutls_session_t                 session;       /* Session object (stream #0 in case of SCTP) */
     65        }               cc_tls_para;
     66       
     67        /* If both conditions */
     68        struct {
     69                gnutls_session_t                *res_sessions;  /* Sessions of other pairs of streams, resumed from the first */
     70                /* Buffers, threads, ... */
     71        }               cc_sctp_tls_para;
     72};
     73
     74
     75/* Initialize a context structure from a socket */
    3976struct cnxctx * fd_cnx_init(int sock, int proto)
    4077{
     
    66103}
    67104
    68 /* TLS handshake the connection */
     105/* Start receving messages in clear (no TLS) on the connection */
     106int fd_cnx_start_clear(struct cnxctx * conn)
     107{
     108       
     109        TODO("...");
     110        return ENOTSUP;
     111}
     112
     113/* TLS handshake a connection; no need to have called start_clear before. Reception is active if handhsake is successful */
    69114int fd_cnx_handshake(struct cnxctx * conn, int mode)
    70115{
     
    142187        return 0;
    143188}
     189
     190/* Retrieve TLS credentials of the remote peer, after handshake */
     191int fd_cnx_getcred(struct cnxctx * conn, const gnutls_datum_t **cert_list, unsigned int *cert_list_size)
     192{
     193       
     194        TODO("...");
     195        return ENOTSUP;
     196}
     197
     198/* Get the list of endpoints (IP addresses) of the remote peer on this object */
     199int fd_cnx_getendpoints(struct cnxctx * conn, struct fd_list * senti)
     200{
     201       
     202        TODO("...");
     203        return ENOTSUP;
     204}
     205
     206
     207/* Get a string describing the remote peer address (ip address or fqdn) */
     208char * fd_cnx_getremoteid(struct cnxctx * conn)
     209{
     210       
     211        TODO("...");
     212        return NULL;
     213}
     214
     215
     216/* Receive next message. if timeout is not NULL, wait only until timeout */
     217int fd_cnx_receive(struct cnxctx * conn, struct timespec * timeout, unsigned char **buf, size_t * len)
     218{
     219       
     220        TODO("...");
     221        return ENOTSUP;
     222}
     223
     224
     225/* Send a message */
     226int fd_cnx_send(struct cnxctx * conn, unsigned char * buf, size_t len)
     227{
     228       
     229        TODO("...");
     230        return ENOTSUP;
     231}
     232
     233
     234/* Destroy a conn structure, and shutdown the socket */
     235void fd_cnx_destroy(struct cnxctx * conn)
     236{
     237       
     238        TODO("...");
     239        return;
     240}
     241
     242
     243
     244
Note: See TracChangeset for help on using the changeset viewer.