Back to list of all libraries | See all modules
mrpt-comms
This module includes classes related to serial ports/devices and networking (TCP, DNS,...) utilities.
Classes | |
class | mrpt::comms::CClientTCPSocket |
A TCP socket that can be connected to a TCP server, implementing MRPT's CStream interface for passing objects as well as generic read/write methods. More... | |
struct | mrpt::comms::TFTDIDevice |
A list of FTDI devices and their descriptors. More... | |
class | mrpt::comms::CInterfaceFTDI |
A definition of a CStream actually representing a USB connection to a FTDI chip. More... | |
class | mrpt::comms::CSerialPort |
A communications serial port built as an implementation of a utils::CStream. More... | |
class | mrpt::comms::CServerTCPSocket |
A TCP socket that can be wait for client connections to enter. More... | |
Namespaces | |
mrpt::comms::net | |
A set of useful routines for networking. | |
Enumerations | |
enum | mrpt::comms::net::ERRORCODE_HTTP { mrpt::comms::net::erOk = 0, mrpt::comms::net::erBadURL, mrpt::comms::net::erCouldntConnect, mrpt::comms::net::erNotFound, mrpt::comms::net::erOtherHTTPError } |
Possible returns from a HTTP request. More... | |
Functions | |
ERRORCODE_HTTP | mrpt::comms::net::http_get (const string &url, std::vector< uint8_t > &out_content, string &out_errormsg, int port=80, const string &auth_user=string(), const string &auth_pass=string(), int *out_http_responsecode=nullptr, mrpt::system::TParameters< string > *extra_headers=nullptr, mrpt::system::TParameters< string > *out_headers=nullptr, int timeout_ms=1000) |
Perform an HTTP GET operation (version for retrieving the data as a std::vector<uint8_t>) More... | |
ERRORCODE_HTTP | mrpt::comms::net::http_get (const string &url, string &out_content, string &out_errormsg, int port=80, const string &auth_user=string(), const string &auth_pass=string(), int *out_http_responsecode=nullptr, mrpt::system::TParameters< string > *extra_headers=nullptr, mrpt::system::TParameters< string > *out_headers=nullptr, int timeout_ms=1000) |
Perform an HTTP GET operation (version for retrieving the data as text) More... | |
ERRORCODE_HTTP | mrpt::comms::net::http_request (const string &http_method, const string &http_send_content, const string &url, std::vector< uint8_t > &out_content, string &out_errormsg, int port=80, const string &auth_user=string(), const string &auth_pass=string(), int *out_http_responsecode=nullptr, mrpt::system::TParameters< string > *extra_headers=nullptr, mrpt::system::TParameters< string > *out_headers=nullptr, int timeout_ms=1000) |
Generic function for HTTP GET & POST methods. More... | |
bool | mrpt::comms::net::DNS_resolve_async (const std::string &server_name, std::string &out_ip, const unsigned int timeout_ms=3000) |
Resolve a server address by its name, returning its IP address as a string - This method has a timeout for the maximum time to wait for the DNS server. More... | |
std::string | mrpt::comms::net::getLastSocketErrorStr () |
Returns a description of the last Sockets error. More... | |
bool | mrpt::comms::net::Ping (const std::string &address, const int max_attempts, std::string *output_str=NULL) |
Ping an IP address. More... | |
Possible returns from a HTTP request.
Enumerator | |
---|---|
erOk | |
erBadURL | |
erCouldntConnect | |
erNotFound | |
erOtherHTTPError |
Definition at line 31 of file net_utils.h.
bool mrpt::comms::net::DNS_resolve_async | ( | const std::string & | server_name, |
std::string & | out_ip, | ||
const unsigned int | timeout_ms = 3000 |
||
) |
Resolve a server address by its name, returning its IP address as a string - This method has a timeout for the maximum time to wait for the DNS server.
For example: server_name="www.google.com" -> out_ip="209.85.227.99"
Definition at line 404 of file net_utils.cpp.
References mrpt::system::os::memcpy(), and status.
Referenced by mrpt::comms::CClientTCPSocket::connect().
std::string mrpt::comms::net::getLastSocketErrorStr | ( | ) |
Returns a description of the last Sockets error.
Definition at line 480 of file net_utils.cpp.
References mrpt::format().
Referenced by mrpt::comms::CServerTCPSocket::getLastErrorStr(), mrpt::comms::CClientTCPSocket::getLastErrorStr(), mrpt::hwdrivers::CVelodyneScanner::initialize(), and mrpt::hwdrivers::CVelodyneScanner::internal_receive_UDP_packet().
ERRORCODE_HTTP mrpt::comms::net::http_get | ( | const string & | url, |
std::vector< uint8_t > & | out_content, | ||
string & | out_errormsg, | ||
int | port = 80 , |
||
const string & | auth_user = string() , |
||
const string & | auth_pass = string() , |
||
int * | out_http_responsecode = nullptr , |
||
mrpt::system::TParameters< string > * | extra_headers = nullptr , |
||
mrpt::system::TParameters< string > * | out_headers = nullptr , |
||
int | timeout_ms = 1000 |
||
) |
Perform an HTTP GET operation (version for retrieving the data as a std::vector<uint8_t>)
url | Must be a simple string of the form "http://<servername>/<relative-address>". |
port | The server port, if different from 80. |
extra_headers | If provided, the given extra HTTP headers will be sent. |
out_errormsg | On exit will contain a description of the error or "Ok". |
out_content | The buffer with the retrieved data. |
out_http_responsecode | If provided, will hold the HTTP code, eg: 200, 404... |
out_headers | If provided, a copy of all the headers returned by the server will be saved here. |
auth_user | Send a basic HTTP authorization request with the given user & password. |
auth_pass | Send a basic HTTP authorization request with the given user & password. |
Definition at line 386 of file net_utils.cpp.
References mrpt::comms::net::http_request(), and url.
Referenced by mrpt::hwdrivers::CRovio::captureImageAsync(), mrpt::hwdrivers::CRovio::general_command(), mrpt::comms::net::http_get(), mrpt::hwdrivers::CRovio::initialize(), mrpt::hwdrivers::CRovio::path_management(), mrpt::hwdrivers::CRovio::pathRename(), mrpt::hwdrivers::CNTRIPClient::retrieveListOfMountpoints(), and mrpt::hwdrivers::CRovio::send_cmd_action().
ERRORCODE_HTTP mrpt::comms::net::http_get | ( | const string & | url, |
string & | out_content, | ||
string & | out_errormsg, | ||
int | port = 80 , |
||
const string & | auth_user = string() , |
||
const string & | auth_pass = string() , |
||
int * | out_http_responsecode = nullptr , |
||
mrpt::system::TParameters< string > * | extra_headers = nullptr , |
||
mrpt::system::TParameters< string > * | out_headers = nullptr , |
||
int | timeout_ms = 1000 |
||
) |
Perform an HTTP GET operation (version for retrieving the data as text)
url | Must be a simple string of the form "http://<servername>/<relative-address>". |
port | The server port, if different from 80. |
extra_headers | If provided, the given extra HTTP headers will be sent. |
out_errormsg | On exit will contain a description of the error or "Ok". |
out_content | The buffer with the retrieved data. |
out_http_responsecode | If provided, will hold the HTTP code, eg: 200, 404... |
out_headers | If provided, a copy of all the headers returned by the server will be saved here. |
auth_user | Send a basic HTTP authorization request with the given user & password. |
auth_pass | Send a basic HTTP authorization request with the given user & password. |
Definition at line 51 of file net_utils.cpp.
References mrpt::comms::net::http_get(), mrpt::system::os::memcpy(), and url.
ERRORCODE_HTTP mrpt::comms::net::http_request | ( | const string & | http_method, |
const string & | http_send_content, | ||
const string & | url, | ||
std::vector< uint8_t > & | out_content, | ||
string & | out_errormsg, | ||
int | port = 80 , |
||
const string & | auth_user = string() , |
||
const string & | auth_pass = string() , |
||
int * | out_http_responsecode = nullptr , |
||
mrpt::system::TParameters< string > * | extra_headers = nullptr , |
||
mrpt::system::TParameters< string > * | out_headers = nullptr , |
||
int | timeout_ms = 1000 |
||
) |
Generic function for HTTP GET & POST methods.
Definition at line 69 of file net_utils.cpp.
References mrpt::comms::CClientTCPSocket::connect(), mrpt::system::encodeBase64(), mrpt::comms::net::erBadURL, mrpt::comms::net::erCouldntConnect, mrpt::comms::net::erOk, mrpt::comms::net::erOtherHTTPError, mrpt::format(), mrpt::system::TParameters< T >::has(), mrpt::comms::CClientTCPSocket::isConnected(), mrpt::system::os::memcpy(), mrpt::comms::CClientTCPSocket::readAsync(), mrpt::comms::CClientTCPSocket::sendString(), mrpt::system::CTicTac::Tac(), mrpt::system::CTicTac::Tic(), mrpt::system::tokenize(), url, and val.
Referenced by mrpt::comms::net::http_get(), and mrpt::hwdrivers::CVelodyneScanner::internal_send_http_post().
bool mrpt::comms::net::Ping | ( | const std::string & | address, |
const int | max_attempts, | ||
std::string * | output_str = NULL |
||
) |
Ping an IP address.
[in] | address | Address to ping. |
[in] | max_attempts | Number of attempts to try and ping. |
[out] | output | String containing output information |
Definition at line 498 of file net_utils.cpp.
References mrpt::system::executeCommand(), and mrpt::to_string().
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST |