Lines Matching refs:pair

26  * Purpose: add an attribute-value pair to the given list.
28 * Returns: pointer to added a/v pair upon success, NULL pointer upon failure.
30 * Remarks: Always appends the new pair to the end of the list.
53 * Purpose: assign the given value to an attribute-value pair.
104 * Purpose: make a new attribute-value pair with given parameters.
106 * Returns: pointer to generated a/v pair when successful, NULL when failure.
163 VALUE_PAIR *pair;
207 if ((pair =
215 strcpy (pair->name, attr->name);
216 pair->attribute = attr->value;
217 pair->vendorcode = VENDOR_NONE;
218 pair->type = attr->type;
219 pair->next = (VALUE_PAIR *) NULL;
225 memcpy (pair->strvalue, (char *) ptr, (size_t) attrlen);
226 pair->strvalue[attrlen] = '\0';
227 pair->lvalue = attrlen;
228 rc_avpair_insert (&vp, (VALUE_PAIR *) NULL, pair);
235 pair->lvalue = ntohl (lvalue);
236 rc_avpair_insert (&vp, (VALUE_PAIR *) NULL, pair);
241 free (pair);
270 VALUE_PAIR *pair;
308 pair = (VALUE_PAIR *) malloc(sizeof(VALUE_PAIR));
309 if (!pair) {
313 strcpy(pair->name, attr->name);
314 pair->attribute = attr->value;
315 pair->vendorcode = vendor_id;
316 pair->type = attr->type;
317 pair->next = NULL;
320 memcpy (pair->strvalue, (char *) ptr, (size_t) vlen);
321 pair->strvalue[vlen] = '\0';
322 pair->lvalue = vlen;
323 rc_avpair_insert (vp, (VALUE_PAIR *) NULL, pair);
330 pair->lvalue = ntohl (lvalue);
331 rc_avpair_insert (vp, (VALUE_PAIR *) NULL, pair);
336 free (pair);
345 * Purpose: Find the first attribute value-pair (which matches the given
346 * attribute) from the specified value-pair list.
455 void rc_avpair_free (VALUE_PAIR *pair)
459 while (pair != (VALUE_PAIR *) NULL)
461 next = pair->next;
462 free (pair);
463 pair = next;
512 * Returns: 0 = successful parse of attribute-value pair,
529 VALUE_PAIR *pair;
580 if ((pair =
591 strcpy (pair->name, attr->name);
592 pair->attribute = attr->value;
593 pair->type = attr->type;
594 pair->vendorcode = attr->vendorcode;
596 switch (pair->type)
600 strcpy (pair->strvalue, valstr);
601 pair->lvalue = strlen(valstr);
607 pair->lvalue = atoi (valstr);
619 free (pair);
624 pair->lvalue = dval->value;
630 pair->lvalue = rc_get_ipaddr(valstr);
641 pair->lvalue = (UINT4) timelocal (tm);
643 pair->lvalue = (UINT4) mktime (tm);
648 error("rc_avpair_parse: unknown attribute type %d", pair->type);
653 free (pair);
656 pair->next = (VALUE_PAIR *) NULL;
660 *first_pair = pair;
669 link->next = pair;
692 int rc_avpair_tostr (VALUE_PAIR *pair, char *name, int ln, char *value, int lv)
701 if (!pair || pair->name[0] == '\0') {
702 error("rc_avpair_tostr: pair is NULL or empty");
706 strncpy(name, pair->name, (size_t) ln);
708 switch (pair->type)
712 ptr = (unsigned char *) pair->strvalue;
733 dval = rc_dict_getval (pair->lvalue, pair->name);
740 sprintf (buffer, "%ld", pair->lvalue);
746 inad.s_addr = htonl(pair->lvalue);
752 gmtime ((time_t *) & pair->lvalue));
757 error("rc_avpair_tostr: unknown attribute type %d", pair->type);