Skip to content
This repository was archived by the owner on Aug 11, 2020. It is now read-only.

deps: update ngtcp2 #276

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 78 additions & 2 deletions deps/ngtcp2/lib/includes/ngtcp2/ngtcp2.h
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,8 @@ typedef struct ngtcp2_vec {
*
* `ngtcp2_cid_init` initializes Connection ID |cid| with the byte
* string pointed by |data| and its length is |datalen|. |datalen|
* must be at least :enum:`NGTCP2_MIN_CDLEN`, and at most
* :enum:`NGTCP2_MAX_CDLEN`.
* must be at least :enum:`NGTCP2_MIN_CIDLEN`, and at most
* :enum:`NGTCP2_MAX_CIDLEN`.
*/
NGTCP2_EXTERN void ngtcp2_cid_init(ngtcp2_cid *cid, const uint8_t *data,
size_t datalen);
Expand Down Expand Up @@ -1403,6 +1403,37 @@ typedef int (*ngtcp2_select_preferred_addr)(ngtcp2_conn *conn,
const ngtcp2_preferred_addr *paddr,
void *user_data);

typedef enum ngtcp2_connection_id_status_type {
/* NGTCP2_CONNECTION_ID_STATUS_TYPE_ACTIVATE indicates that a local
endpoint starts using new destination Connection ID. */
NGTCP2_CONNECTION_ID_STATUS_TYPE_ACTIVATE,
/* NGTCP2_CONNECTION_ID_STATUS_TYPE_DEACTIVATE indicates that a
local endpoint stops using a given destination Connection ID. */
NGTCP2_CONNECTION_ID_STATUS_TYPE_DEACTIVATE
} ngtcp2_connection_id_status_type;

/**
* @functypedef
*
* :type:`ngtcp2_connection_id_status` is a callback function which is
* called when the status of Connection ID changes.
*
* |token| is the associated stateless reset token and it is NULL if
* no token is present.
*
* |type| is the one of the value defined in
* :enum:`ngtcp2_connection_id_status_type`. The new value might be
* added in the future release.
*
* The callback function must return 0 if it succeeds. Returning
* :enum:`NGTCP2_ERR_CALLBACK_FAILURE` makes the library call return
* immediately.
*/
typedef int (*ngtcp2_connection_id_status)(ngtcp2_conn *conn, int type,
uint64_t seq, const ngtcp2_cid *cid,
const uint8_t *token,
void *user_data);

typedef struct ngtcp2_conn_callbacks {
/**
* client_initial is a callback function which is invoked when
Expand Down Expand Up @@ -1571,6 +1602,12 @@ typedef struct ngtcp2_conn_callbacks {
* is increased. This callback function is optional.
*/
ngtcp2_extend_max_stream_data extend_max_stream_data;
/**
* dcid_status is a callback function which is invoked when the new
* destination Connection ID is activated or the activated
* destination Connection ID is now deactivated.
*/
ngtcp2_connection_id_status dcid_status;
} ngtcp2_conn_callbacks;

/*
Expand Down Expand Up @@ -2350,6 +2387,45 @@ NGTCP2_EXTERN size_t ngtcp2_conn_get_num_scid(ngtcp2_conn *conn);
*/
NGTCP2_EXTERN size_t ngtcp2_conn_get_scid(ngtcp2_conn *conn, ngtcp2_cid *dest);

/**
* @function
*
* `ngtcp2_conn_get_num_active_dcid` returns the number of the active
* destination connection ID.
*/
NGTCP2_EXTERN size_t ngtcp2_conn_get_num_active_dcid(ngtcp2_conn *conn);

/**
* @struct
*
* :type:`ngtcp2_cid_token` is the convenient struct to store
* Connection ID, its associated path, and stateless reset token.
*/
typedef struct ngtcp2_cid_token {
/* seq is the sequence number of this Connection ID. */
uint64_t seq;
/* cid is Connection ID. */
ngtcp2_cid cid;
/* ps is the path which is associated to this Connection ID. */
ngtcp2_path_storage ps;
/* token is the stateless reset token for this Connection ID. */
uint8_t token[NGTCP2_STATELESS_RESET_TOKENLEN];
/* token_resent is nonzero if token contains stateless reset
token. */
uint8_t token_present;
} ngtcp2_cid_token;

/**
* @function
*
* `ngtcp2_conn_get_active_dcid` writes the all active destination
* connection IDs and tokens to |dest|. The buffer pointed by |dest|
* must have ``sizeof(ngtcp2_cid_token) * n`` bytes available, where n
* is the return value of `ngtcp2_conn_get_num_active_dcid()`.
*/
NGTCP2_EXTERN size_t ngtcp2_conn_get_active_dcid(ngtcp2_conn *conn,
ngtcp2_cid_token *dest);

/**
* @function
*
Expand Down
90 changes: 45 additions & 45 deletions deps/ngtcp2/lib/includes/ngtcp2/version.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
/*
* ngtcp2
*
* Copyright (c) 2016 ngtcp2 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VERSION_H
#define VERSION_H

/**
* @macro
*
* Version number of the ngtcp2 library release.
*/
#define NGTCP2_VERSION "0.1.90"

/**
* @macro
*
* Numerical representation of the version number of the ngtcp2
* library release. This is a 24 bit number with 8 bits for major
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
#define NGTCP2_VERSION_NUM 0x00015a

#endif /* VERSION_H */
/*
* ngtcp2
*
* Copyright (c) 2016 ngtcp2 contributors
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef VERSION_H
#define VERSION_H
/**
* @macro
*
* Version number of the ngtcp2 library release.
*/
#define NGTCP2_VERSION "0.1.90"
/**
* @macro
*
* Numerical representation of the version number of the ngtcp2
* library release. This is a 24 bit number with 8 bits for major
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
#define NGTCP2_VERSION_NUM 0x00015a
#endif /* VERSION_H */
8 changes: 8 additions & 0 deletions deps/ngtcp2/lib/ngtcp2_cid.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ void ngtcp2_dcid_copy(ngtcp2_dcid *dest, const ngtcp2_dcid *src) {
dest->ts_retired = src->ts_retired;
}

void ngtcp2_dcid_copy_no_path(ngtcp2_dcid *dest, const ngtcp2_dcid *src) {
dest->seq = src->seq;
dest->cid = src->cid;
memcpy(dest->token, src->token, NGTCP2_STATELESS_RESET_TOKENLEN);

dest->ts_retired = src->ts_retired;
}

int ngtcp2_dcid_verify_uniqueness(ngtcp2_dcid *dcid, uint64_t seq,
const ngtcp2_cid *cid, const uint8_t *token) {

Expand Down
6 changes: 6 additions & 0 deletions deps/ngtcp2/lib/ngtcp2_cid.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ void ngtcp2_dcid_init(ngtcp2_dcid *dcid, uint64_t seq, const ngtcp2_cid *cid,
*/
void ngtcp2_dcid_copy(ngtcp2_dcid *dest, const ngtcp2_dcid *src);

/*
* ngtcp2_dcid_copy_no_path behaves like ngtcp2_dcid_copy, but it does
* not copy path.
*/
void ngtcp2_dcid_copy_no_path(ngtcp2_dcid *dest, const ngtcp2_dcid *src);

/*
* ngtcp2_dcid_verify_uniqueness verifies uniqueness of (|seq|, |cid|,
* |token|) tuple against |dcid|.
Expand Down
Loading