4 #include <sys/select.h>
8 #include "opensrf/utils.h"
9 #include "opensrf/log.h"
10 #include "opensrf/osrf_list.h"
11 #include "opensrf/osrf_hash.h"
13 #include "opensrf/string_array.h"
14 #include "opensrf/transport_client.h"
15 #include "opensrf/transport_message.h"
17 #include "opensrf/osrf_message.h"
21 /* a router maintains a list of server classes */
22 struct _osrfRouterStruct {
24 osrfHash* classes; /* our list of server classes */
25 char* domain; /* our login domain */
31 osrfStringArray* trustedClients;
32 osrfStringArray* trustedServers;
34 transport_client* connection;
37 typedef struct _osrfRouterStruct osrfRouter;
40 Allocates a new router.
41 @param domain The jabber domain to connect to
42 @param name The login name for the router
43 @param resource The login resource for the router
44 @param password The login password for the new router
45 @param port The port to connect to the jabber server on
46 @param trustedClients The array of client domains that we allow to send requests through us
47 @param trustedServers The array of server domains that we allow to register, etc. with ust.
48 @return The allocated router or NULL on memory error
50 osrfRouter* osrfNewRouter( const char* domain, const char* name, const char* resource,
51 const char* password, int port, osrfStringArray* trustedClients,
52 osrfStringArray* trustedServers );
55 Connects the given router to the network
57 int osrfRouterConnect( osrfRouter* router );
60 Waits for incoming data to route
61 If this function returns, then the router's connection to the jabber server
64 void osrfRouterRun( osrfRouter* router );
70 void osrfRouterFree( osrfRouter* router );
73 Handles connects, disconnects, etc.
75 //int osrfRouterHandeStatusMessage( osrfRouter* router, transport_message* msg );
78 Handles REQUEST messages
80 //int osrfRouterHandleRequestMessage( osrfRouter* router, transport_message* msg );