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"
23 /* a router maintains a list of server classes */
24 struct _osrfRouterStruct {
26 osrfHash* classes; /**< our list of server classes */
27 char* domain; /**< Domain name of Jabber server. */
28 char* name; /**< Router's username for the Jabber logon. */
29 char* resource; /**< Router's resource name for the Jabber logon. */
30 char* password; /**< Router's password for the Jabber logon. */
31 int port; /**< Jabber's port number. */
32 sig_atomic_t stop; /**< To be set by signal handler to interrupt main loop */
34 osrfStringArray* trustedClients;
35 osrfStringArray* trustedServers;
37 transport_client* connection;
40 typedef struct _osrfRouterStruct osrfRouter;
43 Allocates a new router.
44 @param domain The jabber domain to connect to
45 @param name The login name for the router
46 @param resource The login resource for the router
47 @param password The login password for the new router
48 @param port The port to connect to the jabber server on
49 @param trustedClients The array of client domains that we allow to send requests through us
50 @param trustedServers The array of server domains that we allow to register, etc. with ust.
51 @return The allocated router or NULL on memory error
53 osrfRouter* osrfNewRouter( const char* domain, const char* name, const char* resource,
54 const char* password, int port, osrfStringArray* trustedClients,
55 osrfStringArray* trustedServers );
58 Connects the given router to the network
60 int osrfRouterConnect( osrfRouter* router );
63 Waits for incoming data to route
64 If this function returns, then the router's connection to the jabber server
67 void osrfRouterRun( osrfRouter* router );
69 void router_stop( osrfRouter* router );
74 void osrfRouterFree( osrfRouter* router );
77 Handles connects, disconnects, etc.
79 //int osrfRouterHandeStatusMessage( osrfRouter* router, transport_message* msg );
82 Handles REQUEST messages
84 //int osrfRouterHandleRequestMessage( osrfRouter* router, transport_message* msg );