aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/security/cert/PKIXCertPathValidatorResult.java
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2004-07-11 14:32:49 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2004-07-11 14:32:49 +0000
commit06a67bdd66ac806bea322b14f4e94fd03ad444f2 (patch)
treed42a31e10870dfca2e30938ea3e93da70534df8d /libjava/java/security/cert/PKIXCertPathValidatorResult.java
parente08b5a758a9dec2bf31df677b2da9345ca791044 (diff)
downloadgcc-06a67bdd66ac806bea322b14f4e94fd03ad444f2.zip
gcc-06a67bdd66ac806bea322b14f4e94fd03ad444f2.tar.gz
gcc-06a67bdd66ac806bea322b14f4e94fd03ad444f2.tar.bz2
rs6000.c (struct processor_costs): Change semantics of fields to include the COST_N_INSNS scaling...
* rs6000.c (struct processor_costs): Change semantics of fields to include the COST_N_INSNS scaling, and update all initializers. (rs6000_rtx_costs): Don't use COSTS_N_INSNS on rs6000_cost fields. Use COSTS_N_INSNS(1) for NOT, SIGN_EXTEND, ZERO_EXTEND and COMPARE. Use rs6000_cost->fp for both FLOAT_TRUNCATE and UNSPEC_FRSP. When optimizing for size, use COSTS_N_INSNS(1) for CALL and IF_THEN_ELSE. From-SVN: r84512
Diffstat (limited to 'libjava/java/security/cert/PKIXCertPathValidatorResult.java')
0 files changed, 0 insertions, 0 deletions
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784
/*
* Copyright 2022-2023 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License").  You may not use
* this file except in compliance with the License.  You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/

#ifndef OSSL_INTERNAL_QUIC_WIRE_H
# define OSSL_INTERNAL_QUIC_WIRE_H
# pragma once

# include "internal/e_os.h"
# include "internal/time.h"
# include "internal/quic_types.h"
# include "internal/packet_quic.h"

# ifndef OPENSSL_NO_QUIC

#  define OSSL_QUIC_FRAME_TYPE_PADDING                0x00
#  define OSSL_QUIC_FRAME_TYPE_PING                   0x01
#  define OSSL_QUIC_FRAME_TYPE_ACK_WITHOUT_ECN        0x02
#  define OSSL_QUIC_FRAME_TYPE_ACK_WITH_ECN           0x03
#  define OSSL_QUIC_FRAME_TYPE_RESET_STREAM           0x04
#  define OSSL_QUIC_FRAME_TYPE_STOP_SENDING           0x05
#  define OSSL_QUIC_FRAME_TYPE_CRYPTO                 0x06
#  define OSSL_QUIC_FRAME_TYPE_NEW_TOKEN              0x07
#  define OSSL_QUIC_FRAME_TYPE_MAX_DATA               0x10
#  define OSSL_QUIC_FRAME_TYPE_MAX_STREAM_DATA        0x11
#  define OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_BIDI       0x12
#  define OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_UNI        0x13
#  define OSSL_QUIC_FRAME_TYPE_DATA_BLOCKED           0x14
#  define OSSL_QUIC_FRAME_TYPE_STREAM_DATA_BLOCKED    0x15
#  define OSSL_QUIC_FRAME_TYPE_STREAMS_BLOCKED_BIDI   0x16
#  define OSSL_QUIC_FRAME_TYPE_STREAMS_BLOCKED_UNI    0x17
#  define OSSL_QUIC_FRAME_TYPE_NEW_CONN_ID            0x18
#  define OSSL_QUIC_FRAME_TYPE_RETIRE_CONN_ID         0x19
#  define OSSL_QUIC_FRAME_TYPE_PATH_CHALLENGE         0x1A
#  define OSSL_QUIC_FRAME_TYPE_PATH_RESPONSE          0x1B
#  define OSSL_QUIC_FRAME_TYPE_CONN_CLOSE_TRANSPORT   0x1C
#  define OSSL_QUIC_FRAME_TYPE_CONN_CLOSE_APP         0x1D
#  define OSSL_QUIC_FRAME_TYPE_HANDSHAKE_DONE         0x1E

#  define OSSL_QUIC_FRAME_FLAG_STREAM_FIN         0x01
#  define OSSL_QUIC_FRAME_FLAG_STREAM_LEN         0x02
#  define OSSL_QUIC_FRAME_FLAG_STREAM_OFF         0x04
#  define OSSL_QUIC_FRAME_FLAG_STREAM_MASK        ((uint64_t)0x07)

/* Low 3 bits of the type contain flags */
#  define OSSL_QUIC_FRAME_TYPE_STREAM             0x08             /* base ID */
#  define OSSL_QUIC_FRAME_TYPE_STREAM_FIN         \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_FIN)
#  define OSSL_QUIC_FRAME_TYPE_STREAM_LEN         \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_LEN)
#  define OSSL_QUIC_FRAME_TYPE_STREAM_LEN_FIN     \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_LEN |            \
     OSSL_QUIC_FRAME_FLAG_STREAM_FIN)
