raw_sock.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright (C) 2010 iptelorg GmbH
  3. *
  4. * Permission to use, copy, modify, and distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /** Kamailio core :: raw socket functions.
  17. * @file raw_sock.c
  18. * @ingroup core
  19. * @author andrei
  20. * Module: @ref core
  21. */
  22. #ifndef _raw_sock_h
  23. #define _raw_sock_h
  24. #include "ip_addr.h"
  25. /** filter for limiting packets received on raw sockets. */
  26. struct raw_filter{
  27. struct net dst;
  28. unsigned short port1;
  29. unsigned short port2;
  30. char proto;
  31. };
  32. extern int raw_ipip;
  33. int raw_socket(int proto, struct ip_addr* ip, str* iface, int iphdr_incl);
  34. int raw_udp4_socket(struct ip_addr* ip, str* iface, int iphdr_incl);
  35. int recvpkt4(int sock, char* buf, int len, union sockaddr_union* from,
  36. union sockaddr_union* to);
  37. int raw_udp4_recv(int rsock, char** buf, int len, union sockaddr_union* from,
  38. union sockaddr_union* to, struct raw_filter* rf);
  39. int raw_udp4_send(int rsock, char* buf, unsigned int len,
  40. union sockaddr_union* from,
  41. union sockaddr_union* to);
  42. int raw_iphdr_udp4_send(int rsock, char* buf, unsigned int len,
  43. union sockaddr_union* from,
  44. union sockaddr_union* to, unsigned short mtu);
  45. #endif /* _raw_sock_h */