]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/router/osrf_router.h
Patch from Scott McKellar:
[OpenSRF.git] / src / router / osrf_router.h
1 #ifndef OSRF_ROUTER_H
2 #define OSRF_ROUTER_H
3
4 #include <sys/select.h>
5 #include <signal.h>
6 #include <stdio.h>
7
8 #include "opensrf/utils.h"
9 #include "opensrf/log.h"
10 #include "opensrf/osrf_list.h"
11 #include "opensrf/osrf_hash.h"
12
13 #include "opensrf/string_array.h"
14 #include "opensrf/transport_client.h"
15 #include "opensrf/transport_message.h"
16
17 #include "opensrf/osrf_message.h"
18
19
20
21 /* a router maintains a list of server classes */
22 struct _osrfRouterStruct {
23
24         osrfHash* classes;      /* our list of server classes */
25         char* domain;                   /* our login domain */
26         char* name;
27         char* resource;
28         char* password;
29         int port;
30
31         osrfStringArray* trustedClients;
32         osrfStringArray* trustedServers;
33
34         transport_client* connection;
35 };
36
37 typedef struct _osrfRouterStruct osrfRouter;
38
39 /**
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
49   */
50 osrfRouter* osrfNewRouter( const char* domain, const char* name, const char* resource, 
51         const char* password, int port, osrfStringArray* trustedClients,
52         osrfStringArray* trustedServers );
53
54 /**
55   Connects the given router to the network
56   */
57 int osrfRouterConnect( osrfRouter* router );
58
59 /**
60   Waits for incoming data to route
61   If this function returns, then the router's connection to the jabber server
62   has failed.
63   */
64 void osrfRouterRun( osrfRouter* router );
65
66
67 /**
68   Frees a router
69   */
70 void osrfRouterFree( osrfRouter* router );
71
72 /**
73   Handles connects, disconnects, etc.
74   */
75 //int osrfRouterHandeStatusMessage( osrfRouter* router, transport_message* msg );
76
77 /**
78   Handles REQUEST messages 
79   */
80 //int osrfRouterHandleRequestMessage( osrfRouter* router, transport_message* msg );
81
82 #endif
83