]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/router/osrf_router.h
In osrf_json_gateway.c: added the const qualifier to three
[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 #ifdef __cplusplus
20 extern "C" {
21 #endif
22
23 /* a router maintains a list of server classes */
24 struct _osrfRouterStruct {
25
26         osrfHash* classes;      /* our list of server classes */
27         char* domain;                   /* our login domain */
28         char* name;
29         char* resource;
30         char* password;
31         int port;
32
33         osrfStringArray* trustedClients;
34         osrfStringArray* trustedServers;
35
36         transport_client* connection;
37 };
38
39 typedef struct _osrfRouterStruct osrfRouter;
40
41 /**
42   Allocates a new router.  
43   @param domain The jabber domain to connect to
44   @param name The login name for the router
45   @param resource The login resource for the router
46   @param password The login password for the new router
47   @param port The port to connect to the jabber server on
48   @param trustedClients The array of client domains that we allow to send requests through us
49   @param trustedServers The array of server domains that we allow to register, etc. with ust.
50   @return The allocated router or NULL on memory error
51   */
52 osrfRouter* osrfNewRouter( const char* domain, const char* name, const char* resource, 
53         const char* password, int port, osrfStringArray* trustedClients,
54         osrfStringArray* trustedServers );
55
56 /**
57   Connects the given router to the network
58   */
59 int osrfRouterConnect( osrfRouter* router );
60
61 /**
62   Waits for incoming data to route
63   If this function returns, then the router's connection to the jabber server
64   has failed.
65   */
66 void osrfRouterRun( osrfRouter* router );
67
68
69 /**
70   Frees a router
71   */
72 void osrfRouterFree( osrfRouter* router );
73
74 /**
75   Handles connects, disconnects, etc.
76   */
77 //int osrfRouterHandeStatusMessage( osrfRouter* router, transport_message* msg );
78
79 /**
80   Handles REQUEST messages 
81   */
82 //int osrfRouterHandleRequestMessage( osrfRouter* router, transport_message* msg );
83
84 #ifdef __cplusplus
85 }
86 #endif
87
88 #endif
89