callbacks.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* callbacks.h
  2. *
  3. * Copyright (C) 2015 wolfSSL Inc.
  4. *
  5. * This file is part of wolfSSL. (formerly known as CyaSSL)
  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-1301, USA
  20. */
  21. #ifndef WOLFSSL_CALLBACKS_H
  22. #define WOLFSSL_CALLBACKS_H
  23. #include <sys/time.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. typedef struct handShakeInfo_st {
  36. char cipherName[MAX_CIPHERNAME_SZ + 1]; /* negotiated cipher */
  37. char packetNames[MAX_PACKETS_HANDSHAKE][MAX_PACKETNAME_SZ + 1];
  38. /* SSL packet names */
  39. int numberPackets; /* actual # of packets */
  40. int negotiationError; /* cipher/parameter err */
  41. } HandShakeInfo;
  42. typedef struct timeval Timeval;
  43. typedef struct packetInfo_st {
  44. char packetName[MAX_PACKETNAME_SZ + 1]; /* SSL packet name */
  45. Timeval timestamp; /* when it occured */
  46. unsigned char value[MAX_VALUE_SZ]; /* if fits, it's here */
  47. unsigned char* bufferValue; /* otherwise here (non 0) */
  48. int valueSz; /* sz of value or buffer */
  49. } PacketInfo;
  50. typedef struct timeoutInfo_st {
  51. char timeoutName[MAX_TIMEOUT_NAME_SZ + 1]; /* timeout Name */
  52. int flags; /* for future use */
  53. int numberPackets; /* actual # of packets */
  54. PacketInfo packets[MAX_PACKETS_HANDSHAKE]; /* list of all packets */
  55. Timeval timeoutValue; /* timer that caused it */
  56. } TimeoutInfo;
  57. #ifdef __cplusplus
  58. } /* extern "C" */
  59. #endif
  60. #endif /* WOLFSSL_CALLBACKS_H */