picoquic/tls_api.c
int picoquic_client_save_ticket_call_back(ptls_save_ticket_t* save_ticket_ctx,
    ptls_t* tls, ptls_iovec_t input)
{
    int ret = 0;
    picoquic_quic_t* quic = *((picoquic_quic_t**)(((char*)save_ticket_ctx) + sizeof(ptls_save_ticket_t)));
    const char* sni = ptls_get_server_name(tls);
    const char* alpn = ptls_get_negotiated_protocol(tls);
    picoquic_cnx_t * cnx = (picoquic_cnx_t *)*ptls_get_data_ptr(tls);

    if (alpn == NULL && quic != NULL) {
        alpn = quic->default_alpn;
    }

    if (sni != NULL && alpn != NULL) {
        ret = picoquic_store_ticket(&quic->p_first_ticket, 0, sni, (uint16_t)strlen(sni),
            alpn, (uint16_t)strlen(alpn), input.base, (uint16_t)input.len, &cnx->remote_parameters);
    } else {
        DBG_PRINTF("Received incorrect session resume ticket, sni = %s, alpn = %s, length = %d\n",
            (sni == NULL) ? "NULL" : sni, (alpn == NULL) ? "NULL" : alpn, (int)input.len);
    }

    return ret;
}
/*
 * The client signals its willingness to receive session resume tickets by providing
 * the "save ticket" callback in the client's quic context.
 */
The client signals its willingness to receive session resume tickets by providing
the "save ticket" callback in the client's quic context.
The client signals its willingness to receive session resume tickets by providing the " save ticket " callback in the client ' s quic context .
int picoquic_client_save_ticket_call_back(ptls_save_ticket_t* save_ticket_ctx,
    ptls_t* tls, ptls_iovec_t input)
{
    int ret = 0;
    picoquic_quic_t* quic = *((picoquic_quic_t**)(((char*)save_ticket_ctx) + sizeof(ptls_save_ticket_t)));
    const char* sni = ptls_get_server_name(tls);
    const char* alpn = ptls_get_negotiated_protocol(tls);
    picoquic_cnx_t * cnx = (picoquic_cnx_t *)*ptls_get_data_ptr(tls);
    if (alpn == NULL && quic != NULL) {
        alpn = quic->default_alpn;
    }
    if (sni != NULL && alpn != NULL) {
        ret = picoquic_store_ticket(&quic->p_first_ticket, 0, sni, (uint16_t)strlen(sni),
            alpn, (uint16_t)strlen(alpn), input.base, (uint16_t)input.len, &cnx->remote_parameters);
    } else {
        DBG_PRINTF("Received incorrect session resume ticket, sni = %s, alpn = %s, length = %d\n",
            (sni == NULL) ? "NULL" : sni, (alpn == NULL) ? "NULL" : alpn, (int)input.len);
    }
    return ret;
}
int picoquic_client_save_ticket_call_back ( ptls_save_ticket_t * save_ticket_ctx , ptls_t * tls , ptls_iovec_t input ) { int ret = 0 ; picoquic_quic_t * quic = * ( ( picoquic_quic_t * * ) ( ( ( char * ) save_ticket_ctx ) + sizeof ( ptls_save_ticket_t ) ) ) ; const char * sni = ptls_get_server_name ( tls ) ; const char * alpn = ptls_get_negotiated_protocol ( tls ) ; picoquic_cnx_t * cnx = ( picoquic_cnx_t * ) * ptls_get_data_ptr ( tls ) ; if ( alpn == NULL && quic != NULL ) { alpn = quic -> default_alpn ; } if ( sni != NULL && alpn != NULL ) { ret = picoquic_store_ticket ( & quic -> p_first_ticket , 0 , sni , ( uint16_t ) strlen ( sni ) , alpn , ( uint16_t ) strlen ( alpn ) , input . base , ( uint16_t ) input . len , & cnx -> remote_parameters ) ; } else { DBG_PRINTF ( " \n " , ( sni == NULL ) ? " " : sni , ( alpn == NULL ) ? " " : alpn , ( int ) input . len ) ; } return ret ; }
The client signals its willingness to receive session resume tickets by providing
 the "save ticket" callback in the client's quic context.
The client signals its willingness to receive session resume tickets by providing the " save ticket " callback in the client ' s quic context .