exceptions TCP (#31)

* WIP

* first test

* format

* test frames

* also 0:

* WIP

* WIP

* first test

* format

* test frames

* also 0:

* test and less local

* pass ret by value

* level

* WIP

* WIP

* cleaning up interface

* removed ref

* another

* updated api version

* cleanup

* cleanup

* WIP

* fixes

* fixed tests
This commit is contained in:
Erik Fröjdh
2019-06-05 15:25:18 +02:00
committed by Dhanya Thattil
parent a6144f658e
commit 1db7521cfa
14 changed files with 1048 additions and 1752 deletions

View File

@ -15,12 +15,16 @@ class DataSocket {
void swap(DataSocket &other) noexcept;
DataSocket(const DataSocket &) = delete;
DataSocket &operator=(DataSocket const &) = delete;
int getSocketId() const {
return socketId_;
}
int getSocketId() const { return socketId_; }
int sendData(const void *buffer, size_t size);
template <typename T> int sendData(T &&data) {
return sendData(&data, sizeof(data));
}
int receiveData(void *buffer, size_t size);
int read(void *buffer, size_t size);
int write(void *buffer, size_t size);
int setTimeOut(int t_seconds);
int setReceiveTimeout(int us);
void close();
@ -30,9 +34,12 @@ class DataSocket {
int socketId_ = -1;
};
int ConvertHostnameToInternetAddress(const char *const hostname, struct ::addrinfo **res);
int ConvertInternetAddresstoIpString(struct ::addrinfo *res, char *ip, const int ipsize);
int ConvertHostnameToInternetAddress(const char *const hostname,
struct ::addrinfo **res);
int ConvertInternetAddresstoIpString(struct ::addrinfo *res, char *ip,
const int ipsize);
struct ::sockaddr_in ConvertHostnameToInternetAddress(const std::string &hostname);
struct ::sockaddr_in
ConvertHostnameToInternetAddress(const std::string &hostname);
}; // namespace sls