Before

…lines 1–24 unchanged (24 lines)
25
26#include "farmpolicy.h"
27#include "farms.h"
28#include "farmaddress.h"
29#include "objects.h"
30#include "network.h"
31#include "zcu_log.h"
32
33
34static struct farmpolicy * farmpolicy_create(struct farm *f, struct policy *p)
35{
36 struct farmpolicy *fp = (struct farmpolicy *)malloc(sizeof(struct farmpolicy));
37 if (!fp) {
38 zcu_log_print(LOG_ERR, "Farm Policy memory allocation error");
39 return NULL;
40 }
41
42 fp->farm = f;
43 fp->policy = p;
44 fp->action = DEFAULT_ACTION;
…lines 45–74 unchanged (30 lines)
75
76void farmpolicy_s_print(struct farm *f)
77{
78 struct farmpolicy *fp;
79
80 list_for_each_entry(fp, &f->policies, list) {
81 zcu_log_print(LOG_DEBUG," [policy] ");
82 zcu_log_print(LOG_DEBUG," [%s] %s", CONFIG_KEY_NAME, fp->policy->name);
83 zcu_log_print(LOG_DEBUG," *[%s] %d", CONFIG_KEY_ACTION, fp->action);
84 }
85}
86
87struct farmpolicy * farmpolicy_lookup_by_name(struct farm *f, const char *name)
88{
89 struct farmpolicy *fp;
…lines 90–95 unchanged (6 lines)
96 return NULL;
97}
98
99int farmpolicy_set_action(struct farmpolicy *fp, int action)
100{
101 struct farm *f = fp->farm;
102
103 zcu_log_print(LOG_DEBUG, "%s():%d: farm %s action %d", __FUNCTION__, __LINE__, fp->farm->name, action);
104
105 if (action == ACTION_DELETE) {
106 farmpolicy_delete(fp);
107 farmaddress_s_set_action(f, ACTION_RELOAD);
108 return 1;
109 }
…lines 110–122 unchanged (13 lines)
123 return 0;
124}
125
126int farmpolicy_s_set_action(struct farm *f, int action)
127{
128 struct farmpolicy *fp, *next;
129
130 zcu_log_print(LOG_DEBUG, "%s():%d: farm %s action %d", __FUNCTION__, __LINE__, f->name, action);
131
132 list_for_each_entry_safe(fp, next, &f->policies, list)
133 farmpolicy_set_action(fp, action);
134
135 f->policies_action = action;
136
…lines 137–147 unchanged (11 lines)
148}
149
150int farmpolicy_s_lookup_policy_action(struct farm *f, char *name, int action)
151{
152 struct farmpolicy *fp;
153 int ret = 0;
154
155 zcu_log_print(LOG_DEBUG, "%s():%d: looking for policy %s in farm %s", __FUNCTION__, __LINE__, name, f->name);
156
157 fp = farmpolicy_lookup_by_name(f, name);
158 if (fp)
159 ret = farmpolicy_set_action(fp, action);
160
161 if (ret) {
…lines 162–197 unchanged (36 lines)
198int farmpolicy_pre_actionable(struct config_pair *c)
199{
200 struct farm *f = obj_get_current_farm();
201
202 if (!f)
203 return -1;
204
205 zcu_log_print(LOG_DEBUG, "%s():%d: pre actionable farm policy for farm %s", __FUNCTION__, __LINE__, f->name);
206
207 farm_set_action(f, ACTION_RELOAD);
208 farmaddress_s_set_action(f, ACTION_RELOAD);
209 farm_rulerize(f);
210
211 return 0;
212}
213
214int farmpolicy_pos_actionable(struct config_pair *c)
215{
216 struct farmpolicy *fp = obj_get_current_farmpolicy();
217 struct farm *f = obj_get_current_farm();
218
219 if (!fp || !f)
220 return -1;
221
222 zcu_log_print(LOG_DEBUG, "%s():%d: pos actionable farm policy %s for farm %s with param %d", __FUNCTION__, __LINE__, fp->policy->name, f->name, c->key);
223
224 farm_set_action(f, ACTION_RELOAD);
225 farmaddress_s_set_action(f, ACTION_RELOAD);
226
227 return 0;
228}
229

After

…lines 1–24 unchanged (24 lines)
25
26#include "farmpolicy.h"
27#include "farms.h"
28#include "farmaddress.h"
29#include "objects.h"
30#include "network.h"
31#include "u_log.h"
32
33
34static struct farmpolicy * farmpolicy_create(struct farm *f, struct policy *p)
35{
36 struct farmpolicy *fp = (struct farmpolicy *)malloc(sizeof(struct farmpolicy));
37 if (!fp) {
38 u_log_print(LOG_ERR, "Farm Policy memory allocation error");
39 return NULL;
40 }
41
42 fp->farm = f;
43 fp->policy = p;
44 fp->action = DEFAULT_ACTION;
…lines 45–74 unchanged (30 lines)
75
76void farmpolicy_s_print(struct farm *f)
77{
78 struct farmpolicy *fp;
79
80 list_for_each_entry(fp, &f->policies, list) {
81 u_log_print(LOG_DEBUG," [policy] ");
82 u_log_print(LOG_DEBUG," [%s] %s", CONFIG_KEY_NAME, fp->policy->name);
83 u_log_print(LOG_DEBUG," *[%s] %d", CONFIG_KEY_ACTION, fp->action);
84 }
85}
86
87struct farmpolicy * farmpolicy_lookup_by_name(struct farm *f, const char *name)
88{
89 struct farmpolicy *fp;
…lines 90–95 unchanged (6 lines)
96 return NULL;
97}
98
99int farmpolicy_set_action(struct farmpolicy *fp, int action)
100{
101 struct farm *f = fp->farm;
102
103 u_log_print(LOG_DEBUG, "%s():%d: farm %s action %d", __FUNCTION__, __LINE__, fp->farm->name, action);
104
105 if (action == ACTION_DELETE) {
106 farmpolicy_delete(fp);
107 farmaddress_s_set_action(f, ACTION_RELOAD);
108 return 1;
109 }
…lines 110–122 unchanged (13 lines)
123 return 0;
124}
125
126int farmpolicy_s_set_action(struct farm *f, int action)
127{
128 struct farmpolicy *fp, *next;
129
130 u_log_print(LOG_DEBUG, "%s():%d: farm %s action %d", __FUNCTION__, __LINE__, f->name, action);
131
132 list_for_each_entry_safe(fp, next, &f->policies, list)
133 farmpolicy_set_action(fp, action);
134
135 f->policies_action = action;
136
…lines 137–147 unchanged (11 lines)
148}
149
150int farmpolicy_s_lookup_policy_action(struct farm *f, char *name, int action)
151{
152 struct farmpolicy *fp;
153 int ret = 0;
154
155 u_log_print(LOG_DEBUG, "%s():%d: looking for policy %s in farm %s", __FUNCTION__, __LINE__, name, f->name);
156
157 fp = farmpolicy_lookup_by_name(f, name);
158 if (fp)
159 ret = farmpolicy_set_action(fp, action);
160
161 if (ret) {
…lines 162–197 unchanged (36 lines)
198int farmpolicy_pre_actionable(struct config_pair *c)
199{
200 struct farm *f = obj_get_current_farm();
201
202 if (!f)
203 return -1;
204
205 u_log_print(LOG_DEBUG, "%s():%d: pre actionable farm policy for farm %s", __FUNCTION__, __LINE__, f->name);
206
207 farm_set_action(f, ACTION_RELOAD);
208 farmaddress_s_set_action(f, ACTION_RELOAD);
209 farm_rulerize(f);
210
211 return 0;
212}
213
214int farmpolicy_pos_actionable(struct config_pair *c)
215{
216 struct farmpolicy *fp = obj_get_current_farmpolicy();
217 struct farm *f = obj_get_current_farm();
218
219 if (!fp || !f)
220 return -1;
221
222 u_log_print(LOG_DEBUG, "%s():%d: pos actionable farm policy %s for farm %s with param %d", __FUNCTION__, __LINE__, fp->policy->name, f->name, c->key);
223
224 farm_set_action(f, ACTION_RELOAD);
225 farmaddress_s_set_action(f, ACTION_RELOAD);
226
227 return 0;
228}
229

Before

translation_unit
comment "/*\n * This file is part of nftlb, nftables load balancer.\n"...
preproc_include
#include "#include"
system_lib_string "<stdio.h>"
preproc_include
#include "#include"
system_lib_string "<stdlib.h>"
preproc_include
#include "#include"
system_lib_string "<string.h>"
preproc_include
#include "#include"
string_literal
" "\""
string_content "farmpolicy.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "farms.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "farmaddress.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "objects.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "network.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "zcu_log.h"
" "\""
function_definition
storage_class_specifier
static "static"
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator (+22 nodes collapsed)
compound_statement
{ "{"
declaration (+32 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "fp"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_ERR"
, ","
string_literal
" "\""
string_content "Farm Policy memory allocation error"
" "\""
) ")"
; ";"
return_statement
return "return"
null
NULL "NULL"
; ";"
} "}"
expression_statement
assignment_expression
field_expression
identifier "fp"
-> "->"
field_identifier "farm"
= "="
identifier "f"
; ";"
expression_statement
assignment_expression
field_expression
identifier "fp"
-> "->"
field_identifier "policy"
= "="
identifier "p"
; ";"
expression_statement
assignment_expression
field_expression
identifier "fp"
-> "->"
field_identifier "action"
= "="
identifier "DEFAULT_ACTION"
; ";"
expression_statement
update_expression
field_expression
identifier "p"
-> "->"
field_identifier "used"
++ "++"
; ";"
expression_statement
assignment_expression
field_expression
identifier "f"
-> "->"
field_identifier "policies_action"
= "="
identifier "DEFAULT_ACTION"
; ";"
if_statement (+30 nodes collapsed)
expression_statement
update_expression
field_expression
identifier "f"
-> "->"
field_identifier "policies_used"
++ "++"
; ";"
expression_statement
call_expression
identifier "list_add_tail"
argument_list
( "("
pointer_expression
& "&"
field_expression
identifier "fp"
-> "->"
field_identifier "list"
, ","
pointer_expression
& "&"
field_expression
identifier "f"
-> "->"
field_identifier "policies"
) ")"
; ";"
return_statement
return "return"
identifier "fp"
; ";"
} "}"
function_definition (+108 nodes collapsed)
function_definition
primitive_type "void"
function_declarator
identifier "farmpolicy_s_print"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "farm"
pointer_declarator
* "*"
identifier "f"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
; ";"
expression_statement
call_expression
identifier "list_for_each_entry"
argument_list
( "("
identifier "fp"
, ","
pointer_expression
& "&"
field_expression
identifier "f"
-> "->"
field_identifier "policies"
, ","
identifier "list"
) ")"
; ""
compound_statement
{ "{"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content " [policy] "
" "\""
) ")"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content " [%s] %s"
" "\""
, ","
identifier "CONFIG_KEY_NAME"
, ","
field_expression
field_expression
identifier "fp"
-> "->"
field_identifier "policy"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content " *[%s] %d"
" "\""
, ","
identifier "CONFIG_KEY_ACTION"
, ","
field_expression
identifier "fp"
-> "->"
field_identifier "action"
) ")"
; ";"
} "}"
} "}"
function_definition (+88 nodes collapsed)
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_set_action"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
, ","
parameter_declaration
primitive_type "int"
identifier "action"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farm"
init_declarator
pointer_declarator
* "*"
identifier "f"
= "="
field_expression
identifier "fp"
-> "->"
field_identifier "farm"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list (+23 nodes collapsed)
; ";"
if_statement (+34 nodes collapsed)
if_statement (+92 nodes collapsed)
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_s_set_action"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "farm"
pointer_declarator
* "*"
identifier "f"
, ","
parameter_declaration
primitive_type "int"
identifier "action"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
, ","
pointer_declarator
* "*"
identifier "next"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content "%s():%d: farm %s action %d"
" "\""
, ","
identifier "__FUNCTION__"
, ","
identifier "__LINE__"
, ","
field_expression
identifier "f"
-> "->"
field_identifier "name"
, ","
identifier "action"
) ")"
; ";"
expression_statement
call_expression
identifier "list_for_each_entry_safe"
argument_list
( "("
identifier "fp"
, ","
identifier "next"
, ","
pointer_expression
& "&"
field_expression
identifier "f"
-> "->"
field_identifier "policies"
, ","
identifier "list"
) ")"
; ""
expression_statement
call_expression
identifier "farmpolicy_set_action"
argument_list
( "("
identifier "fp"
, ","
identifier "action"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
identifier "f"
-> "->"
field_identifier "policies_action"
= "="
identifier "action"
; ";"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition (+60 nodes collapsed)
function_definition
primitive_type "int"
function_declarator (+22 nodes collapsed)
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
; ";"
declaration
primitive_type "int"
init_declarator
identifier "ret"
= "="
number_literal "0"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content "%s():%d: looking for policy %s in farm %s"
" "\""
, ","
identifier "__FUNCTION__"
, ","
identifier "__LINE__"
, ","
identifier "name"
, ","
field_expression
identifier "f"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
assignment_expression
identifier "fp"
= "="
call_expression
identifier "farmpolicy_lookup_by_name"
argument_list
( "("
identifier "f"
, ","
identifier "name"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
identifier "fp"
) ")"
expression_statement
assignment_expression
identifier "ret"
= "="
call_expression
identifier "farmpolicy_set_action"
argument_list
( "("
identifier "fp"
, ","
identifier "action"
) ")"
; ";"
if_statement (+29 nodes collapsed)
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition (+189 nodes collapsed)
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_pre_actionable"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "config_pair"
pointer_declarator
* "*"
identifier "c"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farm"
init_declarator
pointer_declarator
* "*"
identifier "f"
= "="
call_expression
identifier "obj_get_current_farm"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "f"
) ")"
return_statement
return "return"
number_literal "-1"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content "%s():%d: pre actionable farm policy for farm %s"
" "\""
, ","
identifier "__FUNCTION__"
, ","
identifier "__LINE__"
, ","
field_expression
identifier "f"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
call_expression
identifier "farm_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
expression_statement
call_expression
identifier "farmaddress_s_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
expression_statement
call_expression
identifier "farm_rulerize"
argument_list
( "("
identifier "f"
) ")"
; ";"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_pos_actionable"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "config_pair"
pointer_declarator
* "*"
identifier "c"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
init_declarator
pointer_declarator
* "*"
identifier "fp"
= "="
call_expression
identifier "obj_get_current_farmpolicy"
argument_list
( "("
) ")"
; ";"
declaration
struct_specifier
struct "struct"
type_identifier "farm"
init_declarator
pointer_declarator
* "*"
identifier "f"
= "="
call_expression
identifier "obj_get_current_farm"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
identifier "fp"
|| "||"
unary_expression
! "!"
identifier "f"
) ")"
return_statement
return "return"
number_literal "-1"
; ";"
expression_statement
call_expression
identifier "zcu_log_print"
argument_list (+31 nodes collapsed)
; ";"
expression_statement
call_expression
identifier "farm_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
expression_statement
call_expression
identifier "farmaddress_s_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
return_statement
return "return"
number_literal "0"
; ";"
} "}"

