Mercurial > hg > freeDiameter-dtls
diff libfdcore/cnxctx.h @ 1217:1e8267ad057c
Implemented early version of sctp_dtls.c, for debug
author | Sebastien Decugis <sdecugis@freediameter.net> |
---|---|
date | Tue, 18 Jun 2013 12:46:01 +0800 |
parents | 76ac4bb75f0e |
children | 33ad82ffbdde |
line wrap: on
line diff
--- a/libfdcore/cnxctx.h Mon Jun 17 10:11:57 2013 +0800 +++ b/libfdcore/cnxctx.h Tue Jun 18 12:46:01 2013 +0800 @@ -76,11 +76,20 @@ uint16_t str_out; /* Out streams */ uint16_t str_in; /* In streams */ uint16_t pairs; /* max number of pairs ( = min(in, out)) */ - uint16_t next; /* # of stream the next message will be sent to */ + uint16_t next; /* # of the stream the next message will be sent to */ int unordered; /* boolean telling if use of streams > 0 is permitted */ } cc_sctp_para; + + /* For DTLS over SCTP */ + struct { + /* This structure will be changed if we implement a different algorithm to reassemble the messages */ + uint8_t nextseq[8]; /* the next sequence number we expect to be delivered to upper layer. Can be overwriten if a new epoch is received. */ + uint8_t validseq[8]; /* last seq number that was actually decrypted, so we can trust this value. */ + struct fd_list chunks; /* store the chunks with greater seq numbers received on SCTP socket for delayed delivery. */ + size_t offset; /* how much data of the current chunk has already been passed to gnutls */ + } cc_sctp_dtls_data; - /* If both conditions */ + /* For TLS over SCTP */ struct { struct sctp3436_ctx *array; /* an array of cc_sctp_para.pairs elements -- the #0 is special (session is outside)*/ struct sr_store *sess_store; /* Session data of the master session, to resume the children sessions */ @@ -100,11 +109,12 @@ void fd_cnx_s_setto(int sock); /* TLS */ -int fd_tls_rcvthr_core(struct cnxctx * conn, gnutls_session_t session); +int fd_tls_rcvthr_core(struct cnxctx * conn, gnutls_session_t session, int dtls); int fd_tls_prepare(gnutls_session_t * session, int mode, int dtls, char * priority, void * alt_creds); #ifndef GNUTLS_VERSION_300 int fd_tls_verify_credentials(gnutls_session_t session, struct cnxctx * conn, int verbose); #endif /* GNUTLS_VERSION_300 */ +ssize_t fd_tls_send_handle_error(struct cnxctx * conn, gnutls_session_t session, void * data, size_t sz); /* TCP */ int fd_tcp_create_bind_server( int * sock, sSA * sa, socklen_t salen ); @@ -127,6 +137,8 @@ /* DTLS over SCTP */ int fd_sctp_dtls_prepare(gnutls_session_t session); int fd_sctp_dtls_settransport(gnutls_session_t session, struct cnxctx * conn); +int fd_sctp_dtls_send(struct cnxctx * conn, unsigned char * buf, size_t len); +ssize_t fd_dtls_recv_handle_error(struct cnxctx * conn, gnutls_session_t session, void * data, size_t sz); void * fd_sctp_dtls_rcvthr(void * arg); /* TLS over SCTP (multi-stream) */