directory interface c++ header files. I'm still figuring out how exactly all this stuff is gonig to work, but I'm just trying to give you guys a taste of what to expect, the code's still in progress.

brs2001 [2002-04-12 20:03:10]
directory interface c++ header files. I'm still figuring out how exactly all this stuff is gonig to work, but I'm just trying to give you guys a taste of what to expect, the code's still in progress.
Filename
di_cxx/DIBase.h
di_cxx/DIHost.h
di_cxx/DIMessage.h
di_cxx/DIMessageBody.h
di_cxx/DIMutex.h
di_cxx/DISubscription.h
di_cxx/DIThread.h
di_cxx/DIType.h
di_cxx/DIZone.h
di_cxx/DirectoryInterface.h
diff --git a/di_cxx/DIBase.h b/di_cxx/DIBase.h
new file mode 100644
index 0000000..f4b0a1d
--- /dev/null
+++ b/di_cxx/DIBase.h
@@ -0,0 +1,7 @@
+#ifndef __DIRECTORY_INTERFACE_BASE__
+#define __DIRECTORY_INTERFACE_BASE__
+
+#include "DIThread.h"
+#include "DIMutex.h"
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DIHost.h b/di_cxx/DIHost.h
new file mode 100644
index 0000000..b34e2d2
--- /dev/null
+++ b/di_cxx/DIHost.h
@@ -0,0 +1,53 @@
+#ifndef __DIRECTORY_INTERFACE_HOST__
+#define __DIRECTORY_INTERFACE_HOST__
+
+
+//dependencies
+#include "DIType.h"
+
+
+//predeclare
+class DirectoryInterface;
+
+
+//helper types
+typedef unsigned int DIHostID;
+
+
+//host modes
+#define DI_HOST_MODE_LEAF 1
+#define DI_HOST_MODE_NORMAL 2
+#define DI_HOST_MODE_ZONE 3
+
+
+//class definition
+class DIHost
+{
+	friend class DirectoryInterface;
+
+	public:
+		DIHost( DIHostID *setIdent, DIType *setType, char *setInfo, int length, int setMode );
+		~DIHost( void );
+
+		void setHostType( DIType *setType );
+		void setHostInfo( char *setInfo, int length );
+		void setHostID( DIHostID *setIdent );
+		void setHostMode( int setMode );
+
+		DIType getHostType( void );
+		char *getHostInfo( int *length );
+		int getHostMode( void );
+		void getHostID( DIHostID *getID );
+
+	private:
+		class DIHost *nextType;
+		class DIHost *nextID;
+
+		DIHostID *identifier;
+		DIType type;
+		char *info;
+		int infoLength;
+		int mode;
+};
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DIMessage.h b/di_cxx/DIMessage.h
new file mode 100644
index 0000000..e2b973b
--- /dev/null
+++ b/di_cxx/DIMessage.h
@@ -0,0 +1,27 @@
+#ifndef __DIRECTORY_INTERFACE_MESSAGE__
+#define __DIRECTORY_INTERFACE_MESSAGE__
+
+//dependencies
+#include "DIMessageBody.h"
+#include "DIType.h"
+#include "DIHost.h"
+
+
+//message definition
+class DIMessage
+{
+	public:
+		DIMessage( DIType *setType, DIMessageBody *setBody, DIHost *setSender );
+		~DIMessage( void );
+
+		DIType getType( void );
+		DIMessageBody *getBody( void );
+		DIHost *getSender( void );
+
+	private:
+		DIType type;
+		DIMessageBody *body;
+		DIHost *sender;
+};
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DIMessageBody.h b/di_cxx/DIMessageBody.h
new file mode 100644
index 0000000..379cbfe
--- /dev/null
+++ b/di_cxx/DIMessageBody.h
@@ -0,0 +1,17 @@
+#ifndef __DIRECTORY_INTERFACE_BODY__
+#define __DIRECTORY_INTERFACE_BODY__
+
+class DIMessageBody
+{
+	public:
+		DIMessageBody( char *msgData, int length );
+		~DIMessageBody( void );
+
+		char *getData( int *length );
+
+	private:
+		char *data;
+		int dataLength;
+};
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DIMutex.h b/di_cxx/DIMutex.h
new file mode 100644
index 0000000..e25f267
--- /dev/null
+++ b/di_cxx/DIMutex.h
@@ -0,0 +1,16 @@
+#ifndef __DIRECTORY_INTERFACE_MUTEX__
+#define __DIRECTORY_INTERFACE_MUTEX__
+
+//mutex definition
+class DIMutex
+{
+	public:
+		DIMutex( void );
+		~DIMutex( void );
+
+		void lock( void );
+		void unlock( void );
+		int trylock( void );
+}
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DISubscription.h b/di_cxx/DISubscription.h
new file mode 100644
index 0000000..709779f
--- /dev/null
+++ b/di_cxx/DISubscription.h
@@ -0,0 +1,32 @@
+#ifndef __DIRECTORY_INTERFACE_SUBSCRIPTION__
+#define __DIRECTORY_INTERFACE_SUBSCRIPTION__
+
+//no need for dependencies, always included through DIAccessor
+
+
+//utility classes
+class DISubscriber
+{
+	public:
+		DISubscriber( DIEventReceiver *setReceiver );
+
+		class DISubscriber *next;
+		DIEventReceiver *receiver;
+};
+
+
+//subscription definition
+class DISubscription
+{
+	public:
+		DISubscription( DIType *subType );
+		~DISubscription( void );
+
+	private:
+		class DISubscription *next;
+
+		DIType type;
+		DISubscriber *subscribers;
+};
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DIThread.h b/di_cxx/DIThread.h
new file mode 100644
index 0000000..e69de29
diff --git a/di_cxx/DIType.h b/di_cxx/DIType.h
new file mode 100644
index 0000000..89706e9
--- /dev/null
+++ b/di_cxx/DIType.h
@@ -0,0 +1,15 @@
+#ifndef __DIRECTORY_INTERFACE_TYPE__
+#define __DIRECTORY_INTERFACE_TYPE__
+
+class DIType
+{
+	public:
+		DIType( char *setType );
+		DIType( unsigned int a, unsigned int b, unsigned in c );
+
+		unsigned int a;
+		unsigned int b;
+		unsigned int c;
+};
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DIZone.h b/di_cxx/DIZone.h
new file mode 100644
index 0000000..d9eaf4b
--- /dev/null
+++ b/di_cxx/DIZone.h
@@ -0,0 +1,32 @@
+#ifndef __DIRECTORY_INTERFACE_ZONE__
+#define __DIRECTORY_INTERFACE_ZONE__
+
+//predeclare
+class DirectoryInterface;
+
+
+//connection modes
+#define DI_MODE_INFRASTRUCTURE 1
+#define DI_MODE_LEAF 2
+
+
+//zone definition
+class DIZone
+{
+	friend class DirectoryInterface;
+
+	public:
+		DIZone( char *setAddress, int setPort, int setMode );
+		~DIZone( void );
+
+	private:
+		class DIZone *next;
+
+		char *address;
+		int port;
+		int mode;
+
+		elvin_handle_t elvinHandle;
+}
+
+#endif
\ No newline at end of file
diff --git a/di_cxx/DirectoryInterface.h b/di_cxx/DirectoryInterface.h
new file mode 100644
index 0000000..03b708a
--- /dev/null
+++ b/di_cxx/DirectoryInterface.h
@@ -0,0 +1,90 @@
+#ifndef __CHIME4_DIRECTORY_INTERFACE__
+#define __CHIME4_DIRECTORY_INTERFACE_ACCESSOR__
+
+//dependencies
+#include "DIBase.h"
+#include "DIType.h"
+#include "DIEvent.h"
+#include "DIMessage.h"
+#include "DIHost.h"
+#include "DIZone.h"
+#include "DISubscription.h"
+
+
+//hash stuff
+#define DI_NODE_TYPE_HASH_SIZE
+#define DI_NODE_ID_HASH_SIZE
+#define DI_SUBSCRIPTION_HASH_SIZE
+#define DI_SEARCH_HASH_SIZE
+
+
+//event types
+
+
+
+//event receiver abc
+class DIEventReceiver
+{
+	public:
+		virtual void receiveEvent( DIEvent *event ) = 0;
+		virtual void receiveResult( DIHost *result ) = 0;
+		virtual void receiveMessage( DIHost *result ) = 0;
+};
+
+
+//accessor class
+class DirectoryInterface
+{
+	public:
+		static void initialize( DIEventReceiver *setMaster );
+		static void shutdown( void );
+
+		static void connect( char *address, int port, int mode );
+		static void disconnect( DIZone *disZone );
+
+		static void update( DIType *hostType, char *metaInfo, int length );
+		static void search( DIEventReceiver *receiver, DIType *searchType );
+
+		static void subscribe( DIEventReceiver *receiver, DIType *subType );
+		static void unsubscribe( DIEventReceiver *receiver, DIType *subType );
+		static void publish( DIType *msgType, DIMessageBody *msgBody );
+
+		static void communicate( DIHost *comHost, DIType *msgType, DIMessageBody *msgBody );
+
+		static void promote( void );
+		static void demote( void );
+
+
+	private:
+		//elvin layer
+		static void receiveLocalMessage(	elvin_handle_t handle,
+											elvin_subscription_t sub,
+											elvin_notification_t notif,
+											int is_secure,
+											void *rock,
+											elvin_error_t error);
+
+		static void receiveZoneMessage(		elvin_handle_t handle,
+											elvin_subscription_t sub,
+											elvin_notification_t notif,
+											int is_secure,
+											void *rock,
+											elvin_error_t error);
+
+		DIZone *zones;
+
+		DIHost *nodeTypeHash[DI_NODE_TYPE_HASH_SIZE];
+		DIHost *nodeIDHash[DI_NODE_ID_HASH_SIZE];
+
+		DISubscription *subHash[DI_SUBSCRIPTION_HASH_SIZE];
+		DISubscription *searchHash[DI_SEARCH_HASH_SIZE];
+
+
+		static DIEventReceiver *master;
+};
+
+
+//elvin receiver
+
+
+#endif
\ No newline at end of file