42 #ifndef _DWMSOCKET_HH_ 43 #define _DWMSOCKET_HH_ 46 #include <sys/types.h> 47 #include <sys/socket.h> 49 #include <netinet/in.h> 83 operator bool ()
const;
90 virtual bool Open(
int domain,
int type,
int protocol);
112 virtual bool Accept(
Socket & s,
struct sockaddr_in & addr);
128 virtual bool Accept(
Socket & s,
struct sockaddr_un & addr);
134 virtual bool Listen(
int backlog);
140 virtual bool Bind(
const struct sockaddr_in & addr);
152 virtual bool Bind(
const struct sockaddr_un & addr);
158 virtual bool Connect(
const struct sockaddr_in & name);
170 virtual bool Connect(
const struct sockaddr_un & name);
176 virtual bool Getpeername(
struct sockaddr * name, socklen_t & namelen);
189 virtual bool Getsockname(
struct sockaddr * name, socklen_t & namelen);
203 virtual bool Setsockopt(
int level,
int optname,
const void * optval,
210 virtual bool Getsockopt(
int level,
int optname,
void * optval,
216 virtual ssize_t
RecvFrom(
void *buf,
size_t len,
int flags,
217 struct sockaddr_in & from);
226 virtual ssize_t
RecvFrom(
void *buf,
size_t len,
int flags,
237 virtual ssize_t
RecvFrom(std::string & s,
int flags,
243 virtual ssize_t
SendTo(
const void *buf,
size_t len,
int flags,
244 const struct sockaddr_in & to);
251 virtual ssize_t
SendTo(
const void *buf,
size_t len,
int flags,
263 virtual ssize_t
SendTo(
const std::string & s,
int flags,
273 bool HeaderIncluded()
const;
277 bool _headerIncluded;
283 #endif // _DWMSOCKET_HH_ This class abstracts a UNIX socket descriptor.
Definition: DwmSocket.hh:62
virtual bool Bind(const struct sockaddr_in &addr)
Calls the UNIX bind(2) function.
virtual bool Getsockname(struct sockaddr *name, socklen_t &namelen)
Calls the UNIX getsockname(2) function. Returns true on success,.
virtual bool Open(int domain, int type, int protocol)
Opens the socket.
virtual bool Setsockopt(int level, int optname, const void *optval, socklen_t optlen)
Calls the UNIX setsockopt(2) function. Returns true on success,.
virtual ssize_t SendTo(const void *buf, size_t len, int flags, const struct sockaddr_in &to)
Calls the UNIX sendto(2) function.
This class encapsulates an IPv4 address.
Definition: DwmIpv4Address.hh:62
virtual bool Listen(int backlog)
Calls the UNIX listen(2) function.
virtual Socket Accept(struct sockaddr_in &addr)
Calls the UNIX accept(2) function. Returns the resulting socket.
virtual bool JoinMulticastGroup(const Ipv4Address &groupAddr, const Ipv4Address &intfAddr)
Join the given multicast group groupAddr on the given interface address intfAddr. ...
Definition: DwmBZ2IO.hh:67
virtual bool Getsockopt(int level, int optname, void *optval, socklen_t &optlen)
Calls the UNIX setsockopt(2) function. Returns true on success,.
Dwm::Descriptor class definition.
Socket & operator=(const Socket &sock)
operator = (assignment operator).
Dwm::Ipv4Address class definition.
virtual ssize_t RecvFrom(void *buf, size_t len, int flags, struct sockaddr_in &from)
Calls the UNIX recvfrom(2) function.
This class encapsulates UNIX file and socket descriptors.
Definition: DwmDescriptor.hh:62
virtual bool Getpeername(struct sockaddr *name, socklen_t &namelen)
Calls the UNIX getpeername(2) function. Returns true on success,.
virtual bool Connect(const struct sockaddr_in &name)
Calls the UNIX connect(2) function.