After

translation_unit
comment "/*\n * This file is part of nftlb, nftables load balancer.\n"...
preproc_include
#include "#include"
system_lib_string "<stdio.h>"
preproc_include
#include "#include"
system_lib_string "<stdlib.h>"
preproc_include
#include "#include"
system_lib_string "<string.h>"
preproc_include
#include "#include"
string_literal
" "\""
string_content "farmpolicy.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "farms.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "farmaddress.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "objects.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "network.h"
" "\""
preproc_include
#include "#include"
string_literal
" "\""
string_content "u_log.h"
" "\""
function_definition
storage_class_specifier
static "static"
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator (+22 nodes collapsed)
compound_statement
{ "{"
declaration (+32 nodes collapsed)
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "fp"
) ")"
compound_statement
{ "{"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_ERR"
, ","
string_literal
" "\""
string_content "Farm Policy memory allocation error"
" "\""
) ")"
; ";"
return_statement
return "return"
null
NULL "NULL"
; ";"
} "}"
expression_statement
assignment_expression
field_expression
identifier "fp"
-> "->"
field_identifier "farm"
= "="
identifier "f"
; ";"
expression_statement
assignment_expression
field_expression
identifier "fp"
-> "->"
field_identifier "policy"
= "="
identifier "p"
; ";"
expression_statement
assignment_expression
field_expression
identifier "fp"
-> "->"
field_identifier "action"
= "="
identifier "DEFAULT_ACTION"
; ";"
expression_statement
update_expression
field_expression
identifier "p"
-> "->"
field_identifier "used"
++ "++"
; ";"
expression_statement
assignment_expression
field_expression
identifier "f"
-> "->"
field_identifier "policies_action"
= "="
identifier "DEFAULT_ACTION"
; ";"
if_statement (+30 nodes collapsed)
expression_statement
update_expression
field_expression
identifier "f"
-> "->"
field_identifier "policies_used"
++ "++"
; ";"
expression_statement
call_expression
identifier "list_add_tail"
argument_list
( "("
pointer_expression
& "&"
field_expression
identifier "fp"
-> "->"
field_identifier "list"
, ","
pointer_expression
& "&"
field_expression
identifier "f"
-> "->"
field_identifier "policies"
) ")"
; ";"
return_statement
return "return"
identifier "fp"
; ";"
} "}"
function_definition (+108 nodes collapsed)
function_definition
primitive_type "void"
function_declarator
identifier "farmpolicy_s_print"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "farm"
pointer_declarator
* "*"
identifier "f"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
; ";"
expression_statement
call_expression
identifier "list_for_each_entry"
argument_list
( "("
identifier "fp"
, ","
pointer_expression
& "&"
field_expression
identifier "f"
-> "->"
field_identifier "policies"
, ","
identifier "list"
) ")"
; ""
compound_statement
{ "{"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content " [policy] "
" "\""
) ")"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content " [%s] %s"
" "\""
, ","
identifier "CONFIG_KEY_NAME"
, ","
field_expression
field_expression
identifier "fp"
-> "->"
field_identifier "policy"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content " *[%s] %d"
" "\""
, ","
identifier "CONFIG_KEY_ACTION"
, ","
field_expression
identifier "fp"
-> "->"
field_identifier "action"
) ")"
; ";"
} "}"
} "}"
function_definition (+88 nodes collapsed)
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_set_action"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
, ","
parameter_declaration
primitive_type "int"
identifier "action"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farm"
init_declarator
pointer_declarator
* "*"
identifier "f"
= "="
field_expression
identifier "fp"
-> "->"
field_identifier "farm"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list (+23 nodes collapsed)
; ";"
if_statement (+34 nodes collapsed)
if_statement (+92 nodes collapsed)
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_s_set_action"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "farm"
pointer_declarator
* "*"
identifier "f"
, ","
parameter_declaration
primitive_type "int"
identifier "action"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
, ","
pointer_declarator
* "*"
identifier "next"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content "%s():%d: farm %s action %d"
" "\""
, ","
identifier "__FUNCTION__"
, ","
identifier "__LINE__"
, ","
field_expression
identifier "f"
-> "->"
field_identifier "name"
, ","
identifier "action"
) ")"
; ";"
expression_statement
call_expression
identifier "list_for_each_entry_safe"
argument_list
( "("
identifier "fp"
, ","
identifier "next"
, ","
pointer_expression
& "&"
field_expression
identifier "f"
-> "->"
field_identifier "policies"
, ","
identifier "list"
) ")"
; ""
expression_statement
call_expression
identifier "farmpolicy_set_action"
argument_list
( "("
identifier "fp"
, ","
identifier "action"
) ")"
; ";"
expression_statement
assignment_expression
field_expression
identifier "f"
-> "->"
field_identifier "policies_action"
= "="
identifier "action"
; ";"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition (+60 nodes collapsed)
function_definition
primitive_type "int"
function_declarator (+22 nodes collapsed)
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
pointer_declarator
* "*"
identifier "fp"
; ";"
declaration
primitive_type "int"
init_declarator
identifier "ret"
= "="
number_literal "0"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content "%s():%d: looking for policy %s in farm %s"
" "\""
, ","
identifier "__FUNCTION__"
, ","
identifier "__LINE__"
, ","
identifier "name"
, ","
field_expression
identifier "f"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
assignment_expression
identifier "fp"
= "="
call_expression
identifier "farmpolicy_lookup_by_name"
argument_list
( "("
identifier "f"
, ","
identifier "name"
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
identifier "fp"
) ")"
expression_statement
assignment_expression
identifier "ret"
= "="
call_expression
identifier "farmpolicy_set_action"
argument_list
( "("
identifier "fp"
, ","
identifier "action"
) ")"
; ";"
if_statement (+29 nodes collapsed)
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition (+189 nodes collapsed)
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_pre_actionable"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "config_pair"
pointer_declarator
* "*"
identifier "c"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farm"
init_declarator
pointer_declarator
* "*"
identifier "f"
= "="
call_expression
identifier "obj_get_current_farm"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
unary_expression
! "!"
identifier "f"
) ")"
return_statement
return "return"
number_literal "-1"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list
( "("
identifier "LOG_DEBUG"
, ","
string_literal
" "\""
string_content "%s():%d: pre actionable farm policy for farm %s"
" "\""
, ","
identifier "__FUNCTION__"
, ","
identifier "__LINE__"
, ","
field_expression
identifier "f"
-> "->"
field_identifier "name"
) ")"
; ";"
expression_statement
call_expression
identifier "farm_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
expression_statement
call_expression
identifier "farmaddress_s_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
expression_statement
call_expression
identifier "farm_rulerize"
argument_list
( "("
identifier "f"
) ")"
; ";"
return_statement
return "return"
number_literal "0"
; ";"
} "}"
function_definition
primitive_type "int"
function_declarator
identifier "farmpolicy_pos_actionable"
parameter_list
( "("
parameter_declaration
struct_specifier
struct "struct"
type_identifier "config_pair"
pointer_declarator
* "*"
identifier "c"
) ")"
compound_statement
{ "{"
declaration
struct_specifier
struct "struct"
type_identifier "farmpolicy"
init_declarator
pointer_declarator
* "*"
identifier "fp"
= "="
call_expression
identifier "obj_get_current_farmpolicy"
argument_list
( "("
) ")"
; ";"
declaration
struct_specifier
struct "struct"
type_identifier "farm"
init_declarator
pointer_declarator
* "*"
identifier "f"
= "="
call_expression
identifier "obj_get_current_farm"
argument_list
( "("
) ")"
; ";"
if_statement
if "if"
parenthesized_expression
( "("
binary_expression
unary_expression
! "!"
identifier "fp"
|| "||"
unary_expression
! "!"
identifier "f"
) ")"
return_statement
return "return"
number_literal "-1"
; ";"
expression_statement
call_expression
identifier "u_log_print"
argument_list (+31 nodes collapsed)
; ";"
expression_statement
call_expression
identifier "farm_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
expression_statement
call_expression
identifier "farmaddress_s_set_action"
argument_list
( "("
identifier "f"
, ","
identifier "ACTION_RELOAD"
) ")"
; ";"
return_statement
return "return"
number_literal "0"
; ";"
} "}"