43 log_fatal (
"Can't allocate check of default collection");
49 log_fatal (
"Can't allocate default check expression");
67 struct class *
class, *nc;
75 #if defined (DEBUG_CLASS_MATCHING) 76 log_info (
"checking against class %s...",
class ->
name);
78 memset (&data, 0,
sizeof data);
96 #if defined (DEBUG_CLASS_MATCHING) 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++],
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);
224 return ISC_R_SUCCESS;
227 return ISC_R_NOTFOUND;
238 for (cp = lp -> classes; cp; cp = cp ->
nic)
240 return class_reference (
class, cp,
file,
line);
243 return ISC_R_NOTFOUND;
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--;
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)
struct binding_scope * global_scope
const char * piaddr(const struct iaddr addr)
void unbill_class(struct lease *lease)
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
#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__
int check_collection(struct packet *packet, struct lease *lease, struct collection *collection)
struct executable_statement * default_classification_rules
void classify(struct packet *packet, struct class *class)
struct option_state * options
void log_fatal(const char *,...) __attribute__((__format__(__printf__
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_client(struct packet *packet)
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
struct lease ** billed_leases
isc_result_t find_class(struct class **class, const char *name, const char *file, int line)
void classification_setup()
struct collection * collections
struct collection default_collection
const unsigned char * data
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
isc_result_t unlink_class(struct class **class)
#define PACKET_MAX_CLASSES
int bill_class(struct lease *lease, struct class *class)