|
From: <mrv...@us...> - 2007-06-02 07:08:10
|
Revision: 23
http://svn.sourceforge.net/dawnofinfinity/?rev=23&view=rev
Author: mrvacbob
Date: 2007-06-02 00:08:08 -0700 (Sat, 02 Jun 2007)
Log Message:
-----------
data members for net
Modified Paths:
--------------
trunk/net.h
trunk/tests.cpp
Modified: trunk/net.h
===================================================================
--- trunk/net.h 2007-06-02 05:24:14 UTC (rev 22)
+++ trunk/net.h 2007-06-02 07:08:08 UTC (rev 23)
@@ -27,10 +27,53 @@
#ifndef _NET_H
#define _NET_H
-/// Listen to listening socket, poll clients.
+typedef union packetinternals {
+ struct {
+ uint16_t type;
+ uint16_t size;
+ };
+
+ unsigned char data[0];
+} *Packet;
+
+
+struct Connection : public Object
+{
+ Queue<Packet> transmitq_tcp, transmitq_udp;
+ Packet *curp, *curp_udp;
+
+ int sock, sock_udp;
+
+ ssize_t recv_remain, recv_done;
+ ssize_t send_remain, send_done;
+
+ struct ConnectionGroup *parent;
+
+ Packet *recievebuf;
+
+ struct ConnCallbacKContext *ccontext;
+};
+
+/// Handles multicasting and callbacks. One per system.
+struct ConnectionGroup : public Object
+{
+ Set<Connection> connections;
+
+ struct ConnCallback *callback;
+};
+
+/// Listen to listening socket, poll clients. One per port.
struct NetInterface : public Object
{
+ fd_set active_fds;
+ fd_set writing_fds;
-}
+ int lsock;
+
+ long highfd;
+ const char *port; // what does this do
+
+ Set<ConnectionGroup> cgroups;
+};
#endif
\ No newline at end of file
Modified: trunk/tests.cpp
===================================================================
--- trunk/tests.cpp 2007-06-02 05:24:14 UTC (rev 22)
+++ trunk/tests.cpp 2007-06-02 07:08:08 UTC (rev 23)
@@ -1,6 +1,7 @@
#include "set.h"
#include "queue.h"
#include "list.h"
+#include "net.h"
void test_set()
{
@@ -37,6 +38,13 @@
printf("\n");
}
+NetInterface *n;
+
+void test_net()
+{
+ n = new NetInterface();
+}
+
#undef main
int main(int argc, char **argv)
@@ -44,5 +52,6 @@
test_set();
test_queue();
test_list();
+ test_net();
return 0;
}
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|