64 #include <sys/unistd.h> 65 #include <libxml/xmlversion.h> 98 info(0,
"Connected to bearerbox at %s port %d using SSL.",
101 info(0,
"Connected to bearerbox at %s port %d.",
112 panic(0,
"Couldn't connect to the bearerbox.");
135 error(0,
"Couldn't write Msg to bearerbox.");
155 error(0,
"Couldn't deliver Msg to bearerbox.");
186 error(0,
"Error reading from bearerbox, disconnecting.");
190 error(0,
"Connection closed by the bearerbox.");
196 error(0,
"Connection to bearerbox broke.");
212 error(0,
"Failed to unpack data!");
253 if (date_value < 1 || date_value > 12)
257 if (date_value < 1 || date_value > 31)
261 if (date_value < 0 || date_value > 23)
265 if (date_value < 0 || date_value > 59)
267 if (date_value < 0 || date_value > 59)
275 warning(0,
"parse_date: not an ISO date");
283 if (!(rc = fork())) {
289 if (execvp(argv[0],argv) == -1)
290 error(errno,
"Unable to start new process.");
292 error(errno,
"Could not restart, exiting...");
294 return rc == -1 ? -1 : 0;
void error(int err, const char *fmt,...)
void info(int err, const char *fmt,...)
Connection * conn_open_tcp(Octstr *host, int port, Octstr *our_host)
Connection * connect_to_bearerbox_real(Octstr *host, int port, int ssl, Octstr *our_host)
int read_from_bearerbox_real(Connection *conn, Msg **msg, double seconds)
Octstr * parse_date(Octstr *date)
int restart_box(char **argv)
int read_from_bearerbox(Msg **msg, double seconds)
int conn_eof(Connection *conn)
#define octstr_get_cstr(ostr)
int deliver_to_bearerbox_real(Connection *conn, Msg *msg)
void conn_destroy(Connection *conn)
void connect_to_bearerbox(Octstr *host, int port, int ssl, Octstr *our_host)
void msg_destroy(Msg *msg)
void close_connection_to_bearerbox_real(Connection *conn)
void warning(int err, const char *fmt,...)
void octstr_destroy(Octstr *ostr)
void gwthread_sleep(double seconds)
Octstr * conn_read_withlen(Connection *conn)
int deliver_to_bearerbox(Msg *msg)
int conn_write_withlen(Connection *conn, Octstr *data)
void close_connection_to_bearerbox(void)
void write_to_bearerbox(Msg *pmsg)
void write_to_bearerbox_real(Connection *conn, Msg *pmsg)
int conn_wait(Connection *conn, double seconds)
long octstr_parse_long(long *nump, Octstr *ostr, long pos, int base)
Octstr * msg_pack(Msg *msg)
int conn_error(Connection *conn)
int octstr_get_char(const Octstr *ostr, long pos)
static XMLRPCDocument * msg
static Connection * bb_conn