raw: Add socket_manager.h.
authorRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 4 Jun 2011 16:03:21 +0000 (19:03 +0300)
committerRazvan Deaconescu <razvan.deaconescu@cs.pub.ro>
Sat, 4 Jun 2011 17:47:07 +0000 (20:47 +0300)
Wrapper for socket management functions. We are aming for two
implementations: list-based and array-based.

src/raw/include/socket_manager.h [new file with mode: 0644]

diff --git a/src/raw/include/socket_manager.h b/src/raw/include/socket_manager.h
new file mode 100644 (file)
index 0000000..e412da4
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Socket management interface.
+ *
+ * 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
+ */
+
+#ifndef SOCKET_MANAGER_H_
+#define SOCKET_MANAGER_H_      1
+
+#include <netinet/in.h>
+
+/*
+ * Add new socket to list. Called by sw_socket "syscall".
+ */
+
+int sm_add(int s);
+
+/*
+ * Bind socket to given address. Called by sw_bind "syscall".
+ */
+
+int sm_update_address(int s, const struct sockaddr *addr);
+
+/*
+ * Remove socket from list. Called by sw_close "syscall".
+ */
+
+int sm_del(int s);
+
+/*
+ * Check if a socket is bound.
+ */
+
+int sm_is_bound(int s);
+
+/*
+ * Mark socket as bound.
+ */
+
+int sm_mark_bound(int s);
+
+/*
+ * Mark socket as unbound.
+ */
+
+int sm_mark_unbound(int s);
+
+/*
+ * Check if adress is asociated with a given socket.
+ */
+
+int sm_address_exists(const struct sockaddr *addr);
+
+/*
+ * Find socket address.
+ */
+
+struct sockaddr *sm_get_address(int s);
+
+#endif