dtls.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /*
  2. * Copyright (C) 2011-2012 Free Software Foundation, Inc.
  3. *
  4. * Author: Nikos Mavrogiannopoulos
  5. *
  6. * This file is part of GnuTLS.
  7. *
  8. * The GnuTLS is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation; either version 2.1 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This library is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  16. * Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. /* This file contains the types and prototypes for the X.509
  23. * certificate and CRL handling functions.
  24. */
  25. #ifndef GNUTLS_DTLS_H
  26. #define GNUTLS_DTLS_H
  27. #include <gnutls/gnutls.h>
  28. /* *INDENT-OFF* */
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. /* *INDENT-ON* */
  33. #define GNUTLS_COOKIE_KEY_SIZE 16
  34. void gnutls_dtls_set_timeouts(gnutls_session_t session,
  35. unsigned int retrans_timeout,
  36. unsigned int total_timeout);
  37. unsigned int gnutls_dtls_get_mtu(gnutls_session_t session);
  38. unsigned int gnutls_dtls_get_data_mtu(gnutls_session_t session);
  39. void gnutls_dtls_set_mtu(gnutls_session_t session, unsigned int mtu);
  40. int gnutls_dtls_set_data_mtu(gnutls_session_t session, unsigned int mtu);
  41. unsigned int gnutls_dtls_get_timeout(gnutls_session_t session);
  42. /**
  43. * gnutls_dtls_prestate_st:
  44. * @record_seq: record sequence number
  45. * @hsk_read_seq: handshake read sequence number
  46. * @hsk_write_seq: handshake write sequence number
  47. *
  48. * DTLS cookie prestate struct. This is usually never modified by
  49. * the application, it is used to carry the cookie data between
  50. * gnutls_dtls_cookie_send(), gnutls_dtls_cookie_verify() and
  51. * gnutls_dtls_prestate_set().
  52. */
  53. typedef struct {
  54. unsigned int record_seq;
  55. unsigned int hsk_read_seq;
  56. unsigned int hsk_write_seq;
  57. } gnutls_dtls_prestate_st;
  58. int gnutls_dtls_cookie_send(gnutls_datum_t * key,
  59. void *client_data,
  60. size_t client_data_size,
  61. gnutls_dtls_prestate_st * prestate,
  62. gnutls_transport_ptr_t ptr,
  63. gnutls_push_func push_func);
  64. int gnutls_dtls_cookie_verify(gnutls_datum_t * key,
  65. void *client_data,
  66. size_t client_data_size, void *_msg,
  67. size_t msg_size,
  68. gnutls_dtls_prestate_st * prestate);
  69. void gnutls_dtls_prestate_set(gnutls_session_t session,
  70. gnutls_dtls_prestate_st * prestate);
  71. unsigned int gnutls_record_get_discarded(gnutls_session_t session);
  72. /* *INDENT-OFF* */
  73. #ifdef __cplusplus
  74. }
  75. #endif
  76. /* *INDENT-ON* */
  77. #endif /* GNUTLS_DTLS_H */