int getFd();
// Main functions
BError bind(const BSocketAddress& add);
BError connect(const BSocketAddress& add);
BError shutdown(int how);
BError close();
BError listen(int backlog = 5);
BError accept(int& fd);
BError accept(int& fd, BSocketAddress& address);
// Main data transfer functions
BError send(const void* buf, BSize nbytes, BSize& nbytesSent, int flags = 0);
BError sendTo(const BSocketAddress& address, const void* buf, BSize nbytes, BSize& nbytesSent, int flags = 0);
BError recv(void* buf, BSize maxbytes, BSize& nbytesRecv, int flags = 0);
BError recvFrom(BSocketAddress& address, void* buf, BSize maxbytes, BSize& nbytesRecv, int flags = 0);
BError recvWithTimeout(void* buf, BSize maxbytes, BSize& nbytesRecv, int timeout, int flags = 0);
BError recvFromWithTimeout(BSocketAddress& address, void* buf, BSize maxbytes, BSize& nbytesRecv, int timeout, int flags = 0);
// Configuration functions
BError setSockOpt(int level, int optname, void* optval, unsigned int optlen);
BError getSockOpt(int level, int optname, void* optval, unsigned int* optlen);
BError setReuseAddress(int on);
BError setBroadCast(int on);
BError setPriority(Priority priority);
BError getMTU(uint32_t& mtu);
BError getAddress(BSocketAddress& address);
private:
int osocket;
};
#endif