]> git.evergreen-ils.org Git - Evergreen.git/blob - OpenSRF/src/srfsh/srfsh.h
28a62c032b3ae75b84ba7b254be44319cbd8d0d1
[Evergreen.git] / OpenSRF / 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 /* true if we're bypassing 'less' */
39 int raw_print = 0;
40
41 /* our jabber connection */
42 transport_client* client = NULL; 
43
44 /* the last result we received */
45 osrf_message* last_result = NULL;
46
47 /* functions */
48 int parse_request( char* request );
49
50 /* handles router requests */
51 int handle_router( char* words[] );
52
53 /* utility method for print time data */
54 int handle_time( char* words[] );
55
56 /* handles app level requests */
57 int handle_request( char* words[], int relay );
58 int handle_exec(char* words[], int new_shell);
59 int handle_set( char* words[]);
60 int handle_print( char* words[]);
61 int send_request( char* server, 
62                 char* method, growing_buffer* buffer, int relay );
63 int parse_error( char* words[] );
64 int router_query_servers( char* server );
65 int srfsh_client_connect();
66 int print_help();
67 char* json_printer( char* string );
68 char* tabs(int count);
69 void sig_child_handler( int s );
70 void sig_int_handler( int s );
71
72 int load_history();
73 int handle_math( char* words[] );
74 int do_math( int count, int style );
75 int handle_introspect(char* words[]);
76 int handle_login( char* words[]);
77 char* md5sum( char* text );