callbacks.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* callbacks.h
  2. *
  3. * Copyright (C) 2006-2017 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL.
  6. *
  7. * wolfSSL is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License as published by
  9. * the Free Software Foundation; either version 2 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * wolfSSL is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
  20. */
  21. #ifndef WOLFSSL_CALLBACKS_H
  22. #define WOLFSSL_CALLBACKS_H
  23. #include <wolfssl/wolfcrypt/wc_port.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. enum { /* CALLBACK CONTSTANTS */
  28. MAX_PACKETNAME_SZ = 24,
  29. MAX_CIPHERNAME_SZ = 24,
  30. MAX_TIMEOUT_NAME_SZ = 24,
  31. MAX_PACKETS_HANDSHAKE = 14, /* 12 for client auth plus 2 alerts */
  32. MAX_VALUE_SZ = 128, /* all handshake packets but Cert should
  33. fit here */
  34. };
  35. struct WOLFSSL;
  36. typedef struct handShakeInfo_st {
  37. struct WOLFSSL* ssl;
  38. char cipherName[MAX_CIPHERNAME_SZ + 1]; /* negotiated cipher */
  39. char packetNames[MAX_PACKETS_HANDSHAKE][MAX_PACKETNAME_SZ + 1];
  40. /* SSL packet names */
  41. int numberPackets; /* actual # of packets */
  42. int negotiationError; /* cipher/parameter err */
  43. } HandShakeInfo;
  44. typedef struct timeval Timeval;
  45. typedef struct packetInfo_st {
  46. char packetName[MAX_PACKETNAME_SZ + 1]; /* SSL packet name */
  47. Timeval timestamp; /* when it occurred */
  48. unsigned char value[MAX_VALUE_SZ]; /* if fits, it's here */
  49. unsigned char* bufferValue; /* otherwise here (non 0) */
  50. int valueSz; /* sz of value or buffer */
  51. } PacketInfo;
  52. typedef struct timeoutInfo_st {
  53. char timeoutName[MAX_TIMEOUT_NAME_SZ + 1]; /* timeout Name */
  54. int flags; /* for future use */
  55. int numberPackets; /* actual # of packets */
  56. PacketInfo packets[MAX_PACKETS_HANDSHAKE]; /* list of all packets */
  57. Timeval timeoutValue; /* timer that caused it */
  58. } TimeoutInfo;
  59. #ifdef __cplusplus
  60. } /* extern "C" */
  61. #endif
  62. #endif /* WOLFSSL_CALLBACKS_H */