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