From: Nikos Mavrogiannopoulos Date: Sat, 12 Mar 2011 22:50:39 +0000 (+0100) Subject: _gnutls_is_dtls() is no more. IS_DTLS() is being used instead. X-Git-Tag: gnutls_2_99_0~127 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b79afae2425454bcf61afd7be243bf2b7b35e10c;p=thirdparty%2Fgnutls.git _gnutls_is_dtls() is no more. IS_DTLS() is being used instead. --- diff --git a/lib/gnutls_buffers.c b/lib/gnutls_buffers.c index 50ca2d7a06..725d4a154c 100644 --- a/lib/gnutls_buffers.c +++ b/lib/gnutls_buffers.c @@ -315,7 +315,7 @@ static ssize_t _gnutls_read (gnutls_session_t session, mbuffer_st **bufel, size_t size, gnutls_pull_func pull_func) { - if (_gnutls_is_dtls (session)) + if (IS_DTLS (session)) /* Size is not passed, since a whole datagram will be read. */ return _gnutls_dgram_read (session, bufel, pull_func); else @@ -482,7 +482,7 @@ _gnutls_io_read_buffered (gnutls_session_t session, size_t total, return 0; } - if(_gnutls_is_dtls(session)) + if(IS_DTLS(session)) ret = MIN(total, session->internals.record_recv_buffer.byte_length); else ret = session->internals.record_recv_buffer.byte_length; diff --git a/lib/gnutls_cipher.c b/lib/gnutls_cipher.c index 6225cb19b9..ccbbbf54bd 100644 --- a/lib/gnutls_cipher.c +++ b/lib/gnutls_cipher.c @@ -127,7 +127,7 @@ _gnutls_encrypt (gnutls_session_t session, const opaque * headers, /* copy the headers */ memcpy (ciphertext, headers, headers_size); - if(_gnutls_is_dtls(session)) + if(IS_DTLS(session)) _gnutls_write_uint16 (ret, &ciphertext[11]); else _gnutls_write_uint16 (ret, &ciphertext[3]); diff --git a/lib/gnutls_constate.c b/lib/gnutls_constate.c index 2ec6ab8ebd..1397af63aa 100644 --- a/lib/gnutls_constate.c +++ b/lib/gnutls_constate.c @@ -730,7 +730,7 @@ _gnutls_epoch_alloc (gnutls_session_t session, uint16_t epoch, (*slot)->mac_algorithm = GNUTLS_MAC_UNKNOWN; (*slot)->compression_algorithm = GNUTLS_COMP_UNKNOWN; - if (_gnutls_is_dtls (session)) + if (IS_DTLS (session)) _gnutls_write_uint16 (epoch, UINT64DATA((*slot)->write.sequence_number)); if (out != NULL) diff --git a/lib/gnutls_handshake.c b/lib/gnutls_handshake.c index 883e38a25e..1255999c69 100644 --- a/lib/gnutls_handshake.c +++ b/lib/gnutls_handshake.c @@ -513,7 +513,7 @@ _gnutls_read_client_hello (gnutls_session_t session, opaque * data, session->internals.resumed = RESUME_FALSE; } - if (_gnutls_is_dtls(session)) + if (IS_DTLS(session)) { int cookie_size; @@ -1197,7 +1197,7 @@ _gnutls_send_handshake (gnutls_session_t session, mbuffer_st * bufel, * fragmented later by the fragmentation sub-layer. All fields must * be set properly for HMAC. The HMAC requires we pretend that the * message was sent in a single fragment. */ - if (_gnutls_is_dtls(session)) + if (IS_DTLS(session)) { _gnutls_write_uint16 (session->internals.dtls.hsk_write_seq++, &data[pos]); pos += 2; @@ -1904,7 +1904,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) if (again == 0) { - if(_gnutls_is_dtls(session)) + if(IS_DTLS(session)) { cookie_len = session->internals.dtls.cookie_len + 1; } @@ -1974,7 +1974,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) /* Generate random data */ - if (!_gnutls_is_dtls (session) + if (!IS_DTLS (session) || session->internals.dtls.hsk_hello_verify_requests == 0) { _gnutls_tls_create_random (rnd); @@ -2001,7 +2001,7 @@ _gnutls_send_client_hello (gnutls_session_t session, int again) /* Copy the DTLS cookie */ - if (_gnutls_is_dtls(session)) + if (IS_DTLS(session)) { data[pos++] = session->internals.dtls.cookie_len; memcpy(&data[pos], &session->internals.dtls.cookie, session->internals.dtls.cookie_len); @@ -2228,7 +2228,7 @@ _gnutls_recv_hello_verify_request (gnutls_session_t session, uint8_t cookie_len; unsigned int nb_verifs; - if (!_gnutls_is_dtls (session) + if (!IS_DTLS (session) || session->security_parameters.entity == GNUTLS_SERVER) { gnutls_assert (); @@ -2660,7 +2660,7 @@ _gnutls_handshake_client (gnutls_session_t session) IMED_RET ("send hello", ret, 1); case STATE11: - if (_gnutls_is_dtls (session)) + if (IS_DTLS (session)) { ret = _gnutls_recv_handshake (session, diff --git a/lib/gnutls_record.c b/lib/gnutls_record.c index f721438f4b..cc259c4d05 100644 --- a/lib/gnutls_record.c +++ b/lib/gnutls_record.c @@ -307,7 +307,7 @@ inline static int sequence_increment (gnutls_session_t session, uint64 * value) { - if (_gnutls_is_dtls(session)) + if (IS_DTLS(session)) { return _gnutls_uint48pp(value); } diff --git a/lib/gnutls_state.h b/lib/gnutls_state.h index 0035bb528a..8132a2ffcd 100644 --- a/lib/gnutls_state.h +++ b/lib/gnutls_state.h @@ -74,16 +74,3 @@ int _gnutls_PRF (gnutls_session_t session, #define DEFAULT_CERT_TYPE GNUTLS_CRT_X509 -/*- - * _gnutls_is_dtls - Used to check whether this session uses DTLS. - * @session: is a #gnutls_session_t structure. - * - * This function will return non zero if this session uses DTLS. - * - -*/ -static inline -int -_gnutls_is_dtls (gnutls_session_t session) -{ - return session->internals.transport == GNUTLS_DGRAM; -}