00001
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef _CORBA_DISCOVERY_H_
00036 #define _CORBA_DISCOVERY_H_
00037
00038 #include "sensingC.h"
00039 #include "discovery_service.h"
00040
00041 #define EXTERNAL_DISCOVERY 0
00042
00043
00044 namespace sensix {
00045 namespace discovery {
00046
00047 class AncestorsImpl : Ancestors {
00048 public:
00049 AncestorsImpl();
00050
00051 CORBA::Boolean findNode(NodeId id);
00052 NodeList *nodes();
00053 };
00054
00055
00056 class SiblingsImpl : Siblings {
00057 private:
00058 CORBA::ORB_ptr orb;
00059
00060 public:
00061 SiblingsImpl();
00062 SiblingsImpl(CORBA::ORB_ptr ptr);
00063
00064 CORBA::Boolean findNode(NodeId id);
00065 NodeList *nodes();
00066
00067 CapabilityList *capabilities();
00068 RequestList *queryNetwork(CORBA::Octet capability);
00069 Request_ptr queryNode(NodeId id, CORBA::Octet capability);
00070 };
00071
00072
00073 class DescendantsImpl : Descendants {
00074 private:
00075 CORBA::ORB_ptr orb;
00076
00077 public:
00078 DescendantsImpl();
00079 DescendantsImpl(CORBA::ORB_ptr ptr);
00080
00081 CORBA::Boolean findNode(NodeId id);
00082 NodeList *nodes();
00083
00084 CapabilityList *capabilities();
00085 RequestList *queryNetwork(CORBA::Octet capability);
00086 Request_ptr queryNode(NodeId id, CORBA::Octet capability);
00087 };
00088
00089
00090 class OthersImpl : Others {
00091 private:
00092 CORBA::ORB_ptr orb;
00093 AncestorsImpl *parents;
00094 SiblingsImpl *sisters;
00095 DescendantsImpl *children;
00096
00097 public:
00098 OthersImpl(CORBA::ORB_ptr ptr);
00099
00100 Ancestors_ptr ancestors();
00101 Siblings_ptr siblings();
00102 Descendants_ptr descendants();
00103
00104 CORBA::Boolean findNode(NodeId id);
00105 RequestList *queryNetwork(CORBA::Octet capability);
00106 Request_ptr queryNode(NodeId id, CORBA::Octet capability);
00107 };
00108
00109
00110 class DiscoveryService : Self {
00111 private:
00112 CORBA::ORB_ptr orb;
00113 pthread_t ds;
00114 OthersImpl *family;
00115
00116 public:
00117 DiscoveryService(CORBA::ORB_ptr ptr, uint32_t id, uint8_t lvl,
00118 int port=DISCOVERY_PORT);
00119 ~DiscoveryService();
00120
00121 void shutdown();
00122
00123 CORBA::Octet level();
00124 NodeId identifier();
00125 CapabilityList *capabilities();
00126
00127 void registerObject(CORBA::Octet capability, Request_var obj);
00128
00129 CORBA::Boolean findNodeInFamily(NodeId id);
00130 RequestList *queryFamilyNetwork(CORBA::Octet capability);
00131 Request_ptr queryFamilyNode(NodeId id, CORBA::Octet capability);
00132
00133 CORBA::Boolean findNodeInDescendants(NodeId id);
00134 RequestList *queryDescendantNetwork(CORBA::Octet capability);
00135 Request_ptr queryDescendantNode(NodeId id, CORBA::Octet capability);
00136 CapabilityList *descendantCapabilities();
00137 NodeList *descendantNodes();
00138
00139 CORBA::Boolean findNodeInSiblings(NodeId id);
00140 RequestList *querySiblingNetwork(CORBA::Octet capability);
00141 Request_ptr querySiblingNode(NodeId id, CORBA::Octet capability);
00142 CapabilityList *siblingCapabilities();
00143 NodeList *siblingNodes();
00144
00145 CORBA::Boolean findNodeInAncestors(NodeId id);
00146 NodeList *ancestorNodes();
00147 };
00148
00149 }
00150 }
00151
00152
00153 #endif // _CORBA_DISCOVERY_H_