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