CARMA C++
SenderAddress.h
Go to the documentation of this file.
1 #ifndef CARMA_UI_RTD_SENDERADDRESS_H
2 #define CARMA_UI_RTD_SENDERADDRESS_H
3 
19 #include <iostream>
20 #include <unistd.h>
21 #include <netdb.h>
22 #include <netinet/in.h>
23 #include <errno.h>
24 
25 #include <string>
26 
27 namespace carma {
28 namespace ui {
29 namespace rtd {
30 
37 
38  public:
39 
51  SenderAddress(int fd);
52 
54  SenderAddress(const SenderAddress &s);
55 
58 
60  std::string getHostName() const;
61 
63  std::string getDomainName() const;
64 
69  std::string getNetAddress() const;
70 
72  int getPortAddress() const;
73 
75  int getLocalAddress() const;
76 
81  std::string getServerHostName() const;
82 
84  std::string getServerDomainName() const;
85 
86 private:
87  std::string netAddress; // dotted-quad IP address
88  std::string hostName; // fully qualified host name
89  std::string domainName;
90  std::string serverHostName_; // Fully qualified
91  std::string serverDomainName_;
92  union {
93  struct sockaddr_in sin;
94  struct sockaddr sa;
95  } address;
96 };
97 
98 } // namespace carma::ui::rtd
99 } // namespace carma::ui
100 } // namespace carma
101 
102 #endif // CARMA_UI_RTD_SENDERADDRESS_H
int getLocalAddress() const
Return the local address.
std::string getDomainName() const
Get the domain name.
SenderAddress & operator=(const SenderAddress &s)
Allow initialize by assignment.
SenderAddress stores and makes available peer information for the opposite (client) end of a connecte...
Definition: SenderAddress.h:36
SenderAddress(int fd)
There is no default constructor.
std::string getHostName() const
Full host name, including domain.
std::string getNetAddress() const
Return a character string representation of the IP address in the standard &#39;dot&#39; format - i...
std::string getServerDomainName() const
Get server&#39;s domain name.
int getPortAddress() const
Return the port.
std::string getServerHostName() const
Get server&#39;s address.