Home | History | Annotate | Download | only in npfctl

Lines Matching refs:vp

66 	npfvar_t *vp = ecalloc(1, sizeof(*vp));
68 return vp;
90 npfvar_add(npfvar_t *vp, const char *name)
92 vp->v_key = estrdup(name);
93 vp->v_next = var_list;
94 var_list = vp;
100 npfvar_t *vp = npfvar_create();
101 return npfvar_add_element(vp, type, data, len);
111 npfvar_add_element(npfvar_t *vp, unsigned type, const void *data, size_t len)
121 if (vp->v_elements == NULL) {
122 vp->v_elements = el;
124 vp->v_last->e_next = el;
126 vp->v_last = el;
127 vp->v_count++;
128 return vp;
132 npfvar_add_elements(npfvar_t *vp, npfvar_t *vp2)
135 return vp;
136 if (vp == NULL)
139 if (vp->v_elements == NULL) {
141 vp->v_elements = vp2->v_elements;
144 vp->v_last->e_next = vp2->v_elements;
147 vp->v_last = vp2->v_last;
148 vp->v_count += vp2->v_count;
154 return vp;
168 npfvar_destroy(npfvar_t *vp)
170 npfvar_free_elements(vp->v_elements);
171 free(vp->v_key);
172 free(vp);
177 npfvar_expand_string(const npfvar_t *vp)
179 if (npfvar_get_count(vp) != 1) {
180 yyerror("variable '%s' has multiple elements", vp->v_key);
183 return npfvar_get_data(vp, NPFVAR_STRING, 0);
187 npfvar_expand_number(const npfvar_t *vp)
190 if (npfvar_get_count(vp) != 1) {
191 yyerror("variable '%s' has multiple elements", vp->v_key);
193 number = (uint32_t *)npfvar_get_data(vp, NPFVAR_NUM, 0);
200 npfvar_t *vp = npfvar_lookup(var_id);
201 int type = npfvar_get_type(vp, 0);
207 rid_type = npfvar_expand_string(vp);
213 *rid = npfvar_expand_number(vp);
226 npfvar_get_count(const npfvar_t *vp)
228 return vp ? vp->v_count : 0;
232 npfvar_get_element(const npfvar_t *vp, size_t idx, size_t level)
239 if (vp == NULL) {
243 yyerror("circular dependency for variable '%s'", vp->v_key);
246 if (vp->v_count <= idx) {
248 vp->v_key, vp->v_count, idx);
255 el = vp->v_elements;
268 npfvar_getfilt_data(const npfvar_t *vp, unsigned type, size_t idx)
270 npf_element_t *el = npfvar_get_element(vp, idx, 0);
277 "is of type '%s' rather than '%s'", vp->v_key,
285 npfvar_getfilt_type(const npfvar_t *vp, size_t idx)
287 npf_element_t *el = npfvar_get_element(vp, idx, 0);
292 npfvar_get_type(const npfvar_t *vp, size_t idx)
294 npf_element_t *el = npfvar_get_element(vp, idx, 0);
313 npfvar_get_data(const npfvar_t *vp, unsigned type, size_t idx)
315 npf_element_t *el = npfvar_get_element(vp, idx, 0);
333 "is of type '%s' rather than '%s'", vp->v_key,