#  define OSSL_QUIC_FRAME_TYPE_STREAM_OFF         \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_OFF)
#  define OSSL_QUIC_FRAME_TYPE_STREAM_OFF_FIN     \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_OFF |            \
     OSSL_QUIC_FRAME_FLAG_STREAM_FIN)
#  define OSSL_QUIC_FRAME_TYPE_STREAM_OFF_LEN     \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_OFF |            \
     OSSL_QUIC_FRAME_FLAG_STREAM_LEN)
#  define OSSL_QUIC_FRAME_TYPE_STREAM_OFF_LEN_FIN \
    (OSSL_QUIC_FRAME_TYPE_STREAM |                \
     OSSL_QUIC_FRAME_FLAG_STREAM_OFF |            \
     OSSL_QUIC_FRAME_FLAG_STREAM_LEN |            \
     OSSL_QUIC_FRAME_FLAG_STREAM_FIN)

#  define OSSL_QUIC_FRAME_TYPE_IS_STREAM(x) \
    (((x) & ~OSSL_QUIC_FRAME_FLAG_STREAM_MASK) == OSSL_QUIC_FRAME_TYPE_STREAM)
#  define OSSL_QUIC_FRAME_TYPE_IS_ACK(x) \
    (((x) & ~(uint64_t)1) == OSSL_QUIC_FRAME_TYPE_ACK_WITHOUT_ECN)
#  define OSSL_QUIC_FRAME_TYPE_IS_MAX_STREAMS(x) \
    (((x) & ~(uint64_t)1) == OSSL_QUIC_FRAME_TYPE_MAX_STREAMS_BIDI)
#  define OSSL_QUIC_FRAME_TYPE_IS_STREAMS_BLOCKED(x) \
    (((x) & ~(uint64_t)1) == OSSL_QUIC_FRAME_TYPE_STREAMS_BLOCKED_BIDI)
#  define OSSL_QUIC_FRAME_TYPE_IS_CONN_CLOSE(x) \
    (((x) & ~(uint64_t)1) == OSSL_QUIC_FRAME_TYPE_CONN_CLOSE_TRANSPORT)

const char *ossl_quic_frame_type_to_string(uint64_t frame_type);

static ossl_unused ossl_inline int
ossl_quic_frame_type_is_ack_eliciting(uint64_t frame_type)
{
    switch (frame_type) {
    case OSSL_QUIC_FRAME_TYPE_PADDING:
    case OSSL_QUIC_FRAME_TYPE_ACK_WITHOUT_ECN:
    case OSSL_QUIC_FRAME_TYPE_ACK_WITH_ECN:
    case OSSL_QUIC_FRAME_TYPE_CONN_CLOSE_TRANSPORT:
    case OSSL_QUIC_FRAME_TYPE_CONN_CLOSE_APP:
        return 0;
    default:
        return 1;
    }
}

/* QUIC Transport Parameter Types */
#  define QUIC_TPARAM_ORIG_DCID                           0x00
#  define QUIC_TPARAM_MAX_IDLE_TIMEOUT                    0x01
#  define QUIC_TPARAM_STATELESS_RESET_TOKEN               0x02
#  define QUIC_TPARAM_MAX_UDP_PAYLOAD_SIZE                0x03
#  define QUIC_TPARAM_INITIAL_MAX_DATA                    0x04
#  define QUIC_TPARAM_INITIAL_MAX_STREAM_DATA_BIDI_LOCAL  0x05
#  define QUIC_TPARAM_INITIAL_MAX_STREAM_DATA_BIDI_REMOTE 0x06
#  define QUIC_TPARAM_INITIAL_MAX_STREAM_DATA_UNI         0x07
#  define QUIC_TPARAM_INITIAL_MAX_STREAMS_BIDI            0x08
#  define QUIC_TPARAM_INITIAL_MAX_STREAMS_UNI             0x09
#  define QUIC_TPARAM_ACK_DELAY_EXP                       0x0A
#  define QUIC_TPARAM_MAX_ACK_DELAY                       0x0B
#  define QUIC_TPARAM_DISABLE_ACTIVE_MIGRATION            0x0C
#  define QUIC_TPARAM_PREFERRED_ADDR                      0x0D
#  define QUIC_TPARAM_ACTIVE_CONN_ID_LIMIT                0x0E
#  define QUIC_TPARAM_INITIAL_SCID                        0x0F
#  define QUIC_TPARAM_RETRY_SCID                          0x10

