SocksUdpGwClient.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. * @file SocksUdpGwClient.h
  3. * @author Ambroz Bizjak <[email protected]>
  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 <base/DebugObject.h>
  25. #include <system/BReactor.h>
  26. #include <udpgw_client/UdpGwClient.h>
  27. #include <socksclient/BSocksClient.h>
  28. typedef void (*SocksUdpGwClient_handler_received) (void *user, BAddr local_addr, BAddr remote_addr, const uint8_t *data, int data_len);
  29. typedef struct {
  30. int udp_mtu;
  31. BAddr socks_server_addr;
  32. BAddr remote_udpgw_addr;
  33. BReactor *reactor;
  34. void *user;
  35. SocksUdpGwClient_handler_received handler_received;
  36. UdpGwClient udpgw_client;
  37. BTimer reconnect_timer;
  38. int have_socks;
  39. BSocksClient socks_client;
  40. int socks_up;
  41. DebugObject d_obj;
  42. } SocksUdpGwClient;
  43. void 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,
  44. SocksUdpGwClient_handler_received handler_received);
  45. void SocksUdpGwClient_Free (SocksUdpGwClient *o);
  46. void SocksUdpGwClient_SubmitPacket (SocksUdpGwClient *o, BAddr local_addr, BAddr remote_addr, const uint8_t *data, int data_len);
  47. #endif