#include <HTTPClient.h>
Definition at line 25 of file HTTPClient.h.
Public Member Functions | |
HTTPClient () | |
HTTPClient (const String &_url) | |
HTTPClient (const String &_url, const String &user_agent) | |
void | mGet (HTTPResponse &resp) |
void | mPut (HTTPResponse &resp) |
void | mPost (HTTPResponse &resp) |
void | mDelete (HTTPResponse &resp) |
void | runMethod (const String &method_name, const String &url, HTTPResponse &resp) |
void | connect (const IPv4Address &addr, int port) |
Connects the specified TCPSocket to the given address. | |
RawSocketOutputStream & | inputStream () |
Returns the associated input address for writing operations. | |
RawSocketInputStream & | outputStream () |
Returns the associated output address for reading operations. | |
virtual void | close () |
Closes the socket so it wont send nor receive data. | |
void | bind (const IPv4Address &ip) |
Binds this socket to a specified address. | |
bool | debug (bool enabled) |
Puts or takes out the socket from debug mode. | |
bool | debug () |
Tells wheter the socket is currently in debug mode or not. | |
bool | reuseAddr (bool enabled) |
Activates port re-usage, use with care. | |
bool | reuseAddr () |
Tells wheter this socket has a reusable port or not. | |
bool | keepalive (bool enabled) |
Enables connection keepalive if the protocol supports it. | |
bool | keepalive () |
Tells wheter the socket is using keepalives or not. | |
bool | dontroute (bool enabled) |
Tells the socket to send data directly to the peer interface bypassing any routin facilities. | |
bool | dontroute () |
Tell wheter this socket is bypassing routing or not. | |
void | linger (bool enabled, int secs=1) |
Controls what to do when the connection is closed and there's still data waiting to sent over the channel. | |
int | linger () |
Tells wheter this socket is lingering. | |
bool | broadcast (bool enabled) |
Enables transmision broadcast for datagram based sockets. | |
bool | broadcast () |
Tells wheter broadcasting has been enabled for this socket or not. | |
bool | recvOOBInline (bool enabled) |
Enables the recival of out of band (urgent) data in the same channel we're reading, use with care. | |
bool | recvOOBInline () |
Tells wheter the receival of out of band data is enabled or not. | |
int | sendBufSize (int newsize) |
Changes the send buffer size value. | |
int | sendBufSize () |
Tells how big is the send buffer size. | |
int | recvBufSize (int newsize) |
Changes the receive buffer size value. | |
int | recvBufSize () |
Tells how big is the receive buffer size. | |
bool | isStream () |
Tells wheter this is a stream socket (a connected socket). | |
bool | isDatagram () |
Tells wheter this is a datagram socket. | |
bool | isRaw () |
Tells wheter this is a raw socket. | |
bool | isIPv4 () |
Tells wheter this socket has been created to be used with ipv4 naming space conventions. | |
bool | isIPv6 () |
Tells wheter this socket has been created to be used with ipv6 naming space conventions. | |
virtual const char * | getClassName () |
Returns the name of the current class. | |
virtual std::string | toString () |
Static Public Member Functions | |
static HTTPClient | create (const String &url) |
static void | mGet (const String &url, HTTPResponse &resp) |
static void | debugmsg (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__) |
Will print a debug message to the screen. | |
static void | debugmsgln (Object *obj, const char *msg, int linenumber=__LINE__, const char *srcfile=__FILE__) |
Protected Member Functions | |
void | create (int protoid=0) |
Initializes the socket itself, and ensures it will be created for use in the internet namespace. | |
virtual void | getsockopt (int level, int optname, void *optval, socklen_t *optlen) |
Retrieves the value of the specified option at the given level for this socket. | |
virtual void | setsockopt (int level, int optname, const void *optval, socklen_t optlen) |
Sets the value of the specified option at the given level for this socket. | |
Protected Attributes | |
String | url |
String | uagent |
RawSocketInputStream | out |
Output stream object. | |
RawSocketOutputStream | in |
Input stream object. | |
int | _socket |
This is the socket file descriptor per se. | |
bool | is_ipv4 |
Controls wheter this is an ipv4 socket or not, if not, then it is considered to be ipv6. | |
std::string | __cls_name |
Friends | |
std::ostream & | operator<< (std::ostream &stream, const Object &s) |
xvr2::Net::HTTPClient::HTTPClient | ( | ) |
xvr2::Net::HTTPClient::HTTPClient | ( | const String & | _url | ) |
static HTTPClient xvr2::Net::HTTPClient::create | ( | const String & | url | ) | [static] |
static void xvr2::Net::HTTPClient::mGet | ( | const String & | url, | |
HTTPResponse & | resp | |||
) | [static] |
void xvr2::Net::HTTPClient::mGet | ( | HTTPResponse & | resp | ) |
void xvr2::Net::HTTPClient::mPut | ( | HTTPResponse & | resp | ) |
void xvr2::Net::HTTPClient::mPost | ( | HTTPResponse & | resp | ) |
void xvr2::Net::HTTPClient::mDelete | ( | HTTPResponse & | resp | ) |
void xvr2::Net::HTTPClient::runMethod | ( | const String & | method_name, | |
const String & | url, | |||
HTTPResponse & | resp | |||
) |
void xvr2::Net::TCPSocket::create | ( | int | protoid = 0 |
) | [protected, virtual, inherited] |
Initializes the socket itself, and ensures it will be created for use in the internet namespace.
Implements xvr2::Net::Socket.
void xvr2::Net::TCPSocket::connect | ( | const IPv4Address & | addr, | |
int | port | |||
) | [virtual, inherited] |
Connects the specified TCPSocket to the given address.
addr | IPv4 destination address. | |
port | destination port number. |
Implements xvr2::Net::ClientSocket.
RawSocketOutputStream& xvr2::Net::ClientSocket::inputStream | ( | ) | [inherited] |
Returns the associated input address for writing operations.
RawSocketInputStream& xvr2::Net::ClientSocket::outputStream | ( | ) | [inherited] |
Returns the associated output address for reading operations.
virtual void xvr2::Net::Socket::getsockopt | ( | int | level, | |
int | optname, | |||
void * | optval, | |||
socklen_t * | optlen | |||
) | [protected, virtual, inherited] |
Retrieves the value of the specified option at the given level for this socket.
level | Option level, OS-dependent. | |
optname | Option name to be changed. | |
optval | Holds the buffer where value will be saved. | |
optlen | Is the output buffer size. |
virtual void xvr2::Net::Socket::setsockopt | ( | int | level, | |
int | optname, | |||
const void * | optval, | |||
socklen_t | optlen | |||
) | [protected, virtual, inherited] |
Sets the value of the specified option at the given level for this socket.
level | Option level, OS-dependent. | |
optname | Option name to be changed. | |
optval | Value to set the option. | |
optlen | Holds the optval datasize. |
virtual void xvr2::Net::Socket::close | ( | ) | [virtual, inherited] |
Closes the socket so it wont send nor receive data.
void xvr2::Net::Socket::bind | ( | const IPv4Address & | ip | ) | [inherited] |
Binds this socket to a specified address.
Binding will let you configure this socket to listen or send data from a specific local address, very useful for server applications on machines with multiple interfaces since sometimes you just want to send/receive data to/from a specific interface, however the same can be done with client apps.
ip | IP address assigned to the local interface to be binded from. |
bool xvr2::Net::Socket::debug | ( | bool | enabled | ) | [inherited] |
Puts or takes out the socket from debug mode.
This method will activate the recording of debug information based on the used protocol, use this method carefully it is very OS dependent.
[in] | enabled | If true it will enable debug mode for the socket, if false it will disable debug mode. |
bool xvr2::Net::Socket::debug | ( | ) | [inherited] |
Tells wheter the socket is currently in debug mode or not.
bool xvr2::Net::Socket::reuseAddr | ( | bool | enabled | ) | [inherited] |
Activates port re-usage, use with care.
This method will allow a port to be re-used even if the socket has already been binded, as a result you can have multiple sockets binded to the same port.
enabled | If true enables port reuse. |
bool xvr2::Net::Socket::reuseAddr | ( | ) | [inherited] |
Tells wheter this socket has a reusable port or not.
bool xvr2::Net::Socket::keepalive | ( | bool | enabled | ) | [inherited] |
Enables connection keepalive if the protocol supports it.
This option activates/deactivates sending keepalives to the remote peer, this keepalives are messages sent peridically in order to determine if the connection has benn broken or not, if a response to the message is not recieved, then the connection is considered broken.
enabled | If true, the keepalive function will be enabled, if false then it will be disabled. |
bool xvr2::Net::Socket::keepalive | ( | ) | [inherited] |
Tells wheter the socket is using keepalives or not.
bool xvr2::Net::Socket::dontroute | ( | bool | enabled | ) | [inherited] |
Tells the socket to send data directly to the peer interface bypassing any routin facilities.
enabled | If true, the messages will be sent directly to the peer interface, if false outgoing messages won't bypass routing. |
bool xvr2::Net::Socket::dontroute | ( | ) | [inherited] |
Tell wheter this socket is bypassing routing or not.
void xvr2::Net::Socket::linger | ( | bool | enabled, | |
int | secs = 1 | |||
) | [inherited] |
Controls what to do when the connection is closed and there's still data waiting to sent over the channel.
enabled | if true the close() method will get blocked until all data has benn transmited to the other side, if false then a call close will return inmediately or until the secs period has expired. | |
secs | timeout before effectively closing the socket in case it still has messages to send. |
int xvr2::Net::Socket::linger | ( | ) | [inherited] |
Tells wheter this socket is lingering.
bool xvr2::Net::Socket::broadcast | ( | bool | enabled | ) | [inherited] |
Enables transmision broadcast for datagram based sockets.
enabled | If true, datagram broadcasting is enabled, if false then it will be disabled. |
bool xvr2::Net::Socket::broadcast | ( | ) | [inherited] |
Tells wheter broadcasting has been enabled for this socket or not.
bool xvr2::Net::Socket::recvOOBInline | ( | bool | enabled | ) | [inherited] |
Enables the recival of out of band (urgent) data in the same channel we're reading, use with care.
enabled | if true enables inline out of band receiving, if false disables it. |
bool xvr2::Net::Socket::recvOOBInline | ( | ) | [inherited] |
Tells wheter the receival of out of band data is enabled or not.
int xvr2::Net::Socket::sendBufSize | ( | int | newsize | ) | [inherited] |
Changes the send buffer size value.
int xvr2::Net::Socket::sendBufSize | ( | ) | [inherited] |
Tells how big is the send buffer size.
int xvr2::Net::Socket::recvBufSize | ( | int | newsize | ) | [inherited] |
Changes the receive buffer size value.
int xvr2::Net::Socket::recvBufSize | ( | ) | [inherited] |
Tells how big is the receive buffer size.
bool xvr2::Net::Socket::isStream | ( | ) | [inherited] |
Tells wheter this is a stream socket (a connected socket).
bool xvr2::Net::Socket::isDatagram | ( | ) | [inherited] |
Tells wheter this is a datagram socket.
A datagram is a communication style whose purpose is to send individually addressed packets unreliably (much like UDP).
bool xvr2::Net::Socket::isRaw | ( | ) | [inherited] |
Tells wheter this is a raw socket.
Raw sockets are used to access low-level features of communication protocols, sniffer and other type of applications use this type of communication.
bool xvr2::Net::Socket::isIPv4 | ( | ) | [inherited] |
Tells wheter this socket has been created to be used with ipv4 naming space conventions.
bool xvr2::Net::Socket::isIPv6 | ( | ) | [inherited] |
Tells wheter this socket has been created to be used with ipv6 naming space conventions.
virtual const char* xvr2::Object::getClassName | ( | ) | [virtual, inherited] |
Returns the name of the current class.
static void xvr2::Object::debugmsg | ( | Object * | obj, | |
const char * | msg, | |||
int | linenumber = __LINE__ , |
|||
const char * | srcfile = __FILE__ | |||
) | [static, inherited] |
Will print a debug message to the screen.
static void xvr2::Object::debugmsgln | ( | Object * | obj, | |
const char * | msg, | |||
int | linenumber = __LINE__ , |
|||
const char * | srcfile = __FILE__ | |||
) | [static, inherited] |
virtual std::string xvr2::Object::toString | ( | ) | [virtual, inherited] |
std::ostream& operator<< | ( | std::ostream & | stream, | |
const Object & | s | |||
) | [friend, inherited] |
String xvr2::Net::HTTPClient::url [protected] |
Definition at line 28 of file HTTPClient.h.
String xvr2::Net::HTTPClient::uagent [protected] |
Definition at line 29 of file HTTPClient.h.
RawSocketInputStream xvr2::Net::ClientSocket::out [protected, inherited] |
RawSocketOutputStream xvr2::Net::ClientSocket::in [protected, inherited] |
int xvr2::Net::Socket::_socket [protected, inherited] |
bool xvr2::Net::Socket::is_ipv4 [protected, inherited] |
std::string xvr2::Object::__cls_name [protected, inherited] |