minor derivative to reduce compiler warnings and tag read-only parameters as const.
Fork of Socket by
Diff: Endpoint.h
- Revision:
- 8:9cf9c2d45264
- Parent:
- 5:300e7ad2dc1d
- Child:
- 11:3d83c348fb8b
--- a/Endpoint.h Fri Jul 27 14:22:45 2012 +0000 +++ b/Endpoint.h Fri Jul 27 15:50:23 2012 +0000 @@ -18,18 +18,38 @@ #ifndef ENDPOINT_H #define ENDPOINT_H +/** +IP Endpoint (address, port) +*/ class Endpoint { public: + /** IP Endpoint (address, port) + */ Endpoint(void); ~Endpoint(void); + /** Reset the address of this endpoint + */ void reset_address(void); + + /** Set the address of this endpoint + \param host The endpoint address (it can either be an IP Address or a hostname that will be resolved with DNS). + \param port The endpoint port + \return 0 on success, -1 on failure (when an hostname cannot be resolved by DNS). + */ int set_address(const char* host, const int port); + /** Get the IP address of this endpoint + \return The IP address of this endpoint. + */ char* get_address(void); - int get_port(void); + + /** Get the port of this endpoint + \return The port of this endpoint + */ + int get_port(void); protected: char _ipAddress[16];