]> git.evergreen-ils.org Git - OpenSRF.git/blob - src/srfsh/srfsh.h
removed all of the old libjson dependencies
[OpenSRF.git] / src / srfsh / srfsh.h
1 #include "opensrf/transport_client.h"
2 #include "opensrf/osrf_message.h"
3 #include "opensrf/osrf_app_session.h"
4 #include "opensrf/osrf_config.h"
5 #include <time.h>
6 #include <sys/timeb.h>
7
8 #include "md5.h"
9 #include "utils.h"
10 #include "logging.h"
11
12 #include <signal.h>
13
14 #include <stdio.h>
15 #include <readline/readline.h>
16 #include <readline/history.h>
17
18
19
20
21 #define SRFSH_PORT 5222
22 #define COMMAND_BUFSIZE 4096
23
24
25 /* shell prompt */
26 char* prompt = "srfsh# "; 
27
28 char* history_file = NULL;
29
30 int child_dead = 0;
31
32 char* login_session = NULL;
33
34 /* true if we're pretty printing json results */
35 int pretty_print = 1;
36
37 /* our jabber connection */
38 transport_client* client = NULL; 
39
40 /* the last result we received */
41 osrf_message* last_result = NULL;
42
43 /* functions */
44 int parse_request( char* request );
45
46 /* handles router requests */
47 int handle_router( char* words[] );
48
49 /* utility method for print time data */
50 int handle_time( char* words[] );
51
52 /* handles app level requests */
53 int handle_request( char* words[], int relay );
54 int handle_exec(char* words[]);
55 int handle_set( char* words[]);
56 int handle_print( char* words[]);
57 int send_request( char* server, 
58                 char* method, growing_buffer* buffer, int relay );
59 int parse_error( char* words[] );
60 int router_query_servers( char* server );
61 int srfsh_client_connect();
62 int print_help();
63 char* json_printer( char* string );
64 char* tabs(int count);
65 void sig_child_handler( int s );
66 void sig_int_handler( int s );
67
68 int load_history();
69 int handle_math( char* words[] );
70 int do_math( int count, int style );
71 int handle_introspect(char* words[]);
72 int handle_login( char* words[]);
73 char* md5sum( char* text );