xfrout_client.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. // Copyright (C) 2010 Internet Systems Consortium, Inc. ("ISC")
  2. //
  3. // Permission to use, copy, modify, and/or distribute this software for any
  4. // purpose with or without fee is hereby granted, provided that the above
  5. // copyright notice and this permission notice appear in all copies.
  6. //
  7. // THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
  8. // REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
  9. // AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
  10. // INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
  11. // LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
  12. // OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  13. // PERFORMANCE OF THIS SOFTWARE.
  14. // $Id$
  15. #ifndef _XFROUT_CLIENT_H
  16. #define _XFROUT_CLIENT_H
  17. #include <string>
  18. #include <boost/asio.hpp>
  19. #include <exceptions/exceptions.h>
  20. namespace isc {
  21. namespace xfr {
  22. class XfroutError: public Exception {
  23. public:
  24. XfroutError(const char *file, size_t line, const char *what):
  25. isc::Exception(file, line, what) {}
  26. };
  27. using boost::asio::local::stream_protocol;
  28. class XfroutClient {
  29. public:
  30. XfroutClient(const std::string& file):
  31. socket_(io_service_), file_path_(file) {}
  32. void connect();
  33. void disconnect();
  34. int sendXfroutRequestInfo(int tcp_sock, uint8_t* msg_data,
  35. uint16_t msg_len);
  36. private:
  37. boost::asio::io_service io_service_;
  38. // The socket used to communicate with the xfrout server.
  39. stream_protocol::socket socket_;
  40. const std::string file_path_;
  41. };
  42. } // End for namespace xfr
  43. } // End for namespace isc
  44. #endif
  45. // Local Variables:
  46. // mode: c++
  47. // End: