summaryrefslogtreecommitdiff
path: root/server/class.c
diff options
context:
space:
mode:
authorTed Lemon <source@isc.org>1999-07-31 18:09:51 +0000
committerTed Lemon <source@isc.org>1999-07-31 18:09:51 +0000
commitdce08243fb5457dc5a8b4f88ad5d2c634a6286fb (patch)
tree918a3cbeb28b81d191abd675cb86db9b5d938b3c /server/class.c
parentca1c700e4366c20dce0b3d82d1f7ef488cc9a59e (diff)
downloadisc-dhcp-dce08243fb5457dc5a8b4f88ad5d2c634a6286fb.tar.gz
- Use reference-counting allocators to allocate the expression and the
statement in the default classification rule. - Fix function calls to expression evaluation functions.
Diffstat (limited to 'server/class.c')
-rw-r--r--server/class.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/server/class.c b/server/class.c
index 90cdc4d0..522dcbc5 100644
--- a/server/class.c
+++ b/server/class.c
@@ -22,7 +22,7 @@
#ifndef lint
static char copyright[] =
-"$Id: class.c,v 1.12 1999/07/02 20:58:48 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
+"$Id: class.c,v 1.13 1999/07/31 18:09:51 mellon Exp $ Copyright (c) 1998 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -43,27 +43,21 @@ int have_billing_classes;
void classification_setup ()
{
struct executable_statement *rules;
- struct expression *me;
- /* check-collection "default" */
- me = (struct expression *)dmalloc (sizeof (struct expression),
- "default check expression");
- if (!me)
- log_fatal ("Can't allocate default check expression");
- memset (me, 0, sizeof *me);
- me -> op = expr_check;
- me -> data.check = &default_collection;
-
/* eval ... */
- rules = (struct executable_statement *)
- dmalloc (sizeof (struct executable_statement),
- "add default collection check rule");
- if (!rules)
+ rules = (struct executable_statement *)0;
+ if (!executable_statement_allocate (&rules,
+ "default collection check rule"))
log_fatal ("Can't allocate check of default collection");
- memset (rules, 0, sizeof *rules);
rules -> op = eval_statement;
- rules -> data.eval = me;
+ /* check-collection "default" */
+ if (!expression_allocate (&rules -> data.eval,
+ "default check expression"))
+ log_fatal ("Can't allocate default check expression");
+ rules -> data.eval -> op = expr_check;
+ rules -> data.eval -> data.check = &default_collection;
+
default_classification_rules = rules;
}
@@ -93,11 +87,10 @@ int check_collection (packet, lease, collection)
/* If a class is for billing, don't put the client in the
class if we've already billed it to a different class. */
if (class -> submatch) {
- status = evaluate_data_expression (&data,
- packet,
- packet -> options,
- lease,
- class -> submatch);
+ status = (evaluate_data_expression
+ (&data, packet, lease,
+ packet -> options, (struct option_state *)0,
+ class -> submatch));
if (status) {
if ((nc = ((struct class *)
hash_lookup (class -> hash,
@@ -162,7 +155,9 @@ int check_collection (packet, lease, collection)
}
status = (evaluate_boolean_expression_result
- (packet, packet -> options, lease, class -> expr));
+ (packet, lease,
+ packet -> options, (struct option_state *)0,
+ class -> expr));
if (status) {
matched = 1;
#if defined (DEBUG_CLASS_MATCHING)