]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/router/osrf_router.h
Adding comments and tinkering with white space.
[OpenSRF.git] / src / router / osrf_router.h
1 #ifndef OSRF_ROUTER_H
2 #define OSRF_ROUTER_H
3
4 /**
5         @file 
6         @brief Collection of routines for an OSRF router.
7
8         The router receives messages from clients and passes each one to a listener for the
9         targeted service.  Where there are multiple listeners for the same service, the router
10         picks one on a round-robin basis.  If a message bounces because the listener has died,
11         the router sends it to another listener for the same service, if one is available.
12
13         The server's response to the client, if any, bypasses the router.  If the server needs to
14         set up a stateful session with a client, it does so directly (well, via Jabber).  Only the
15         initial message from the client passes through the router.
16
17         Thus the router serves two main functions:
18         - It spreads the load across multiple listeners for the same service.
19         - It reroutes bounced messages to alternative listeners.
20
21         It also responds to requests for information about the number of messages routed to
22         different services and listeners.
23 */
24
25 /*
26         Prerequisite:
27
28                 string_array.h
29 */
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 struct osrfRouterStruct;
35 typedef struct osrfRouterStruct osrfRouter;
36
37 osrfRouter* osrfNewRouter( const char* domain, const char* name, const char* resource,
38         const char* password, int port, osrfStringArray* trustedClients,
39         osrfStringArray* trustedServers );
40
41 int osrfRouterConnect( osrfRouter* router );
42
43 void osrfRouterRun( osrfRouter* router );
44
45 void router_stop( osrfRouter* router );
46
47 void osrfRouterFree( osrfRouter* router );
48
49 #ifdef __cplusplus
50 }
51 #endif
52
53 #endif
54