/*
 * QUIC Frame Logical Representations
 * ==================================
 */

/* QUIC Frame: ACK */
typedef struct ossl_quic_ack_range_st {
    /*
     * Represents an inclusive range of packet numbers [start, end].
     * start must be <= end.
     */
    QUIC_PN start, end;
} OSSL_QUIC_ACK_RANGE;

typedef struct ossl_quic_frame_ack_st {
    /*
     * A sequence of packet number ranges [[start, end]...].
     *
     * The ranges must be sorted in descending order, for example:
     *      [ 95, 100]
     *      [ 90,  92]
     *      etc.
     *
     * As such, ack_ranges[0].end is always the highest packet number
     * being acknowledged and ack_ranges[num_ack_ranges-1].start is
     * always the lowest packet number being acknowledged.
     *
     * num_ack_ranges must be greater than zero, as an ACK frame must
     * acknowledge at least one packet number.
     */
    OSSL_QUIC_ACK_RANGE        *ack_ranges;
    size_t                      num_ack_ranges;

    OSSL_TIME                   delay_time;
    uint64_t                    ect0, ect1, ecnce;
    unsigned int                ecn_present : 1;
} OSSL_QUIC_FRAME_ACK;

/* Returns 1 if the given frame contains the given PN. */
int ossl_quic_frame_ack_contains_pn(const OSSL_QUIC_FRAME_ACK *ack, QUIC_PN pn);

/* QUIC Frame: STREAM */
typedef struct ossl_quic_frame_stream_st {
    uint64_t                stream_id;  /* Stream ID */
    uint64_t                offset;     /* Logical offset in stream */
    uint64_t                len;        /* Length of data in bytes */
    const unsigned char    *data;

    /*
     * On encode, this determines whether the len field should be encoded or
     * not. If zero, the len field is not encoded and it is assumed the frame
     * runs to the end of the packet.
     *
     * On decode, this determines whether the frame had an explicitly encoded
     * length. If not set, the frame runs to the end of the packet and len has
     * been set accordingly.
     */
    unsigned int            has_explicit_len : 1;

    /* 1 if this is the end of the stream */
    unsigned int            is_fin : 1;
} OSSL_QUIC_FRAME_STREAM;

/* QUIC Frame: CRYPTO */
typedef struct ossl_quic_frame_crypto_st {
    uint64_t                offset; /* Logical offset in stream */
    uint64_t                len;    /* Length of the data in bytes */
    const unsigned char    *data;
} OSSL_QUIC_FRAME_CRYPTO;

/* QUIC Frame: RESET_STREAM */
typedef struct ossl_quic_frame_reset_stream_st {
    uint64_t    stream_id;
    uint64_t    app_error_code;
    uint64_t    final_size;
} OSSL_QUIC_FRAME_RESET_STREAM;

/* QUIC Frame: STOP_SENDING */
typedef struct ossl_quic_frame_stop_sending_st {
    uint64_t    stream_id;
    uint64_t    app_error_code;
} OSSL_QUIC_FRAME_STOP_SENDING;

/* QUIC Frame: NEW_CONNECTION_ID */
typedef struct ossl_quic_frame_new_conn_id_st {
    uint64_t                    seq_num;
    uint64_t                    retire_prior_to;
    QUIC_CONN_ID                conn_id;
    QUIC_STATELESS_RESET_TOKEN  stateless_reset;
} OSSL_QUIC_FRAME_NEW_CONN_ID;

/* QUIC Frame: CONNECTION_CLOSE */
typedef struct ossl_quic_frame_conn_close_st {
    unsigned int    is_app : 1; /* 0: transport error, 1: app error */
    uint64_t        error_code; /* 62-bit transport or app error code */
    uint64_t        frame_type; /* transport errors only */
    char            *reason;    /* UTF-8 string, not necessarily zero-terminated */
    size_t          reason_len; /* Length of reason in bytes */
} OSSL_QUIC_FRAME_CONN_CLOSE;

/*
 * QUIC Wire Format Encoding
 * =========================
 *
 * These functions return 1 on success and 0 on failure.
 */

