* initializes a new trace
* all values will be reset
*/
-void start_trace(int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name)
+void _start_trace(const char *__file, int __line, int port, struct interface *interface, char *caller, char *dialing, int direction, int category, int serial, char *name)
{
if (trace.name[0])
- PERROR("trace already started (name=%s)\n", trace.name);
+ PERROR("trace already started (name=%s) in file %s line %d\n", trace.name, __file, __line);
memset(&trace, 0, sizeof(struct trace));
trace.port = port;
if (interface)
* if subelement is given, element will also contain a subelement
* if multiple subelements belong to same element, name must be equal for all subelements
*/
-void add_trace(char *name, char *sub, const char *fmt, ...)
+void _add_trace(const char *__file, int __line, char *name, char *sub, const char *fmt, ...)
{
va_list args;
if (!trace.name[0])
- PERROR("trace not started\n");
+ PERROR("trace not started in file %s line %d\n", __file, __line);
/* check for required name value */
if (!name)
SCAT(trace_string, "--");
}
if (trace.serial)
- SPRINT(buffer, "(%d): %s", trace.serial, trace.name[0]?trace.name:"<unknown>");
+ SPRINT(buffer, "(%lu): %s", trace.serial, trace.name[0]?trace.name:"<unknown>");
else
SPRINT(buffer, ": %s", trace.name[0]?trace.name:"<unknown>");
SCAT(trace_string, buffer);
switch(detail)
{
case 1: /* brief */
+ if (trace.port)
+ {
+ SPRINT(buffer, " port %d", trace.port);
+ SCAT(trace_string, buffer);
+ }
i = 0;
while(i < trace.elements)
{
* trace ends
* this function will put the trace to sockets and logfile, if requested
*/
-void end_trace(void)
+void _end_trace(const char *__file, int __line)
{
char *string;
FILE *fp;
struct admin_queue *response, **responsep; /* response pointer */
if (!trace.name[0])
- PERROR("trace not started\n");
+ PERROR("trace not started in file %s line %d\n", __file, __line);
if (options.deb || options.log[0])
{
}
/* process admin */
- admin = admin_list;
+ admin = admin_first;
while(admin)
{
if (admin->trace.detail)
}
/* create state response */
- response = (struct admin_queue *)malloc(sizeof(struct admin_queue)+sizeof(admin_message));
- if (!response)
- return;
+ response = (struct admin_queue *)MALLOC(sizeof(struct admin_queue)+sizeof(admin_message));
memuse++;
- memset(response, 0, sizeof(admin_queue)+sizeof(admin_message));
response->num = 1;
/* message */
response->am[0].message = ADMIN_TRACE_RESPONSE;
-