SocksUdpGwClient.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @file SocksUdpGwClient.h
  3. * @author Ambroz Bizjak <ambrop7@gmail.com>
  4. *
  5. * @section LICENSE
  6. *
  7. * This file is part of BadVPN.
  8. *
  9. * BadVPN is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License version 2
  11. * as published by the Free Software Foundation.
  12. *
  13. * BadVPN is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along
  19. * with this program; if not, write to the Free Software Foundation, Inc.,
  20. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  21. */
  22. #ifndef BADVPN_TUN2SOCKS_SOCKSUDPGWCLIENT_H
  23. #define BADVPN_TUN2SOCKS_SOCKSUDPGWCLIENT_H
  24. #include <misc/debug.h>
  25. #include <base/DebugObject.h>
  26. #include <system/BReactor.h>
  27. #include <udpgw_client/UdpGwClient.h>
  28. #include <socksclient/BSocksClient.h>
  29. typedef void (*SocksUdpGwClient_handler_received) (void *user, BAddr local_addr, BAddr remote_addr, const uint8_t *data, int data_len);
  30. typedef struct {
  31. int udp_mtu;
  32. BAddr socks_server_addr;
  33. BAddr remote_udpgw_addr;
  34. BReactor *reactor;
  35. void *user;
  36. SocksUdpGwClient_handler_received handler_received;
  37. UdpGwClient udpgw_client;
  38. BTimer reconnect_timer;
  39. int have_socks;
  40. BSocksClient socks_client;
  41. int socks_up;
  42. DebugObject d_obj;
  43. } SocksUdpGwClient;
  44. int SocksUdpGwClient_Init (SocksUdpGwClient *o, int udp_mtu, int max_connections, int send_buffer_size, btime_t keepalive_time, BAddr socks_server_addr, BAddr remote_udpgw_addr, btime_t reconnect_time, BReactor *reactor, void *user,
  45. SocksUdpGwClient_handler_received handler_received) WARN_UNUSED;
  46. void SocksUdpGwClient_Free (SocksUdpGwClient *o);
  47. void SocksUdpGwClient_SubmitPacket (SocksUdpGwClient *o, BAddr local_addr, BAddr remote_addr, const uint8_t *data, int data_len);
  48. #endif