/*
 * Encodes zero or more QUIC PADDING frames to the packet writer. Each PADDING
 * frame consumes one byte; num_bytes specifies the number of bytes of padding
 * to write.
 */
int ossl_quic_wire_encode_padding(WPACKET *pkt, size_t num_bytes);

/*
 * Encodes a QUIC PING frame to the packet writer. This frame type takes
 * no arguments.
*/
int ossl_quic_wire_encode_frame_ping(WPACKET *pkt);

/*
 * Encodes a QUIC ACK frame to the packet writer, given a logical representation
 * of the ACK frame.
 *
 * The ACK ranges passed must be sorted in descending order.
 *
 * The logical representation stores a list of packet number ranges. The wire
 * encoding is slightly different and stores the first range in the list
 * in a different manner.
 *
 * The ack_delay_exponent argument specifies the index of a power of two by
 * which the ack->ack_delay field is be divided. This exponent value must match
 * the value used when decoding.
 */
int ossl_quic_wire_encode_frame_ack(WPACKET *pkt,
                                    uint32_t ack_delay_exponent,
                                    const OSSL_QUIC_FRAME_ACK *ack);

/*
 * Encodes a QUIC RESET_STREAM frame to the packet writer, given a logical
 * representation of the RESET_STREAM frame.
 */
int ossl_quic_wire_encode_frame_reset_stream(WPACKET *pkt,
                                             const OSSL_QUIC_FRAME_RESET_STREAM *f);

/*
 * Encodes a QUIC STOP_SENDING frame to the packet writer, given a logical
 * representation of the STOP_SENDING frame.
 */
int ossl_quic_wire_encode_frame_stop_sending(WPACKET *pkt,
                                             const OSSL_QUIC_FRAME_STOP_SENDING *f);

/*
 * Encodes a QUIC CRYPTO frame header to the packet writer.
 *
 * To create a well-formed frame, the data written using this function must be
 * immediately followed by f->len bytes of data.
 */
int ossl_quic_wire_encode_frame_crypto_hdr(WPACKET *hdr,
                                           const OSSL_QUIC_FRAME_CRYPTO *f);

/*
 * Returns the number of bytes which will be required to encode the given
 * CRYPTO frame header. Does not include the payload bytes in the count.
 * Returns 0 if input is invalid.
 */
size_t ossl_quic_wire_get_encoded_frame_len_crypto_hdr(const OSSL_QUIC_FRAME_CRYPTO *f);

/*
 * Encodes a QUIC CRYPTO frame to the packet writer.
 *
 * This function returns a pointer to a buffer of f->len bytes which the caller
 * should fill however it wishes. If f->data is non-NULL, it is automatically
 * copied to the target buffer, otherwise the caller must fill the returned
 * buffer. Returns NULL on failure.
 */
void *ossl_quic_wire_encode_frame_crypto(WPACKET *pkt,
                                         const OSSL_QUIC_FRAME_CRYPTO *f);

/*
 * Encodes a QUIC NEW_TOKEN frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_new_token(WPACKET *pkt,
                                          const unsigned char *token,
                                          size_t token_len);

/*
 * Encodes a QUIC STREAM frame's header to the packet writer. The f->stream_id,
 * f->offset and f->len fields are the values for the respective Stream ID,
 * Offset and Length fields.
 *
 * If f->is_fin is non-zero, the frame is marked as the final frame in the
 * stream.
 *
 * If f->has_explicit_len is zerro, the frame is assumed to be the final frame
 * in the packet, which the caller is responsible for ensuring; the Length
 * field is then omitted.
 *
 * To create a well-formed frame, the data written using this function must be
 * immediately followed by f->len bytes of stream data.
 */
int ossl_quic_wire_encode_frame_stream_hdr(WPACKET *pkt,
                                           const OSSL_QUIC_FRAME_STREAM *f);

/*
 * Returns the number of bytes which will be required to encode the given
 * STREAM frame header. Does not include the payload bytes in the count.
 * Returns 0 if input is invalid.
 */
size_t ossl_quic_wire_get_encoded_frame_len_stream_hdr(const OSSL_QUIC_FRAME_STREAM *f);

/*
 * Functions similarly to ossl_quic_wire_encode_frame_stream_hdr, but it also
 * allocates space for f->len bytes of data after the header, creating a
 * well-formed QUIC STREAM frame in one call.
 *
 * A pointer to the bytes allocated for the framme payload is returned,
 * which the caller can fill however it wishes. If f->data is non-NULL,
 * it is automatically copied to the target buffer, otherwise the caller
 * must fill the returned buffer. Returns NULL on failure.
 */
