PageRenderTime 38ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/src/libs/netcomm/service_discovery/service.h

https://gitlab.com/F34140r/rockin-refbox
C Header | 105 lines | 64 code | 21 blank | 20 comment | 0 complexity | 308e74a1dd8df7a4fe850f80d046bec1 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. /***************************************************************************
  2. * service.h - Network service representation
  3. *
  4. * Generated: Tue Nov 07 17:58:10 2006
  5. * Copyright 2006-2008 Tim Niemueller [www.niemueller.de]
  6. *
  7. ****************************************************************************/
  8. /* This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version. A runtime exception applies to
  12. * this software (see LICENSE.GPL_WRE file mentioned below for details).
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Library General Public License for more details.
  18. *
  19. * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
  20. */
  21. #ifndef __NETCOMM_SERVICE_DISCOVERY_SERVICE_H_
  22. #define __NETCOMM_SERVICE_DISCOVERY_SERVICE_H_
  23. #include <string>
  24. #include <list>
  25. #include <sys/types.h>
  26. #include <sys/socket.h>
  27. namespace fawkes {
  28. class NetworkNameResolver;
  29. class NetworkService
  30. {
  31. public:
  32. NetworkService(const char *name,
  33. const char *type,
  34. const char *domain,
  35. const char *host,
  36. unsigned short int port);
  37. NetworkService(const char *name,
  38. const char *type,
  39. const char *domain,
  40. const char *host,
  41. unsigned short int port,
  42. const struct sockaddr *addr,
  43. const socklen_t addr_size,
  44. std::list<std::string> &txt);
  45. NetworkService(const char *name,
  46. const char *type,
  47. unsigned short int port);
  48. NetworkService(const char *name,
  49. const char *type,
  50. const char *domain);
  51. NetworkService(NetworkNameResolver *nnresolver,
  52. const char *name, const char *type,
  53. unsigned short int port);
  54. NetworkService(const NetworkService *s);
  55. NetworkService(const NetworkService &s);
  56. ~NetworkService();
  57. void add_txt(const char *format, ...);
  58. void set_txt(std::list<std::string> &txtlist);
  59. void set_name(const char *new_name);
  60. void set_modified_name(const char *new_name) const;
  61. const char * name() const;
  62. const char * modified_name() const;
  63. const char * type() const;
  64. const char * domain() const;
  65. const char * host() const;
  66. std::string addr_string() const;
  67. unsigned short int port() const;
  68. const std::list<std::string> & txt() const;
  69. bool operator==(const NetworkService &s) const;
  70. bool operator==(const NetworkService *s) const;
  71. bool operator<(const NetworkService &s) const;
  72. private:
  73. std::list<std::string> list;
  74. char * _name;
  75. char * _type;
  76. char * _domain;
  77. char * _host;
  78. unsigned short int _port;
  79. struct sockaddr *_addr;
  80. socklen_t _addr_size;
  81. mutable char * _modified_name;
  82. };
  83. } // end namespace fawkes
  84. #endif