]> git.evergreen-ils.org Git - working/Evergreen.git/blob - OpenSRF/src/srfsh/srfsh.h
new json api changes
[working/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 <time.h>
5 #include <sys/timeb.h>
6 #include <sys/types.h>
7 #include <sys/wait.h>
8
9 #include "md5.h"
10 #include "utils.h"
11 #include "logging.h"
12
13 #include <signal.h>
14
15 #include <stdio.h>
16 #include <readline/readline.h>
17 #include <readline/history.h>
18
19
20
21
22 #define SRFSH_PORT 5222
23 #define COMMAND_BUFSIZE 4096
24
25
26 /* shell prompt */
27 char* prompt = "srfsh# "; 
28
29 char* history_file = NULL;
30
31 int child_dead = 0;
32
33 char* login_session = NULL;
34
35 /* true if we're pretty printing json results */
36 int pretty_print = 1;
37 /* true if we're bypassing 'less' */
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[], int new_shell);
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* tabs(int count);
67 void sig_child_handler( int s );
68 void sig_int_handler( int s );
69
70 int load_history();
71 int handle_math( char* words[] );
72 int do_math( int count, int style );
73 int handle_introspect(char* words[]);
74 int handle_login( char* words[]);
75 char* md5sum( char* text );