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"
15 #include <readline/readline.h>
16 #include <readline/history.h>
21 #define SRFSH_PORT 5222
22 #define COMMAND_BUFSIZE 4096
26 char* prompt = "srfsh# ";
28 char* history_file = NULL;
32 char* login_session = NULL;
34 /* true if we're pretty printing json results */
37 /* our jabber connection */
38 transport_client* client = NULL;
40 /* the last result we received */
41 osrf_message* last_result = NULL;
44 int parse_request( char* request );
46 /* handles router requests */
47 int handle_router( char* words[] );
49 /* utility method for print time data */
50 int handle_time( char* words[] );
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();
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 );
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 );