summaryrefslogtreecommitdiff
path: root/lib/server/Socket.h
diff options
context:
space:
mode:
authorBen Summers <ben@fluffy.co.uk>2005-10-14 08:50:54 +0000
committerBen Summers <ben@fluffy.co.uk>2005-10-14 08:50:54 +0000
commit99f8ce096bc5569adbfea1911dbcda24c28d8d8b (patch)
tree049c302161fea1f2f6223e1e8f3c40d9e8aadc8b /lib/server/Socket.h
Box Backup 0.09 with a few tweeks
Diffstat (limited to 'lib/server/Socket.h')
-rwxr-xr-xlib/server/Socket.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/server/Socket.h b/lib/server/Socket.h
new file mode 100755
index 00000000..86a06097
--- /dev/null
+++ b/lib/server/Socket.h
@@ -0,0 +1,47 @@
+// --------------------------------------------------------------------------
+//
+// File
+// Name: Socket.h
+// Purpose: Socket related stuff
+// Created: 2003/07/31
+//
+// --------------------------------------------------------------------------
+
+#ifndef SOCKET__H
+#define SOCKET__H
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <sys/un.h>
+
+#include <string>
+
+typedef union {
+ struct sockaddr sa_generic;
+ struct sockaddr_in sa_inet;
+ struct sockaddr_un sa_unix;
+} SocketAllAddr;
+
+// --------------------------------------------------------------------------
+//
+// Namespace
+// Name: Socket
+// Purpose: Socket utilities
+// Created: 2003/07/31
+//
+// --------------------------------------------------------------------------
+namespace Socket
+{
+ enum
+ {
+ TypeINET = 1,
+ TypeUNIX = 2
+ };
+
+ void NameLookupToSockAddr(SocketAllAddr &addr, int &sockDomain, int Type, const char *Name, int Port, int &rSockAddrLenOut);
+ void LogIncomingConnection(const struct sockaddr *addr, socklen_t addrlen);
+ std::string IncomingConnectionLogMessage(const struct sockaddr *addr, socklen_t addrlen);
+};
+
+#endif // SOCKET__H
+