2 * The Regina Rexx Interpreter
3 * Copyright (C) 2000 Mark Hessling <M.Hessling@qut.edu.au>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the Free
17 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "rexxbif.h" /* C functions that mimic REXX BIFs */
26 void showerror( int err
, int suberr
, char *tmpl
, ...);
27 int init_external_queue( const tsd_t
*TSD
);
28 void term_external_queue( void );
29 int get_default_port_number( void );
30 int get_default_server_address( void );
31 int connect_to_rxstack( tsd_t
*TSD
, int portno
, streng
*server_name
, int server_address
) ;
32 int disconnect_from_rxstack( const tsd_t
*TSD
, int sock
);
33 int parse_queue( tsd_t
*TSD
, streng
*queue
, streng
**server_name
, int *server_address
, int *portno
);
34 int send_command_to_rxstack( const tsd_t
*TSD
, int sock
, char *action
, char *str
, int len
);
35 streng
*read_result_from_rxstack( const tsd_t
*TSD
, int sock
, int result_size
);
36 int delete_queue_from_rxstack( const tsd_t
*TSD
, int sock
, streng
*queue_name
);
37 int set_queue_in_rxstack( const tsd_t
*TSD
, int sock
, streng
*queue_name
, streng
**result
);
38 int get_number_in_queue_from_rxstack( const tsd_t
*TSD
, int sock
);
39 int get_queue_from_rxstack( const tsd_t
*TSD
, int sock
, streng
**result
);
40 int create_queue_on_rxstack( const tsd_t
*TSD
, int sock
, streng
*queue
, streng
**result
);
41 int timeout_queue_on_rxstack( const tsd_t
*TSD
, int sock
, long timeout
);
42 int get_line_from_rxstack( const tsd_t
*TSD
, int sock
, streng
**result
);
43 int queue_line_lifo_to_rxstack( const tsd_t
*TSD
, int sock
, streng
*line
);
44 int queue_line_fifo_to_rxstack( const tsd_t
*TSD
, int sock
, streng
*line
);
45 int get_length_from_header( const tsd_t
*TSD
, streng
*header
);
47 #define RXSTACK_EXIT 'X'
48 #define RXSTACK_EXIT_STR "X"
49 #define RXSTACK_KILL 'Z'
50 #define RXSTACK_KILL_STR "Z"
51 #define RXSTACK_QUEUE_FIFO 'F'
52 #define RXSTACK_QUEUE_FIFO_STR "F"
53 #define RXSTACK_QUEUE_LIFO 'L'
54 #define RXSTACK_QUEUE_LIFO_STR "L"
55 #define RXSTACK_CREATE_QUEUE 'C'
56 #define RXSTACK_CREATE_QUEUE_STR "C"
57 #define RXSTACK_DELETE_QUEUE 'D'
58 #define RXSTACK_DELETE_QUEUE_STR "D"
59 #define RXSTACK_EMPTY_QUEUE 'E'
60 #define RXSTACK_EMPTY_QUEUE_STR "E"
61 #define RXSTACK_PULL 'P'
62 #define RXSTACK_PULL_STR "P"
63 #define RXSTACK_SET_QUEUE 'S'
64 #define RXSTACK_SET_QUEUE_STR "S"
65 #define RXSTACK_GET_QUEUE 'G'
66 #define RXSTACK_GET_QUEUE_STR "G"
67 #define RXSTACK_NUMBER_IN_QUEUE 'N'
68 #define RXSTACK_NUMBER_IN_QUEUE_STR "N"
69 #define RXSTACK_TIMEOUT_QUEUE 'T'
70 #define RXSTACK_TIMEOUT_QUEUE_STR "T"
71 #define RXSTACK_WRITE_QUEUE 'W'
72 #define RXSTACK_WRITE_QUEUE_STR "W"
73 #define RXSTACK_UNKNOWN '?'
74 #define RXSTACK_UNKNOWN_STR "?"
75 #define RXSTACK_HEADER_SIZE 7
76 #define RXSTACK_TIMEOUT_SIZE 6
79 # define RXSOCKET 5757
82 #define ERR_RXSTACK_CANT_CONNECT 101
83 #define ERR_RXSTACK_CANT_CONNECT_TMPL "Error connecting to %s on port %d: \"%s\""
84 #define ERR_RXSTACK_NO_IP 102
85 #define ERR_RXSTACK_NO_IP_TMPL "Unable to obtain IP address for %s"
86 #define ERR_RXSTACK_INVALID_SERVER 103
87 #define ERR_RXSTACK_INVALID_SERVER_TMPL "Invalid format for server in specified queue name: \"%s\""
88 #define ERR_RXSTACK_INVALID_QUEUE 104
89 #define ERR_RXSTACK_INVALID_QUEUE_TMPL "Invalid format for queue name: \"%s\""
90 #define ERR_RXSTACK_NO_WINSOCK 105
91 #define ERR_RXSTACK_NO_WINSOCK_TMPL "Unable to start Windows Socket interface: %s"
92 #define ERR_RXSTACK_TOO_MANY_QUEUES 106
93 #define ERR_RXSTACK_TOO_MANY_QUEUES_TMPL "Maximum number of external queues exceeded: %d"
94 #define ERR_RXSTACK_READING_SOCKET 107
95 #define ERR_RXSTACK_READING_SOCKET_TMPL "Error occured reading socket: %s"
96 #define ERR_RXSTACK_INVALID_SWITCH 108
97 #define ERR_RXSTACK_INVALID_SWITCH_TMPL "Invalid switch passed. Must be one of \"%s\""
99 #define ERR_RXSTACK_INTERNAL 99
100 #define ERR_RXSTACK_INTERNAL_TMPL "Internal error with external queue interface: %d \"%s\""
101 #define ERR_RXSTACK_GENERAL 100
102 #define ERR_RXSTACK_GENERAL_TMPL "General system error with external queue interface. %s. %s"
104 #define ERR_STORAGE_EXHAUSTED_TMPL "System resources exhausted"