void *ossl_quic_wire_encode_frame_stream(WPACKET *pkt,
                                         const OSSL_QUIC_FRAME_STREAM *f);

/*
 * Encodes a QUIC MAX_DATA frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_max_data(WPACKET *pkt,
                                         uint64_t max_data);

/*
 * Encodes a QUIC MAX_STREAM_DATA frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_max_stream_data(WPACKET *pkt,
                                                uint64_t stream_id,
                                                uint64_t max_data);

/*
 * Encodes a QUIC MAX_STREAMS frame to the packet writer.
 *
 * If is_uni is 0, the count specifies the maximum number of
 * bidirectional streams; else it specifies the maximum number of unidirectional
 * streams.
 */
int ossl_quic_wire_encode_frame_max_streams(WPACKET *pkt,
                                            char     is_uni,
                                            uint64_t max_streams);

/*
 * Encodes a QUIC DATA_BLOCKED frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_data_blocked(WPACKET *pkt,
                                             uint64_t max_data);

/*
 * Encodes a QUIC STREAM_DATA_BLOCKED frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_stream_data_blocked(WPACKET *pkt,
                                                    uint64_t stream_id,
                                                    uint64_t max_stream_data);
/*
 * Encodes a QUIC STREAMS_BLOCKED frame to the packet writer.
 *
 * If is_uni is 0, the count specifies the maximum number of
 * bidirectional streams; else it specifies the maximum number of unidirectional
 * streams.
 */
int ossl_quic_wire_encode_frame_streams_blocked(WPACKET *pkt,
                                                char is_uni,
                                                uint64_t max_streams);

/*
 * Encodes a QUIC NEW_CONNECTION_ID frame to the packet writer, given a logical
 * representation of the NEW_CONNECTION_ID frame.
 *
 * The buffer pointed to by the conn_id field must be valid for the duration of
 * the call.
 */
int ossl_quic_wire_encode_frame_new_conn_id(WPACKET *pkt,
                                            const OSSL_QUIC_FRAME_NEW_CONN_ID *f);

/*
 * Encodes a QUIC RETIRE_CONNECTION_ID frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_retire_conn_id(WPACKET *pkt,
                                               uint64_t seq_num);

/*
 * Encodes a QUIC PATH_CHALLENGE frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_path_challenge(WPACKET *pkt,
                                               uint64_t data);

/*
 * Encodes a QUIC PATH_RESPONSE frame to the packet writer.
 */
int ossl_quic_wire_encode_frame_path_response(WPACKET *pkt,
                                              uint64_t data);

/*
 * Encodes a QUIC CONNECTION_CLOSE frame to the packet writer, given a logical
 * representation of the CONNECTION_CLOSE frame.
 *
 * The reason field may be NULL, in which case no reason is encoded. If the
 * reason field is non-NULL, it must point to a valid UTF-8 string and
 * reason_len must be set to the length of the reason string in bytes. The
 * reason string need not be zero terminated.
 */
int ossl_quic_wire_encode_frame_conn_close(WPACKET *pkt,
                                           const OSSL_QUIC_FRAME_CONN_CLOSE *f);

/*
 * Encodes a QUIC HANDSHAKE_DONE frame to the packet writer. This frame type
 * takes no arguiments.
 */
int ossl_quic_wire_encode_frame_handshake_done(WPACKET *pkt);

/*
 * Encodes a QUIC transport parameter TLV with the given ID into the WPACKET.
 * The payload is an arbitrary buffer.
 *
 * If value is non-NULL, the value is copied into the packet.
 * If it is NULL, value_len bytes are allocated for the payload and the caller
 * should fill the buffer using the returned pointer.
 *
 * Returns a pointer to the start of the payload on success, or NULL on failure.
 */
unsigned char *ossl_quic_wire_encode_transport_param_bytes(WPACKET *pkt,
                                                           uint64_t id,
                                                           const unsigned char *value,
                                                           size_t value_len);

/*
 * Encodes a QUIC transport parameter TLV with the given ID into the WPACKET.
 * The payload is a QUIC variable-length integer with the given value.
 */
int ossl_quic_wire_encode_transport_param_int(WPACKET *pkt,
                                              uint64_t id,
                                              uint64_t value);

/*
 * Encodes a QUIC transport parameter TLV with a given ID into the WPACKET.
 * The payload is a QUIC connection ID.
 */