libsocket
unixdgram.hpp
Go to the documentation of this file.
1 #ifndef LIBSOCKET_UNIXDGRAM_H_B1DCD9EE9E7E4B379FD5FCA79EF4B63F
2 #define LIBSOCKET_UNIXDGRAM_H_B1DCD9EE9E7E4B379FD5FCA79EF4B63F
3 
4 #include "unixbase.hpp"
5 
11 /*
12  The committers of the libsocket project, all rights reserved
13  (c) 2012, dermesser <lbo@spheniscida.de>
14 
15  Redistribution and use in source and binary forms, with or without
16  modification, are permitted provided that the following conditions are met:
17 
18  1. Redistributions of source code must retain the above copyright notice,
19  this list of conditions and the following disclaimer.
20  2. Redistributions in binary form must reproduce the above copyright notice,
21  this list of conditions and the following disclaimer in the documentation
22  and/or other materials provided with the distribution.
23 
24  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS “AS IS” AND ANY
25  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27  DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
28  DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29  (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 
35 */
36 
37 namespace libsocket {
45 class unix_dgram : public unix_socket {
46  public:
47  ssize_t sndto(const void* buf, size_t length, const char* path,
48  int sendto_flags = 0);
49  ssize_t sndto(const void* buf, size_t length, const string& path,
50  int sendto_flags = 0);
51 
52  ssize_t sndto(const string& buf, const string& path, int sendto_flags = 0);
53 
54  ssize_t rcvfrom(void* buf, size_t length, char* source, size_t source_len,
55  int recvfrom_flags = 0);
56  ssize_t rcvfrom(void* buf, size_t length, string& source,
57  int recvfrom_flags = 0);
58 
59  ssize_t rcvfrom(string& buf, string& source, int recvfrom_flags = 0);
60 };
64 } // namespace libsocket
65 
66 #endif
Contains libsocket elements.
Definition: dgramclient.hpp:41
ssize_t sndto(const void *buf, size_t length, const char *path, int sendto_flags=0)
Send data to datagram socket.
Definition: unixdgram.cpp:59
Base class for all UNIX socket classes.
Definition: unixbase.hpp:53
Generic class for all UNIX datagram (DGRAM) sockets, implementing i/o functions.
Definition: unixdgram.hpp:45
ssize_t rcvfrom(void *buf, size_t length, char *source, size_t source_len, int recvfrom_flags=0)
Receive data and store the sender's address.
Definition: unixdgram.cpp:124