xref: /freebsd/crypto/openssl/util/perl/TLSProxy/NextProto.pm (revision b64c5a0ace59af62eff52bfe110a521dc73c937b)
1# Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
2#
3# Licensed under the Apache License 2.0 (the "License").  You may not use
4# this file except in compliance with the License.  You can obtain a copy
5# in the file LICENSE in the source distribution or at
6# https://www.openssl.org/source/license.html
7
8use strict;
9
10package TLSProxy::NextProto;
11
12use vars '@ISA';
13push @ISA, 'TLSProxy::Message';
14
15sub new
16{
17    my $class = shift;
18    my ($server,
19        $data,
20        $records,
21        $startoffset,
22        $message_frag_lens) = @_;
23
24    my $self = $class->SUPER::new(
25        $server,
26        TLSProxy::Message::MT_NEXT_PROTO,
27        $data,
28        $records,
29        $startoffset,
30        $message_frag_lens);
31
32    return $self;
33}
34
35sub parse
36{
37    # We don't support parsing at the moment
38}
39
40# This is supposed to reconstruct the on-the-wire message data following changes.
41# For now though since we don't support parsing we just create an empty NextProto
42# message - this capability is used in test_npn
43sub set_message_contents
44{
45    my $self = shift;
46    my $data;
47
48    $data = pack("C32", 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
49                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
50                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
51                 0x00, 0x00, 0x00);
52    $self->data($data);
53}
541;
55