]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
extensions: type renamed to id for clarity
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 11 Sep 2017 07:50:58 +0000 (09:50 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 19 Feb 2018 14:29:33 +0000 (15:29 +0100)
We were previously using the variable named 'type' to indicate the
extension ID. With TLS 1.3, extensions are also given an applicability
type (which message the extension applies to), and thus renamed the
variable for clarity.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
20 files changed:
lib/ext/alpn.c
lib/ext/dumbfw.c
lib/ext/ecc.c
lib/ext/etm.c
lib/ext/ext_master_secret.c
lib/ext/heartbeat.c
lib/ext/key_share.c
lib/ext/max_record.c
lib/ext/post_handshake.c
lib/ext/safe_renegotiation.c
lib/ext/server_name.c
lib/ext/session_ticket.c
lib/ext/signature.c
lib/ext/srp.c
lib/ext/srtp.c
lib/ext/status_request.c
lib/ext/supported_versions.c
lib/extensions.c
lib/extensions.h
lib/gnutls_int.h

index d5f7c45500e381d3d84384aa0552a491e605fe60..3f222bec3d4ea319b013f21b1cd765f42146fe7a 100644 (file)
@@ -36,7 +36,7 @@ static void _gnutls_alpn_deinit_data(gnutls_ext_priv_data_t priv);
 
 const extension_entry_st ext_mod_alpn = {
        .name = "ALPN",
-       .type = GNUTLS_EXTENSION_ALPN,
+       .id = GNUTLS_EXTENSION_ALPN,
        /* this extension must be parsed even on resumption */
        .parse_type = GNUTLS_EXT_MANDATORY,
 
index e210f962426c05313cce2f588aa9393574ce81f6..bdf4109e8423e13d087b0384d39f9b4527bd6641 100644 (file)
@@ -37,7 +37,7 @@ static int _gnutls_dumbfw_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_dumbfw = {
        .name = "ClientHello Padding",
-       .type = GNUTLS_EXTENSION_DUMBFW,
+       .id = GNUTLS_EXTENSION_DUMBFW,
        .parse_type = GNUTLS_EXT_APPLICATION,
 
        .recv_func = NULL,
index d7e66dbd858033163b41f359f8e18ab4aaca1724..9b71689ae182de7248a854eeafec527db973a462 100644 (file)
@@ -51,7 +51,7 @@ static int _gnutls_supported_ecc_pf_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_supported_ecc = {
        .name = "Negotiated Groups",
-       .type = GNUTLS_EXTENSION_SUPPORTED_ECC,
+       .id = GNUTLS_EXTENSION_SUPPORTED_ECC,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_supported_ecc_recv_params,
@@ -64,7 +64,7 @@ const extension_entry_st ext_mod_supported_ecc = {
 
 const extension_entry_st ext_mod_supported_ecc_pf = {
        .name = "Supported ECC Point Formats",
-       .type = GNUTLS_EXTENSION_SUPPORTED_ECC_PF,
+       .id = GNUTLS_EXTENSION_SUPPORTED_ECC_PF,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_supported_ecc_pf_recv_params,
index 342d6676a8f409cf27af23d6009f93f37a7ce51f..49360e3d50511b91ec570e49159a621c7b885951 100644 (file)
@@ -37,7 +37,7 @@ static int _gnutls_ext_etm_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_etm = {
        .name = "Encrypt-then-MAC",
-       .type = GNUTLS_EXTENSION_ETM,
+       .id = GNUTLS_EXTENSION_ETM,
        .parse_type = GNUTLS_EXT_MANDATORY,
 
        .recv_func = _gnutls_ext_etm_recv_params,
index b25c468961184a989c33c1112e459823327934b3..4712d3227357b36ed1726aafa9a070ad325329c0 100644 (file)
@@ -37,7 +37,7 @@ static int _gnutls_ext_master_secret_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_ext_master_secret = {
        .name = "Extended Master Secret",
-       .type = GNUTLS_EXTENSION_EXT_MASTER_SECRET,
+       .id = GNUTLS_EXTENSION_EXT_MASTER_SECRET,
        .parse_type = GNUTLS_EXT_MANDATORY,
 
        .recv_func = _gnutls_ext_master_secret_recv_params,
index 15c7c47f753032d93c4b5824c516f3e584810c58..23676a6c79c61cf4bbed6fcf1c0b5044fdb0e99d 100644 (file)
@@ -524,7 +524,7 @@ _gnutls_heartbeat_unpack(gnutls_buffer_st * ps,
 
 const extension_entry_st ext_mod_heartbeat = {
        .name = "Heartbeat",
-       .type = GNUTLS_EXTENSION_HEARTBEAT,
+       .id = GNUTLS_EXTENSION_HEARTBEAT,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_heartbeat_recv_params,
index 71593e83b551a017e8f6958696c783877a523097..2a7dc0e5a47d4688e7f637e7f87aa201c2388452 100644 (file)
@@ -45,7 +45,7 @@ static int key_share_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_key_share = {
        .name = "Key Share",
-       .type = GNUTLS_EXTENSION_KEY_SHARE,
+       .id = GNUTLS_EXTENSION_KEY_SHARE,
        .parse_type = _GNUTLS_EXT_TLS_POST_CS,
 
        .recv_func = key_share_recv_params,
index 79ab598bf165db7c3c1db7e533dbd75c2ae2fb5e..2ced8fd0a7ba46a6a037c4dc1036e397191657c1 100644 (file)
@@ -49,7 +49,7 @@ static int _gnutls_mre_record2num(uint16_t record_size);
 
 const extension_entry_st ext_mod_max_record_size = {
        .name = "Maximum Record Size",
-       .type = GNUTLS_EXTENSION_MAX_RECORD_SIZE,
+       .id = GNUTLS_EXTENSION_MAX_RECORD_SIZE,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_max_record_recv_params,
index f69c75e71c385925cad2b305d855983d0617af47..ba788d6b8f148df616a925f9e7ca4116b3d80ac6 100644 (file)
@@ -38,7 +38,7 @@ static int _gnutls_post_handshake_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_post_handshake = {
        .name = "Post Handshake Auth",
-       .type = GNUTLS_EXTENSION_POST_HANDSHAKE,
+       .id = GNUTLS_EXTENSION_POST_HANDSHAKE,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_post_handshake_recv_params,
index 764309380bd24857a4360dea87811f4af43caf1a..f8083cf095082eeb729780abfa068fe613a146f0 100644 (file)
@@ -33,7 +33,7 @@ static void _gnutls_sr_deinit_data(gnutls_ext_priv_data_t priv);
 
 const extension_entry_st ext_mod_sr = {
        .name = "Safe Renegotiation",
-       .type = GNUTLS_EXTENSION_SAFE_RENEGOTIATION,
+       .id = GNUTLS_EXTENSION_SAFE_RENEGOTIATION,
        .parse_type = GNUTLS_EXT_MANDATORY,
 
        .recv_func = _gnutls_sr_recv_params,
index b2e1286e0e98dc7adcb8e63254b6739f44bb38ac..bf8d00fa092e4f72b22e422f8a7d3d072f2ab6b6 100644 (file)
@@ -47,7 +47,7 @@ _gnutls_server_name_set_raw(gnutls_session_t session,
 
 const extension_entry_st ext_mod_server_name = {
        .name = "Server Name Indication",
-       .type = GNUTLS_EXTENSION_SERVER_NAME,
+       .id = GNUTLS_EXTENSION_SERVER_NAME,
        .parse_type = GNUTLS_EXT_MANDATORY,
 
        .recv_func = _gnutls_server_name_recv_params,
index 2e6d00bc5366f4ae0e73de9480e288a0c5bdb527..c3a3c29d8cbd2423e4b487a5b7be6e81b230d04a 100644 (file)
@@ -61,7 +61,7 @@ static void session_ticket_deinit_data(gnutls_ext_priv_data_t priv);
 
 const extension_entry_st ext_mod_session_ticket = {
        .name = "Session Ticket",
-       .type = GNUTLS_EXTENSION_SESSION_TICKET,
+       .id = GNUTLS_EXTENSION_SESSION_TICKET,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = session_ticket_recv_params,
index 16d37cec94aa0aa4d690eb4de51d0c5210e9a90e..992d2abac21f9cd96e4146ca65fbb5a738568ad7 100644 (file)
@@ -51,7 +51,7 @@ static int signature_algorithms_unpack(gnutls_buffer_st * ps,
 
 const extension_entry_st ext_mod_sig = {
        .name = "Signature Algorithms",
-       .type = GNUTLS_EXTENSION_SIGNATURE_ALGORITHMS,
+       .id = GNUTLS_EXTENSION_SIGNATURE_ALGORITHMS,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_signature_algorithm_recv_params,
index 113f5f234fa1477017107ce2940391f5e4cfe05a..31fcb68f1252073624ee01a5f8135ad0c0ee6a0b 100644 (file)
@@ -44,7 +44,7 @@ static int _gnutls_srp_send_params(gnutls_session_t state,
 
 const extension_entry_st ext_mod_srp = {
        .name = "SRP",
-       .type = GNUTLS_EXTENSION_SRP,
+       .id = GNUTLS_EXTENSION_SRP,
        .parse_type = GNUTLS_EXT_TLS,
 
        .recv_func = _gnutls_srp_recv_params,
index d9516bd0f43168e9ce86a74f6904e3d3433bd199..f915af25ac4fcc4a095c4039b9b91532580ae744 100644 (file)
@@ -41,7 +41,7 @@ static void _gnutls_srtp_deinit_data(gnutls_ext_priv_data_t priv);
 
 const extension_entry_st ext_mod_srtp = {
        .name = "SRTP",
-       .type = GNUTLS_EXTENSION_SRTP,
+       .id = GNUTLS_EXTENSION_SRTP,
        .parse_type = GNUTLS_EXT_APPLICATION,
 
        .recv_func = _gnutls_srtp_recv_params,
index f07ca7d4b9d0c6df201493199fe20517973e2111..0454320dfc9dda236e1a351158ff847427ae82a7 100644 (file)
@@ -531,7 +531,7 @@ _gnutls_status_request_unpack(gnutls_buffer_st * ps,
 
 const extension_entry_st ext_mod_status_request = {
        .name = "OCSP Status Request",
-       .type = GNUTLS_EXTENSION_STATUS_REQUEST,
+       .id = GNUTLS_EXTENSION_STATUS_REQUEST,
        .parse_type = _GNUTLS_EXT_TLS_POST_CS,
        .recv_func = _gnutls_status_request_recv_params,
        .send_func = _gnutls_status_request_send_params,
index 8204c7d77e9a1607a85bf20ccc8c83c6e249341f..39a69674d0a6414e4c07661db6b6d81a6d786ed9 100644 (file)
@@ -38,7 +38,7 @@ static int supported_versions_send_params(gnutls_session_t session,
 
 const extension_entry_st ext_mod_supported_versions = {
        .name = "Supported Versions",
-       .type = GNUTLS_EXTENSION_SUPPORTED_VERSIONS,
+       .id = GNUTLS_EXTENSION_SUPPORTED_VERSIONS,
        .parse_type = GNUTLS_EXT_MANDATORY, /* force parsing prior to EXT_TLS extensions */
 
        .recv_func = supported_versions_recv_params,
index 7c3e8296817a1961db04a3c79166ed571c9e9f25..618469dc134a6c425528e9b241a4e165ab031cfb 100644 (file)
@@ -92,20 +92,20 @@ static extension_entry_st const *extfunc[MAX_EXT_TYPES+1] = {
 };
 
 static const extension_entry_st *
-_gnutls_ext_ptr(gnutls_session_t session, uint16_t type, gnutls_ext_parse_type_t parse_type)
+_gnutls_ext_ptr(gnutls_session_t session, uint16_t id, gnutls_ext_parse_type_t parse_type)
 {
        unsigned i;
        const extension_entry_st *e;
 
        for (i=0;i<session->internals.rexts_size;i++) {
-               if (session->internals.rexts[i].type == type) {
+               if (session->internals.rexts[i].id == id) {
                        e = &session->internals.rexts[i];
                        goto done;
                }
        }
 
        for (i = 0; extfunc[i] != NULL; i++) {
-               if (extfunc[i]->type == type) {
+               if (extfunc[i]->id == id) {
                        e = extfunc[i];
                        goto done;
                }
@@ -135,23 +135,23 @@ const char *gnutls_ext_get_name(unsigned int ext)
        size_t i;
 
        for (i = 0; extfunc[i] != NULL; i++)
-               if (extfunc[i]->type == ext)
+               if (extfunc[i]->id == ext)
                        return extfunc[i]->name;
 
        return NULL;
 }
 
-/* Checks if the extension @type provided has been requested
+/* Checks if the extension @id provided has been requested
  * by us (in client side). In that case it returns zero, 
  * otherwise a negative error value.
  */
 int
-_gnutls_extension_list_check(gnutls_session_t session, uint16_t type)
+_gnutls_extension_list_check(gnutls_session_t session, uint16_t id)
 {
        unsigned i;
 
        for (i = 0; i < session->internals.used_exts_size; i++) {
-               if (type == session->internals.used_exts[i]->type)
+               if (id == session->internals.used_exts[i]->id)
                        return 0;
        }
 
@@ -173,7 +173,7 @@ static unsigned _gnutls_extension_list_add(gnutls_session_t session, const struc
 
        if (check_dup) {
                for (i=0;i<session->internals.used_exts_size;i++) {
-                       if (session->internals.used_exts[i]->type == e->type)
+                       if (session->internals.used_exts[i]->id == e->id)
                                return 0;
                }
        }
@@ -204,7 +204,7 @@ _gnutls_parse_extensions(gnutls_session_t session,
 {
        int next, ret;
        int pos = 0;
-       uint16_t type;
+       uint16_t id;
        const uint8_t *sdata;
        const extension_entry_st *ext;
        uint16_t size;
@@ -225,14 +225,14 @@ _gnutls_parse_extensions(gnutls_session_t session,
 
        do {
                DECR_LENGTH_RET(next, 2, GNUTLS_E_UNEXPECTED_EXTENSIONS_LENGTH);
-               type = _gnutls_read_uint16(&data[pos]);
+               id = _gnutls_read_uint16(&data[pos]);
                pos += 2;
 
                if (session->security_parameters.entity == GNUTLS_CLIENT) {
                        if ((ret =
-                            _gnutls_extension_list_check(session, type)) < 0) {
+                            _gnutls_extension_list_check(session, id)) < 0) {
                                _gnutls_debug_log("EXT[%p]: Received unexpected extension '%s/%d'\n", session,
-                                               gnutls_ext_get_name(type), (int)type);
+                                               gnutls_ext_get_name(id), (int)id);
                                gnutls_assert();
                                return ret;
                        }
@@ -246,11 +246,11 @@ _gnutls_parse_extensions(gnutls_session_t session,
                sdata = &data[pos];
                pos += size;
 
-               ext = _gnutls_ext_ptr(session, type, parse_type);
+               ext = _gnutls_ext_ptr(session, id, parse_type);
                if (ext == NULL || ext->recv_func == NULL) {
                        _gnutls_handshake_log
                            ("EXT[%p]: Ignoring extension '%s/%d'\n", session,
-                            gnutls_ext_get_name(type), type);
+                            gnutls_ext_get_name(id), id);
 
                        continue;
                }
@@ -263,7 +263,7 @@ _gnutls_parse_extensions(gnutls_session_t session,
 
                _gnutls_handshake_log
                    ("EXT[%p]: Parsing extension '%s/%d' (%d bytes)\n",
-                    session, gnutls_ext_get_name(type), type,
+                    session, gnutls_ext_get_name(id), id,
                     size);
 
                if ((ret = ext->recv_func(session, sdata, size)) < 0) {
@@ -297,7 +297,7 @@ int send_extension(gnutls_session_t session, const extension_entry_st *p,
 
        /* ensure we don't send something twice (i.e, overriden extensions in
         * client), and ensure we are sending only what we received in server. */
-       ret = _gnutls_extension_list_check(session, p->type);
+       ret = _gnutls_extension_list_check(session, p->id);
 
        if (session->security_parameters.entity == GNUTLS_SERVER) {
                if (ret < 0) /* not advertized */
@@ -307,7 +307,7 @@ int send_extension(gnutls_session_t session, const extension_entry_st *p,
                        return 0;
        }
 
-       ret = _gnutls_buffer_append_prefix(extdata, 16, p->type);
+       ret = _gnutls_buffer_append_prefix(extdata, 16, p->id);
        if (ret < 0)
                return gnutls_assert_val(ret);
 
@@ -439,10 +439,10 @@ static int pack_extension(gnutls_session_t session, const extension_entry_st *ex
        int rval = 0;
 
        ret =
-           _gnutls_ext_get_session_data(session, extp->type,
+           _gnutls_ext_get_session_data(session, extp->id,
                                         &data);
        if (ret >= 0 && extp->pack_func != NULL) {
-               BUFFER_APPEND_NUM(packed, extp->type);
+               BUFFER_APPEND_NUM(packed, extp->id);
 
                size_offset = packed->length;
                BUFFER_APPEND_NUM(packed, 0);
@@ -490,22 +490,22 @@ int _gnutls_ext_pack(gnutls_session_t session, gnutls_buffer_st *packed)
 
 static void
 _gnutls_ext_set_resumed_session_data(gnutls_session_t session,
-                                    uint16_t type,
+                                    uint16_t id,
                                     gnutls_ext_priv_data_t data)
 {
        int i;
        const struct extension_entry_st *ext;
 
-       ext = _gnutls_ext_ptr(session, type, GNUTLS_EXT_ANY);
+       ext = _gnutls_ext_ptr(session, id, GNUTLS_EXT_ANY);
 
        for (i = 0; i < MAX_EXT_TYPES; i++) {
-               if (session->internals.ext_data[i].type == type
+               if (session->internals.ext_data[i].id == id
                    || (!session->internals.ext_data[i].resumed_set && !session->internals.ext_data[i].set)) {
 
                        if (session->internals.ext_data[i].resumed_set != 0)
                                unset_resumed_ext_data(session, ext, i);
 
-                       session->internals.ext_data[i].type = type;
+                       session->internals.ext_data[i].id = id;
                        session->internals.ext_data[i].resumed_priv = data;
                        session->internals.ext_data[i].resumed_set = 1;
                        return;
@@ -518,18 +518,18 @@ int _gnutls_ext_unpack(gnutls_session_t session, gnutls_buffer_st * packed)
        int i, ret;
        gnutls_ext_priv_data_t data;
        int max_exts = 0;
-       uint16_t type;
-       int size_for_type, cur_pos;
+       uint16_t id;
+       int size_for_id, cur_pos;
        const struct extension_entry_st *ext;
 
        BUFFER_POP_NUM(packed, max_exts);
        for (i = 0; i < max_exts; i++) {
-               BUFFER_POP_NUM(packed, type);
-               BUFFER_POP_NUM(packed, size_for_type);
+               BUFFER_POP_NUM(packed, id);
+               BUFFER_POP_NUM(packed, size_for_id);
 
                cur_pos = packed->length;
 
-               ext = _gnutls_ext_ptr(session, type, GNUTLS_EXT_ANY);
+               ext = _gnutls_ext_ptr(session, id, GNUTLS_EXT_ANY);
                if (ext == NULL || ext->unpack_func == NULL) {
                        gnutls_assert();
                        return GNUTLS_E_PARSING_ERROR;
@@ -543,12 +543,12 @@ int _gnutls_ext_unpack(gnutls_session_t session, gnutls_buffer_st * packed)
 
                /* verify that unpack read the correct bytes */
                cur_pos = cur_pos - packed->length;
-               if (cur_pos /* read length */  != size_for_type) {
+               if (cur_pos /* read length */  != size_for_id) {
                        gnutls_assert();
                        return GNUTLS_E_PARSING_ERROR;
                }
 
-               _gnutls_ext_set_resumed_session_data(session, type, data);
+               _gnutls_ext_set_resumed_session_data(session, id, data);
        }
 
        return 0;
@@ -570,15 +570,15 @@ unset_ext_data(gnutls_session_t session, const struct extension_entry_st *ext, u
 
 void
 _gnutls_ext_unset_session_data(gnutls_session_t session,
-                               uint16_t type)
+                               uint16_t id)
 {
        int i;
        const struct extension_entry_st *ext;
 
-       ext = _gnutls_ext_ptr(session, type, GNUTLS_EXT_ANY);
+       ext = _gnutls_ext_ptr(session, id, GNUTLS_EXT_ANY);
 
        for (i = 0; i < MAX_EXT_TYPES; i++) {
-               if (session->internals.ext_data[i].type == type) {
+               if (session->internals.ext_data[i].id == id) {
                        unset_ext_data(session, ext, i);
                        return;
                }
@@ -607,7 +607,7 @@ void _gnutls_ext_free_session_data(gnutls_session_t session)
                if (!session->internals.ext_data[i].set && !session->internals.ext_data[i].resumed_set)
                        continue;
 
-               ext = _gnutls_ext_ptr(session, session->internals.ext_data[i].type, GNUTLS_EXT_ANY);
+               ext = _gnutls_ext_ptr(session, session->internals.ext_data[i].id, GNUTLS_EXT_ANY);
 
                unset_ext_data(session, ext, i);
                unset_resumed_ext_data(session, ext, i);
@@ -619,22 +619,22 @@ void _gnutls_ext_free_session_data(gnutls_session_t session)
  * private pointer, to allow API additions by individual extensions.
  */
 void
-_gnutls_ext_set_session_data(gnutls_session_t session, uint16_t type,
+_gnutls_ext_set_session_data(gnutls_session_t session, uint16_t id,
                             gnutls_ext_priv_data_t data)
 {
        unsigned int i;
        const struct extension_entry_st *ext;
 
-       ext = _gnutls_ext_ptr(session, type, GNUTLS_EXT_ANY);
+       ext = _gnutls_ext_ptr(session, id, GNUTLS_EXT_ANY);
 
        for (i = 0; i < MAX_EXT_TYPES; i++) {
-               if (session->internals.ext_data[i].type == type ||
+               if (session->internals.ext_data[i].id == id ||
                    (!session->internals.ext_data[i].set && !session->internals.ext_data[i].resumed_set)) {
 
                        if (session->internals.ext_data[i].set != 0) {
                                unset_ext_data(session, ext, i);
                        }
-                       session->internals.ext_data[i].type = type;
+                       session->internals.ext_data[i].id = id;
                        session->internals.ext_data[i].priv = data;
                        session->internals.ext_data[i].set = 1;
                        return;
@@ -644,13 +644,13 @@ _gnutls_ext_set_session_data(gnutls_session_t session, uint16_t type,
 
 int
 _gnutls_ext_get_session_data(gnutls_session_t session,
-                            uint16_t type, gnutls_ext_priv_data_t * data)
+                            uint16_t id, gnutls_ext_priv_data_t * data)
 {
        int i;
 
        for (i = 0; i < MAX_EXT_TYPES; i++) {
                if (session->internals.ext_data[i].set != 0 &&
-                   session->internals.ext_data[i].type == type)
+                   session->internals.ext_data[i].id == id)
                {
                        *data =
                            session->internals.ext_data[i].priv;
@@ -662,14 +662,14 @@ _gnutls_ext_get_session_data(gnutls_session_t session,
 
 int
 _gnutls_ext_get_resumed_session_data(gnutls_session_t session,
-                                    uint16_t type,
+                                    uint16_t id,
                                     gnutls_ext_priv_data_t * data)
 {
        int i;
 
        for (i = 0; i < MAX_EXT_TYPES; i++) {
                if (session->internals.ext_data[i].resumed_set != 0
-                   && session->internals.ext_data[i].type == type) {
+                   && session->internals.ext_data[i].id == id) {
                        *data =
                            session->internals.ext_data[i].resumed_priv;
                        return 0;
@@ -681,7 +681,7 @@ _gnutls_ext_get_resumed_session_data(gnutls_session_t session,
 /**
  * gnutls_ext_register:
  * @name: the name of the extension to register
- * @type: the numeric id of the extension
+ * @id: the numeric id of the extension
  * @parse_type: the parse type of the extension (see gnutls_ext_parse_type_t)
  * @recv_func: a function to receive the data
  * @send_func: a function to send the data
@@ -704,7 +704,7 @@ _gnutls_ext_get_resumed_session_data(gnutls_session_t session,
  * Since: 3.4.0
  **/
 int 
-gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_type,
+gnutls_ext_register(const char *name, int id, gnutls_ext_parse_type_t parse_type,
                    gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, 
                    gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func,
                    gnutls_ext_unpack_func unpack_func)
@@ -714,7 +714,7 @@ gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_ty
        unsigned i;
 
        for (i = 0; extfunc[i] != NULL; i++) {
-               if (extfunc[i]->type == type)
+               if (extfunc[i]->id == id)
                        return gnutls_assert_val(GNUTLS_E_ALREADY_REGISTERED);
        }
 
@@ -724,7 +724,7 @@ gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_ty
 
        tmp_mod->name = gnutls_strdup(name);
        tmp_mod->free_struct = 1;
-       tmp_mod->type = type;
+       tmp_mod->id = id;
        tmp_mod->parse_type = parse_type;
        tmp_mod->recv_func = recv_func;
        tmp_mod->send_func = send_func;
@@ -744,7 +744,7 @@ gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_ty
  * gnutls_session_ext_register:
  * @session: the session for which this extension will be set
  * @name: the name of the extension to register
- * @type: the numeric id of the extension
+ * @id: the numeric id of the extension
  * @parse_type: the parse type of the extension (see gnutls_ext_parse_type_t)
  * @recv_func: a function to receive the data
  * @send_func: a function to send the data
@@ -772,7 +772,7 @@ gnutls_ext_register(const char *name, int type, gnutls_ext_parse_type_t parse_ty
  **/
 int 
 gnutls_session_ext_register(gnutls_session_t session,
-                           const char *name, int type, gnutls_ext_parse_type_t parse_type,
+                           const char *name, int id, gnutls_ext_parse_type_t parse_type,
                            gnutls_ext_recv_func recv_func, gnutls_ext_send_func send_func, 
                            gnutls_ext_deinit_data_func deinit_func, gnutls_ext_pack_func pack_func,
                            gnutls_ext_unpack_func unpack_func, unsigned flags)
@@ -784,7 +784,7 @@ gnutls_session_ext_register(gnutls_session_t session,
        /* reject handling any extensions which modify the TLS handshake
         * in any way, or are mapped to an exported API. */
        for (i = 0; extfunc[i] != NULL; i++) {
-               if (extfunc[i]->type == type) {
+               if (extfunc[i]->id == id) {
                        if (!(flags & GNUTLS_EXT_FLAG_OVERRIDE_INTERNAL)) {
                                return gnutls_assert_val(GNUTLS_E_ALREADY_REGISTERED);
                        } else if (extfunc[i]->cannot_be_overriden) {
@@ -796,7 +796,7 @@ gnutls_session_ext_register(gnutls_session_t session,
 
        memset(&tmp_mod, 0, sizeof(extension_entry_st));
        tmp_mod.free_struct = 1;
-       tmp_mod.type = type;
+       tmp_mod.id = id;
        tmp_mod.parse_type = parse_type;
        tmp_mod.recv_func = recv_func;
        tmp_mod.send_func = send_func;
@@ -820,7 +820,7 @@ gnutls_session_ext_register(gnutls_session_t session,
 /**
  * gnutls_ext_set_data:
  * @session: a #gnutls_session_t opaque pointer
- * @type: the numeric id of the extension
+ * @id: the numeric id of the extension
  * @data: the private data to set
  *
  * This function allows an extension handler to store data in the current session
@@ -830,16 +830,16 @@ gnutls_session_ext_register(gnutls_session_t session,
  * Since: 3.4.0
  **/
 void
-gnutls_ext_set_data(gnutls_session_t session, unsigned type,
+gnutls_ext_set_data(gnutls_session_t session, unsigned id,
                    gnutls_ext_priv_data_t data)
 {
-       _gnutls_ext_set_session_data(session, type, data);
+       _gnutls_ext_set_session_data(session, id, data);
 }
 
 /**
  * gnutls_ext_get_data:
  * @session: a #gnutls_session_t opaque pointer
- * @type: the numeric id of the extension
+ * @id: the numeric id of the extension
  * @data: a pointer to the private data to retrieve
  *
  * This function retrieves any data previously stored with gnutls_ext_set_data().
@@ -850,7 +850,7 @@ gnutls_ext_set_data(gnutls_session_t session, unsigned type,
  **/
 int
 gnutls_ext_get_data(gnutls_session_t session,
-                   unsigned type, gnutls_ext_priv_data_t *data)
+                   unsigned id, gnutls_ext_priv_data_t *data)
 {
-       return _gnutls_ext_get_session_data(session, type, data);
+       return _gnutls_ext_get_session_data(session, id, data);
 }
index bc3154c180d8ecd592aa6fbf07df1ab789abb609..0cc2ab47be929c851c6856632c4ec9b8d11fe454 100644 (file)
@@ -60,7 +60,7 @@ typedef struct extension_entry_st {
        const char *name; /* const overriden when free_struct is set */
        unsigned free_struct;
 
-       uint16_t type;
+       uint16_t id;
        gnutls_ext_parse_type_t parse_type;
 
        /* this function must return 0 when Not Applicable
index 8bd1df3163d34714d4049d8960eb0527e3e005cb..b970da289a5bbadf1a36afe8911784aed765817e 100644 (file)
@@ -1119,7 +1119,7 @@ typedef struct {
        unsigned rexts_size;
 
        struct {
-               uint16_t type;
+               uint16_t id;
                gnutls_ext_priv_data_t priv;
                gnutls_ext_priv_data_t resumed_priv;
                uint8_t set;