51 log_fatal (
"Can't allocate check of default collection");
57 log_fatal (
"Can't allocate default check expression");
75 struct class *
class, *nc;
83 #if defined (DEBUG_CLASS_MATCHING) 84 log_info (
"checking against class %s...",
class ->
name);
86 memset (&data, 0,
sizeof data);
104 #if defined (DEBUG_CLASS_MATCHING) 124 if (status && data.
len) {
125 nc = (
struct class *)0;
126 classfound = class_hash_lookup (&nc,
class ->
hash,
129 #ifdef LDAP_CONFIGURATION 130 if (!classfound && find_subclass_in_ldap (
class, &nc, &data))
135 #if defined (DEBUG_CLASS_MATCHING) 143 class_dereference (&nc,
MDL);
151 #if defined (DEBUG_CLASS_MATCHING) 155 status = class_allocate (&nc,
MDL);
166 sizeof (
struct lease *),
174 class_dereference (&nc,
MDL);
181 sizeof (
struct lease *)));
189 class_hash_add (
class ->
hash,
195 class_dereference (&nc,
MDL);
207 class_reference (&
packet -> classes [
packet -> class_count++],
213 packet -> raw -> chaddr));
219 struct class *cp, *pp;
222 for (pp = 0, cp = lp -> classes; cp; pp = cp, cp = cp ->
nic)
230 class_dereference(
class,
MDL);
232 return ISC_R_SUCCESS;
235 return ISC_R_NOTFOUND;
246 for (cp = lp -> classes; cp; cp = cp ->
nic)
248 return class_reference (
class, cp,
file,
line);
251 return ISC_R_NOTFOUND;
269 struct lease* refholder = NULL;
277 for (i = 0; i <
class->lease_limit; i++) {
283 lease_reference(&refholder,
lease,
MDL);
288 log_error (
"lease %s unbilled with no billing arrangement.",
293 class->leases_consumed--;
300 lease_dereference(&refholder,
MDL);
310 log_error (
"lease billed with existing billing arrangement.");
314 if (
class -> leases_consumed ==
class -> lease_limit)
317 for (i = 0; i <
class -> lease_limit; i++)
318 if (!
class -> billed_leases [i])
321 if (i ==
class -> lease_limit) {
322 log_error (
"class billing consumption disagrees with leases.");
326 lease_reference (&
class -> billed_leases [i],
lease,
MDL);
327 class_reference (&
lease -> billing_class,
class,
MDL);
328 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)
struct collection * collections
void classification_setup()
const unsigned char * data
void data_string_copy(struct data_string *dest, const struct data_string *src, const char *file, int line)
struct collection default_collection
isc_result_t unlink_class(struct class **class)
#define PACKET_MAX_CLASSES
int bill_class(struct lease *lease, struct class *class)