Commit 7f373dd5 authored by John Beranek's avatar John Beranek
Browse files

* remotedb is now properly namespaced, all calls and visible variables are...

* remotedb is now properly namespaced, all calls and visible variables are prefixed "remote_". Previously only some of the calls were namespaced, now they all are.  This may break some apps that used remotedb directly instead of using DebugLib, but the changes needed will be small. This change was done because I was getting a nameclash with some other source that defined debug_vprintf.

 * Updated DebugLib will be checked-in that uses new naming scheme.


Version 0.07. Tagged as 'remotedb-0_07'
parent d7e45c07
/* (0.06)
/* (0.07)
*
* This file is automatically maintained by srccommit, do not edit manually.
*
*/
#define Module_MajorVersion_CMHG 0.06
#define Module_MajorVersion_CMHG 0.07
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 26 May 1999
#define Module_Date_CMHG 21 Sep 1999
#define Module_MajorVersion "0.06"
#define Module_Version 6
#define Module_MajorVersion "0.07"
#define Module_Version 7
#define Module_MinorVersion ""
#define Module_Date "26 May 1999"
#define Module_Date "21 Sep 1999"
#define Module_FullVersion "0.06"
#define Module_FullVersion "0.07"
......@@ -13,12 +13,12 @@
* limitations under the License.
*/
/************************************************************************/
/* Copyright 1997-1999 Element 14 Ltd */
/* Copyright 1997-1999 Pace Micro Technology plc */
/* */
/* This material is the confidential trade secret and proprietary */
/* information of Element 14 Ltd. It may not be reproduced, used */
/* sold, or transferred to any third party without the prior written */
/* consent of Element 14 Ltd. All rights reserved. */
/* information of Pace Micro Tecnology. It may not be reproduced, */
/* used sold, or transferred to any third party without the prior */
/* written consent of Pace Micro Technology. All rights reserved. */
/* */
/************************************************************************/
......@@ -27,6 +27,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include "sys/types.h"
#include "sys/socket.h"
......@@ -43,8 +44,8 @@ static const char REMOTE_DEBUG_VERSION[] = Module_FullVersion;
#define REMOTE_DEBUG_MAX_LINE (10*1024)
static int remote_debug_poll=1;
static char *debug_line = NULL;
static bool remote_debug_poll_flag = true;
static char *remote_debug_line = NULL;
/*
* compare two strings caselessly
......@@ -67,7 +68,7 @@ remote_debug_caseless_strcmp(char *a, char *b)
* and if terminated correctly, extract the line.
*/
int
debug_poll(debug_session *sess)
remote_debug_poll(remote_debug_session *sess)
{
static char sbuff[REMOTE_DEBUG_MAX_LINE];
fd_set read_set;
......@@ -80,7 +81,7 @@ debug_poll(debug_session *sess)
if (!sess)
return (0);
remote_debug_poll=0; /* don't poll during debug_printf */
remote_debug_poll_flag = false; /* don't poll during debug_printf */
do
{
......@@ -133,7 +134,7 @@ debug_poll(debug_session *sess)
sess->priority = atoi(argv[1]);
if (sess->priority>7)
sess->priority = 7;
debug_printf(sess,"(6) debug priority changed to %d\n",
remote_debug_printf(sess,"(6) debug priority changed to %d\n",
sess->priority);
}
}
......@@ -144,7 +145,7 @@ debug_poll(debug_session *sess)
strncpy(name, argv[0], sizeof(name));
name[sizeof(name)-1] = 0;
rc = sess->cmd_handler(argc, argv, sess->cmd_handle);
debug_printf(sess,"(6) cmd '%s' returns %d\n", name, rc);
remote_debug_printf(sess,"(6) cmd '%s' returns %d\n", name, rc);
}
else if (remote_debug_caseless_strcmp(argv[0], ":ack")==0)
{
......@@ -152,7 +153,7 @@ debug_poll(debug_session *sess)
}
else
{
debug_printf(sess,"(6) unknown command '%s'\n",argv[0]);
remote_debug_printf(sess,"(6) unknown command '%s'\n",argv[0]);
}
more = 1; /* try for more input */
......@@ -163,7 +164,7 @@ debug_poll(debug_session *sess)
}
} while (more);
remote_debug_poll=1; /* return to polling during debug_printf */
remote_debug_poll_flag = true; /* return to polling during debug_printf */
return (0);
}
......@@ -171,59 +172,59 @@ debug_poll(debug_session *sess)
* send stuff to the debug session
*/
void
debug_printf(debug_session *sess, char *format, ...)
remote_debug_printf(remote_debug_session *sess, char *format, ...)
{
va_list list;
va_start (list, format);
vsprintf(debug_line,format, list);
va_end(list);
vsprintf (remote_debug_line,format, list);
va_end (list);
debug_print_line(sess, debug_line);
remote_debug_print_line_simple (sess, remote_debug_line);
}
void
debug_vprintf(debug_session *sess, const char *format, va_list list)
remote_debug_vprintf(remote_debug_session *sess, const char *format, va_list list)
{
vsprintf(debug_line,format, list);
vsprintf (remote_debug_line,format, list);
debug_print_line(sess, debug_line);
remote_debug_print_line_simple (sess, remote_debug_line);
}
void
debug_dvprintf(debug_session *sess, int priority, const char *file, int line, const char *format, va_list list)
remote_debug_dvprintf(remote_debug_session *sess, int priority, const char *file, int line, const char *format, va_list list)
{
int n = 0;
if (priority != 0)
n += sprintf(debug_line, "(%d)", priority);
n += sprintf(remote_debug_line, "(%d)", priority);
if (file)
n += sprintf(debug_line+n, " %s:%d: ", file, line);
n += sprintf(remote_debug_line+n, " %s:%d: ", file, line);
vsprintf(debug_line+n, format, list);
vsprintf(remote_debug_line+n, format, list);
debug_print_line(sess, debug_line);
remote_debug_print_line_simple(sess, remote_debug_line);
}
void
debug_print_line(debug_session *sess, const char *line)
remote_debug_print_line_simple(remote_debug_session *sess, const char *line)
{
remote_debug_print_line (0u, sess, line, strlen (line));
}
void
remote_debug_print_line (unsigned int flags, debug_session *sess, const char *line, size_t len)
remote_debug_print_line (unsigned int flags, remote_debug_session *sess, const char *line, size_t len)
{
unsigned char priority = 7;
if (!sess)
return;
if (remote_debug_poll)
debug_poll(sess);
if (remote_debug_poll_flag)
remote_debug_poll(sess);
/* Not raw */
if ((flags & 1) == 0)
......@@ -256,7 +257,7 @@ remote_debug_print_line (unsigned int flags, debug_session *sess, const char *li
void
remote_debug_register_cmd_handler(debug_session *sess, remote_debug_cmd_handler fn, void *handle)
remote_debug_register_cmd_handler(remote_debug_session *sess, remote_debug_cmd_handler fn, void *handle)
{
if (sess)
{
......@@ -272,20 +273,20 @@ remote_debug_register_cmd_handler(debug_session *sess, remote_debug_cmd_handler
* closed using the remote_debug_session_close() function
*/
void
remote_debug_open(char *info, debug_session **db_sess)
remote_debug_open(char *info, remote_debug_session **db_sess)
{
int rc;
int debug_socket=-1;
struct sockaddr_in sockaddr;
struct hostent *hostent;
debug_session *sess=NULL;
remote_debug_session *sess=NULL;
char host[40];
char varname[100];
char *port;
/* malloc to avoid problems in SVC mode */
if (debug_line == NULL)
debug_line = malloc(REMOTE_DEBUG_MAX_LINE);
if (remote_debug_line == NULL)
remote_debug_line = malloc(REMOTE_DEBUG_MAX_LINE);
memset(&sockaddr, 0, sizeof(sockaddr));
......@@ -342,7 +343,7 @@ remote_debug_open(char *info, debug_session **db_sess)
/*
* allocate a debug session
*/
if ((sess=malloc(sizeof(debug_session)))==NULL)
if ((sess=malloc(sizeof(remote_debug_session)))==NULL)
goto exit_gracefully;
sess->sock = debug_socket;
......@@ -360,7 +361,7 @@ remote_debug_open(char *info, debug_session **db_sess)
/*
* send initial opening message
*/
debug_printf(sess,"(6) Open Version %s", REMOTE_DEBUG_VERSION);
remote_debug_printf(sess,"(6) Open Version %s", REMOTE_DEBUG_VERSION);
*db_sess = sess;
......@@ -384,11 +385,11 @@ exit_gracefully:
* close previously opened debug session
*/
void
remote_debug_close(debug_session *sess)
remote_debug_close(remote_debug_session *sess)
{
if (sess)
{
debug_printf(sess,"(6) Close");
remote_debug_printf(sess,"(6) Close");
if (sess->sock >= 0)
socketclose(sess->sock);
......@@ -397,10 +398,10 @@ remote_debug_close(debug_session *sess)
free(sess);
}
if (debug_line)
if (remote_debug_line)
{
free(debug_line);
debug_line = NULL;
free(remote_debug_line);
remote_debug_line = NULL;
}
return;
......
......@@ -13,12 +13,12 @@
* limitations under the License.
*/
/************************************************************************/
/* Copyright 1997-1999 Element 14 Ltd */
/* Copyright 1997-1999 Pace Micro Technology plc */
/* */
/* This material is the confidential trade secret and proprietary */
/* information of Element 14 Ltd. It may not be reproduced, used */
/* sold, or transferred to any third party without the prior written */
/* consent of Element 14 Ltd. All rights reserved. */
/* information of Pace Micro Tecnology. It may not be reproduced, */
/* used sold, or transferred to any third party without the prior */
/* written consent of Pace Micro Technology. All rights reserved. */
/* */
/************************************************************************/
......@@ -45,7 +45,7 @@ typedef struct
unsigned char priority;
remote_debug_cmd_handler cmd_handler;
void *cmd_handle;
} debug_session;
} remote_debug_session;
/*
* Open a connection to host specified by Inet$DebugHost and send an initial
......@@ -53,7 +53,7 @@ typedef struct
* info. A copy of info is made internally. This call will return a pointer to
* a session structure to be used in subsequent calls.
*/
void remote_debug_open(char *info, debug_session **sess);
void remote_debug_open(char *info, remote_debug_session **sess);
/*
* Send an printf formatted string upto a max of 1024 characters to the debug
......@@ -62,37 +62,37 @@ void remote_debug_open(char *info, debug_session **sess);
*
* Also versions to send a neat string and one passed as a va_list.
*/
void debug_printf(debug_session *sess, char *format, ...);
void debug_vprintf(debug_session *sess, const char *format, va_list list);
void debug_dvprintf(debug_session *sess, int priority, const char *file, int line, const char *format, va_list list);
void debug_print_line(debug_session *sess, const char *line);
void remote_debug_print_line (unsigned int flags, debug_session *sess, const char *line, size_t len);
void remote_debug_printf (remote_debug_session *sess, char *format, ...);
void remote_debug_vprintf (remote_debug_session *sess, const char *format, va_list list);
void remote_debug_dvprintf (remote_debug_session *sess, int priority, const char *file, int line, const char *format,
va_list list);
void remote_debug_print_line_simple (remote_debug_session *sess, const char *line);
void remote_debug_print_line (unsigned int flags, remote_debug_session *sess, const char *line, size_t len);
/*
* Register a command handler to handle commands sent from the server
*/
void remote_debug_register_cmd_handler(debug_session *sess, remote_debug_cmd_handler fn, void *handle);
void remote_debug_register_cmd_handler (remote_debug_session *sess, remote_debug_cmd_handler fn, void *handle);
/*
* Close a previously open debug channel.
*/
void remote_debug_close(debug_session *sess);
void remote_debug_close (remote_debug_session *sess);
/*
* check the input port for any data. Call this every so often to ensure commands
* get executed when entered rather than on the next debug write.
*/
int debug_poll(debug_session *sess);
int remote_debug_poll (remote_debug_session *sess);
const char *remote_debug_version (void);
#else
#define remote_debug_open(x,y)
#define debug_printf 1?0:printf
#define debug_vprintf(s,f,l)
#define debug_print_line(s,d)
#define remote_debug_printf 1?0:printf
#define remote_debug_vprintf(s,f,l)
#define remote_debug_print_line_simple(s,d)
#define remote_debug_print_line(f,s,l,le)
#define remote_debug_close(x)
#define remote_debug_version()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment