NextProto.pm 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. use strict;
  8. package TLSProxy::NextProto;
  9. use vars '@ISA';
  10. push @ISA, 'TLSProxy::Message';
  11. sub new
  12. {
  13. my $class = shift;
  14. my ($isdtls,
  15. $server,
  16. $msgseq,
  17. $msgfrag,
  18. $msgfragoffs,
  19. $data,
  20. $records,
  21. $startoffset,
  22. $message_frag_lens) = @_;
  23. my $self = $class->SUPER::new(
  24. $isdtls,
  25. $server,
  26. TLSProxy::Message::MT_NEXT_PROTO,
  27. $msgseq,
  28. $msgfrag,
  29. $msgfragoffs,
  30. $data,
  31. $records,
  32. $startoffset,
  33. $message_frag_lens);
  34. return $self;
  35. }
  36. sub parse
  37. {
  38. # We don't support parsing at the moment
  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
  43. sub set_message_contents
  44. {
  45. my $self = shift;
  46. my $data;
  47. $data = pack("C32", 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  48. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  49. 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  50. 0x00, 0x00, 0x00);
  51. $self->data($data);
  52. }
  53. 1;