diff --git a/lib/includes/ngtcp2/ngtcp2.h b/lib/includes/ngtcp2/ngtcp2.h index b6463fd9b363bb9512a4fbed3d807c6e8dc4da65..b4e0f03297aff0074ce0c0d48a176c871022ea4b 100644 --- a/lib/includes/ngtcp2/ngtcp2.h +++ b/lib/includes/ngtcp2/ngtcp2.h @@ -154,14 +154,14 @@ NGTCP2_EXTERN int ngtcp2_framer_verify_integrity(ngtcp2_framer *fr, /** * @function * - * `ngtcp2_pkt_parse_hd` parses QUIC packet header included in |pkt| + * `ngtcp2_pkt_decode_hd` decodes QUIC packet header included in |pkt| * of length |pktlen|, and sotres the result in the object pointed by - * |dest|. This function can parse both long and short packet header. - * On success, if ``dest->flags & NGTCP2_PKT_FLAG_LONG_FORM`` is - * nonzero, the packet header has long form. + * |dest|. This function can decode both long and short packet + * header. On success, if ``dest->flags & NGTCP2_PKT_FLAG_LONG_FORM`` + * is nonzero, the packet header has long form. * * This function returns the exact number of bytes to be read in order - * to parse packet header, or one of the following negative error + * to decode packet header, or one of the following negative error * codes: * * :enum:`NGTCP2_ERR_INVALID_ARGUMENT` @@ -169,13 +169,13 @@ NGTCP2_EXTERN int ngtcp2_framer_verify_integrity(ngtcp2_framer *fr, * :enum:`NGTCP2_ERR_UNKNOWN_PKT_TYPE` * Packet type is unknown */ -NGTCP2_EXTERN ssize_t ngtcp2_pkt_parse_hd(ngtcp2_pkt_hd *dest, - const uint8_t *pkt, size_t pktlen); +NGTCP2_EXTERN ssize_t ngtcp2_pkt_decode_hd(ngtcp2_pkt_hd *dest, + const uint8_t *pkt, size_t pktlen); -NGTCP2_EXTERN ssize_t ngtcp2_framer_parse_pkt_payload(ngtcp2_framer *fr, - ngtcp2_frame **dest, - const uint8_t *payload, - size_t payloadlen); +NGTCP2_EXTERN ssize_t ngtcp2_framer_decode_pkt_payload(ngtcp2_framer *fr, + ngtcp2_frame **dest, + const uint8_t *payload, + size_t payloadlen); NGTCP2_EXTERN int ngtcp2_framer_pkt_start_protected(ngtcp2_framer *fr, const ngtcp2_pkt_hd *hd, diff --git a/lib/ngtcp2_pkt.c b/lib/ngtcp2_pkt.c index 4233f99a66eb98b7f36efe92c51f54b496497004..bbd73e8b99b998b2f427d30dd73c1d81c231374d 100644 --- a/lib/ngtcp2_pkt.c +++ b/lib/ngtcp2_pkt.c @@ -25,21 +25,21 @@ #include "ngtcp2_pkt.h" #include "ngtcp2_conv.h" -ssize_t ngtcp2_pkt_parse_hd(ngtcp2_pkt_hd *dest, const uint8_t *pkt, - size_t pktlen) { +ssize_t ngtcp2_pkt_decode_hd(ngtcp2_pkt_hd *dest, const uint8_t *pkt, + size_t pktlen) { if (pktlen == 0) { return NGTCP2_ERR_INVALID_ARGUMENT; } if (pkt[0] & NGTCP2_HEADER_FORM_MASK) { - return ngtcp2_pkt_parse_hd_long(dest, pkt, pktlen); + return ngtcp2_pkt_decode_hd_long(dest, pkt, pktlen); } - return ngtcp2_pkt_parse_hd_short(dest, pkt, pktlen); + return ngtcp2_pkt_decode_hd_short(dest, pkt, pktlen); } -ssize_t ngtcp2_pkt_parse_hd_long(ngtcp2_pkt_hd *dest, const uint8_t *pkt, - size_t pktlen) { +ssize_t ngtcp2_pkt_decode_hd_long(ngtcp2_pkt_hd *dest, const uint8_t *pkt, + size_t pktlen) { uint8_t type; if (pktlen < 17) { @@ -75,8 +75,8 @@ ssize_t ngtcp2_pkt_parse_hd_long(ngtcp2_pkt_hd *dest, const uint8_t *pkt, return 17; } -ssize_t ngtcp2_pkt_parse_hd_short(ngtcp2_pkt_hd *dest, const uint8_t *pkt, - size_t pktlen) { +ssize_t ngtcp2_pkt_decode_hd_short(ngtcp2_pkt_hd *dest, const uint8_t *pkt, + size_t pktlen) { uint8_t flags = 0; uint8_t type; size_t len = 1; diff --git a/lib/ngtcp2_pkt.h b/lib/ngtcp2_pkt.h index ee1547abc889b48e3686dceaf9f9efdd5aa33b07..90735b3d68dc06b53ea8b664f556ec89d7703b11 100644 --- a/lib/ngtcp2_pkt.h +++ b/lib/ngtcp2_pkt.h @@ -38,9 +38,9 @@ #define NGTCP2_SHORT_TYPE_MASK 0x1f /* - * ngtcp2_pkt_parse_hd_long parses QUIC long packet header in |pkt| of - * length |pktlen|. It stores the result in the object pointed by - * |dest|, and returns the number of bytes parsed to read the packet + * ngtcp2_pkt_decode_hd_long decodes QUIC long packet header in |pkt| + * of length |pktlen|. It stores the result in the object pointed by + * |dest|, and returns the number of bytes decoded to read the packet * header if it succeeds, or one of the following error codes: * * NGTCP2_ERR_INVALID_ARGUMENT @@ -48,21 +48,22 @@ * NGTCP2_ERR_UNKNOWN_PKT_TYPE * Packet type is unknown */ -ssize_t ngtcp2_pkt_parse_hd_long(ngtcp2_pkt_hd *dest, const uint8_t *pkt, - size_t pktlen); +ssize_t ngtcp2_pkt_decode_hd_long(ngtcp2_pkt_hd *dest, const uint8_t *pkt, + size_t pktlen); /* - * ngtcp2_pkt_parse_hd_short parses QUIC short packet header in |pkt| - * of length |pktlen|. It stores the result in the object pointed by - * |dest|, and returns the number of bytes parsed to read the packet - * header if it succeeds, or one of the following error codes: + * ngtcp2_pkt_decode_hd_short decodes QUIC short packet header in + * |pkt| of length |pktlen|. It stores the result in the object + * pointed by |dest|, and returns the number of bytes decoded to read + * the packet header if it succeeds, or one of the following error + * codes: * * NGTCP2_ERR_INVALID_ARGUMENT * Packet is too short; or it is not a short header * NGTCP2_ERR_UNKNOWN_PKT_TYPE * Packet type is unknown */ -ssize_t ngtcp2_pkt_parse_hd_short(ngtcp2_pkt_hd *dest, const uint8_t *pkt, - size_t pktlen); +ssize_t ngtcp2_pkt_decode_hd_short(ngtcp2_pkt_hd *dest, const uint8_t *pkt, + size_t pktlen); #endif /* NGTCP2_PKT_H */ diff --git a/tests/main.c b/tests/main.c index e48e493d6a3aa79f974064200b4f7ed56d486c5a..4cc2819980d398e9c40ce95760fbd736bf3694cf 100644 --- a/tests/main.c +++ b/tests/main.c @@ -53,8 +53,8 @@ int main() { } /* add the tests to the suite */ - if (!CU_add_test(pSuite, "pkt_parse_hd_long", - test_ngtcp2_pkt_parse_hd_long)) { + if (!CU_add_test(pSuite, "pkt_decode_hd_long", + test_ngtcp2_pkt_decode_hd_long)) { CU_cleanup_registry(); return CU_get_error(); } diff --git a/tests/ngtcp2_pkt_test.c b/tests/ngtcp2_pkt_test.c index 400f4defbd4939510c36ef39661b5e45213a0468..37e1a49015b6ee4e1be29624125fafed48e8e107 100644 --- a/tests/ngtcp2_pkt_test.c +++ b/tests/ngtcp2_pkt_test.c @@ -28,4 +28,4 @@ #include "ngtcp2_pkt.h" -void test_ngtcp2_pkt_parse_hd_long(void) {} +void test_ngtcp2_pkt_decode_hd_long(void) {} diff --git a/tests/ngtcp2_pkt_test.h b/tests/ngtcp2_pkt_test.h index 045ba07eb63fdade664ccb1d183b072ed838eb85..8729cea288a993a6d22b665c088874dd762afbd4 100644 --- a/tests/ngtcp2_pkt_test.h +++ b/tests/ngtcp2_pkt_test.h @@ -29,6 +29,6 @@ #include <config.h> #endif /* HAVE_CONFIG_H */ -void test_ngtcp2_pkt_parse_hd_long(void); +void test_ngtcp2_pkt_decode_hd_long(void); #endif /* NGTCP2_PKT_TEST_H */