#ifndef lint
static char copyright[] =
-"$Id: conflex.c,v 1.77 2000/06/24 06:17:52 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: conflex.c,v 1.78 2000/08/22 21:51:27 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
return DNS_DELETE;
if (!strcasecmp (atom + 1, "omain"))
return DOMAIN;
+ if (!strcasecmp (atom + 1, "ebug"))
+ return TOKEN_DEBUG;
if (!strcasecmp (atom + 1, "eny"))
return DENY;
if (!strcasecmp (atom + 1, "eleted"))
return ELSIF;
break;
}
+ if (!strcasecmp (atom + 1, "rror"))
+ return ERROR;
if (!strcasecmp (atom + 1, "val"))
return EVAL;
break;
case 'f':
+ if (!strcasecmp (atom + 1, "atal"))
+ return FATAL;
if (!strcasecmp (atom + 1, "ilename"))
return FILENAME;
if (!strcasecmp (atom + 1, "ixed-address"))
return INTEGER;
if (!strcasecmp (atom + 1, "nfinite"))
return INFINITE;
+ if (!strcasecmp (atom + 1, "nfo"))
+ return INFO;
if (!strcasecmp (atom + 1, "p-address"))
return IP_ADDRESS;
if (!strcasecmp (atom + 1, "nitial-interval"))
return LET;
if (!strcasecmp (atom + 1, "oad"))
return LOAD;
+ if (!strcasecmp (atom + 1, "og"))
+ return LOG;
break;
case 'm':
if (!strncasecmp (atom + 1, "ax", 2)) {
Any number between zero and the maximum representable size may be
specified as a numeric expression.
.RE
+.SH REFERENCE: LOGGING
+Logging statements may be used to send information to the standard logging
+channels. A logging statement includes an optional priority (\fBfatal\fR,
+\fBerror\fR, \fBinfo\fR, or \fBdebug\fR), and a data expression.
+.PP
+.B log (\fIpriority\fB, \fIdata-expr\FB)\fR
+.PP
+Logging statements take only a single data expression argument, so if you
+want to output multiple data values, you will need to use the \fBconcat\fR
+operator to concatenate them.
+.RE
.SH REFERENCE: DYNAMIC DNS UPDATES
.PP
The DHCP client and server have the ability to dynamically update the
#ifndef lint
static char copyright[] =
-"$Id: execute.c,v 1.36 2000/07/27 09:02:32 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: execute.c,v 1.37 2000/08/22 21:51:29 neild Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
binding_scope_dereference (&ns, MDL);
break;
+ case log_statement:
+ memset (&ds, 0, sizeof ds);
+ status = (evaluate_data_expression
+ (&ds, packet, lease, in_options,
+ out_options, scope, r -> data.log.expr));
+
+#if defined (DEBUG_EXPRESSIONS)
+ log_debug ("exec: log");
+#endif
+
+ if (status) {
+ switch (r -> data.log.priority) {
+ case log_priority_fatal:
+ log_fatal ("%.*s", (int)ds.len,
+ ds.buffer -> data);
+ break;
+ case log_priority_error:
+ log_error ("%.*s", (int)ds.len,
+ ds.buffer -> data);
+ break;
+ case log_priority_debug:
+ log_debug ("%.*s", (int)ds.len,
+ ds.buffer -> data);
+ break;
+ case log_priority_info:
+ log_info ("%.*s", (int)ds.len,
+ ds.buffer -> data);
+ break;
+ }
+ data_string_forget (&ds, MDL);
+ }
+
+ break;
+
default:
log_fatal ("bogus statement type %d", r -> op);
}
#ifndef lint
static char copyright[] =
-"$Id: parse.c,v 1.78 2000/08/03 20:59:36 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
+"$Id: parse.c,v 1.79 2000/08/22 21:51:30 neild Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
parse_semi (cfile);
break;
+ case LOG:
+ /** XXXDPN: At work. **/
+ token = next_token (&val, cfile);
+
+ if (!executable_statement_allocate (result, MDL))
+ log_fatal ("no memory for log statement.");
+ (*result) -> op = log_statement;
+
+ token = next_token (&val, cfile);
+ if (token != LPAREN) {
+ parse_warn (cfile, "left parenthesis expected.");
+ skip_to_semi (cfile);
+ *lose = 1;
+ return 0;
+ }
+
+ token = peek_token (&val, cfile);
+ i = 1;
+ if (token == FATAL) {
+ (*result) -> data.log.priority = log_priority_fatal;
+ } else if (token == ERROR) {
+ (*result) -> data.log.priority = log_priority_error;
+ } else if (token == TOKEN_DEBUG) {
+ (*result) -> data.log.priority = log_priority_debug;
+ } else if (token == INFO) {
+ (*result) -> data.log.priority = log_priority_info;
+ } else {
+ (*result) -> data.log.priority = log_priority_debug;
+ i = 0;
+ }
+ if (i) {
+ token = next_token (&val, cfile);
+ token = next_token (&val, cfile);
+ if (token != COMMA) {
+ parse_warn (cfile, "comma expected.");
+ skip_to_semi (cfile);
+ *lose = 1;
+ return 0;
+ }
+ }
+
+ if (!(parse_data_expression
+ (&(*result) -> data.log.expr, cfile, lose))) {
+ skip_to_semi (cfile);
+ *lose = 1;
+ return 0;
+ }
+
+ token = next_token (&val, cfile);
+ if (token != RPAREN) {
+ parse_warn (cfile, "right parenthesis expected.");
+ skip_to_semi (cfile);
+ *lose = 1;
+ return 0;
+ }
+
+ token = next_token (&val, cfile);
+ if (token != SEMI) {
+ parse_warn (cfile, "semicolon expected.");
+ skip_to_semi (cfile);
+ *lose = 1;
+ return 0;
+ }
+ break;
+
/* Not really a statement, but we parse it here anyway
because it's appropriate for all DHCP agents with
parsers. */
zone -> name = parse_host_name (cfile);
if (!zone -> name) {
badzone:
+ parse_warn (cfile, "expecting hostname.");
*lose = 1;
skip_to_semi (cfile);
dns_zone_dereference (&zone, MDL);
return 0;
}
return 1;
-
+
default:
if (config_universe && is_identifier (token)) {
option = (struct option *)0;
TOKEN_RESERVED = 577,
TOKEN_BOOTP = 578,
TOKEN_NEXT = 579,
- OMAPI = 580
+ OMAPI = 580,
+ LOG = 581,
+ FATAL = 582,
+ ERROR = 583,
+ TOKEN_DEBUG = 584,
+ INFO = 585
};
#define is_identifier(x) ((x) >= FIRST_TOKEN && \
set_statement,
unset_statement,
let_statement,
- define_statement
+ define_statement,
+ log_statement
} op;
union {
struct {
struct executable_statement *statements;
} set, let;
char *unset;
+ struct {
+ enum {
+ log_priority_fatal,
+ log_priority_error,
+ log_priority_debug,
+ log_priority_info
+ } priority;
+ struct expression *expr;
+ } log;
} data;
};