stun.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. * $Id$
  3. *
  4. * Portions Copyright (C) 2013 Crocodile RCS Ltd
  5. *
  6. * Based on "ser_stun.h". Copyright (C) 2001-2003 FhG Fokus
  7. *
  8. * This file is part of Kamailio, a free SIP server.
  9. *
  10. * Kamailio is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version
  14. *
  15. * Kamailio is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. */
  25. #ifndef _STUN_H
  26. #define _STUN_H
  27. #include "ip_addr.h"
  28. /* type redefinition */
  29. typedef unsigned char UCHAR_T;
  30. typedef unsigned short USHORT_T;
  31. typedef unsigned int UINT_T;
  32. typedef unsigned long ULONG_T;
  33. #define MAGIC_COOKIE 0x2112A442
  34. #define TRANSACTION_ID 12
  35. struct transaction_id {
  36. UINT_T magic_cookie;
  37. UCHAR_T id[TRANSACTION_ID];
  38. };
  39. struct stun_hdr {
  40. USHORT_T type;
  41. USHORT_T len;
  42. struct transaction_id id;
  43. };
  44. struct stun_attr {
  45. USHORT_T type;
  46. USHORT_T len;
  47. };
  48. typedef struct stun_event_info {
  49. char *buf;
  50. unsigned int len;
  51. struct receive_info *rcv;
  52. } stun_event_info_t;
  53. int stun_process_msg(char* buf, unsigned int len, struct receive_info* ri);
  54. #endif /* _STUN_H */