43 log_fatal (
"Can't allocate check of default collection");
49 log_fatal (
"Can't allocate default check expression");
51 default_classification_rules ->
data.eval ->
data.check =
67 struct class *
class, *nc;
74 for (
class = collection -> classes;
class;
class =
class -> nic) {
75 #if defined (DEBUG_CLASS_MATCHING)
76 log_info (
"checking against class %s...",
class ->
name);
78 memset (&data, 0,
sizeof data);
88 (&ignorep, packet, lease,
96 #if defined (DEBUG_CLASS_MATCHING)
111 (&data, packet, lease,
116 if (status && data.
len) {
117 nc = (
struct class *)0;
118 classfound = class_hash_lookup (&nc,
class ->
hash,
121 #ifdef LDAP_CONFIGURATION
122 if (!classfound && find_subclass_in_ldap (
class, &nc, &data))
127 #if defined (DEBUG_CLASS_MATCHING)
135 class_dereference (&nc,
MDL);
143 #if defined (DEBUG_CLASS_MATCHING)
147 status = class_allocate (&nc,
MDL);
158 sizeof (
struct lease *),
166 class_dereference (&nc,
MDL);
173 sizeof (
struct lease *)));
181 class_hash_add (
class ->
hash,
187 class_dereference (&nc,
MDL);
199 class_reference (&packet -> classes [packet -> class_count++],
204 packet -> raw -> hlen,
205 packet -> raw -> chaddr));
211 struct class *cp, *pp;
214 for (pp = 0, cp = lp -> classes; cp; pp = cp, cp = cp ->
nic)
222 class_dereference(
class,
MDL);
238 for (cp = lp -> classes; cp; cp = cp ->
nic)
239 if (cp -> name && !strcmp (name, cp -> name)) {
240 return class_reference (
class, cp, file, line);
260 struct class*
class = lease->billing_class;
261 struct lease* refholder = NULL;
269 for (i = 0; i <
class->lease_limit; i++) {
275 lease_reference(&refholder, lease,
MDL);
280 log_error (
"lease %s unbilled with no billing arrangement.",
285 class->leases_consumed--;
289 class_dereference(&lease->billing_class,
MDL);
292 lease_dereference(&refholder,
MDL);
302 log_error (
"lease billed with existing billing arrangement.");
306 if (
class -> leases_consumed ==
class -> lease_limit)
309 for (i = 0; i <
class -> lease_limit; i++)
310 if (!
class -> billed_leases [i])
313 if (i ==
class -> lease_limit) {
314 log_error (
"class billing consumption disagrees with leases.");
318 lease_reference (&
class -> billed_leases [i], lease,
MDL);
319 class_reference (&lease -> billing_class,
class,
MDL);
320 class -> leases_consumed++;
int executable_statement_allocate(struct executable_statement **ptr, const char *file, int line)
void unbill_class(struct lease *lease)
struct binding_scope * global_scope
const char * piaddr(const struct iaddr addr)
struct executable_statement * default_classification_rules
struct class * superclass
int expression_allocate(struct expression **cptr, const char *file, int line)
int execute_statements(struct binding_value **result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *out_options, struct binding_scope **scope, struct executable_statement *statements, struct on_star *on_star)
char * print_hw_addr(int htype, const int hlen, const unsigned char *data) const
isc_result_t unlink_class(struct class **class)
#define print_hex_1(len, data, limit)
enum executable_statement::statement_op op
int group_reference(struct group **ptr, struct group *bp, const char *file, int line)
void data_string_forget(struct data_string *data, const char *file, int line)
struct class * billing_class
struct data_string hash_string
int log_error(const char *,...) __attribute__((__format__(__printf__
log_fatal("no memory for uname information.")
int evaluate_boolean_expression_result(int *ignorep, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr)
void classify(struct packet *packet, struct class *class)
struct expression * submatch
int int log_info(const char *,...) __attribute__((__format__(__printf__
int evaluate_data_expression(struct data_string *result, struct packet *packet, struct lease *lease, struct client_state *client_state, struct option_state *in_options, struct option_state *cfg_options, struct binding_scope **scope, struct expression *expr, const char *file, int line)
void * dmalloc(size_t, const char *, int)
union executable_statement::@7 data
int check_collection(struct packet *packet, struct lease *lease, struct collection *collection)
struct lease ** billed_leases
isc_result_t find_class(struct class **c, const char *s, const char *file, int line)
struct collection * collections
void classification_setup(void)
struct collection default_collection
int bill_class(struct lease *, struct class *)
const unsigned char * data
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
void classify_client(struct packet *)
#define PACKET_MAX_CLASSES