Debian Codegraph @

src/UDSocket.hpp

raw
1 // UDSocket class - implements BaseSocket for UNIX domain sockets
2
3 // For all support, instructions and copyright go to:
4 // http://e2guardian.org/
5 // Released under the GPL v2, with the OpenSSL exception described in the README file.
6
7 #ifndef __HPP_UDSOCKET
8 #define __HPP_UDSOCKET
9
10 // INCLUDES
11
12 #include "BaseSocket.hpp"
13
14 // DECLARATIONS
15
16 class UDSocket : public BaseSocket
17 {
18 public:
19 // create default UNIX domain socket & clear address structs
20 UDSocket();
21 // create socket from pre-existing FD (address structs will be empty!)
22 UDSocket(int fd);
23 // create socket from FD & local path (checkme: is it actually local that gets passed?)
24 UDSocket(int newfd, struct sockaddr_un myadr);
25
26 // connect socket to given server (following default constructor)
27 int connect(const char *path);
28 // bind socket to given path (for creating servers)
29 int bind(const char *path);
30
31 // accept incoming connection & return new UDSocket
32 UDSocket *accept();
33
34 // close connection & clear address structs
35 void reset();
36
37 private:
38 // local & remote address structs
39 struct sockaddr_un my_adr;
40 struct sockaddr_un peer_adr;
41 socklen_t my_adr_length;
42 };
43
44 #endif