1 /* This file is part of the Zebra server.
2 Copyright (C) 1994-2010 Index Data
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 void attr_init_APT(AttrType *src, Z_AttributesPlusTerm *zapt, int type)
26 src->attributeList = zapt->attributes->attributes;
27 src->num_attributes = zapt->attributes->num_attributes;
33 void attr_init_AttrList(AttrType *src, Z_AttributeList *list, int type)
35 src->attributeList = list->attributes;
36 src->num_attributes = list->num_attributes;
42 int attr_find_ex(AttrType *src, const Odr_oid **attribute_set_oid,
43 const char **string_value)
47 num_attributes = src->num_attributes;
48 while (src->major < num_attributes)
50 Z_AttributeElement *element;
52 element = src->attributeList[src->major];
53 if (src->type == *element->attributeType)
55 switch (element->which)
57 case Z_AttributeValue_numeric:
59 if (element->attributeSet && attribute_set_oid)
60 *attribute_set_oid = element->attributeSet;
61 return *element->value.numeric;
63 case Z_AttributeValue_complex:
64 if (src->minor >= element->value.complex->num_list)
66 if (element->attributeSet && attribute_set_oid)
67 *attribute_set_oid = element->attributeSet;
68 if (element->value.complex->list[src->minor]->which ==
69 Z_StringOrNumeric_numeric)
73 *element->value.complex->list[src->minor-1]->u.numeric;
75 else if (element->value.complex->list[src->minor]->which ==
76 Z_StringOrNumeric_string)
82 element->value.complex->list[src->minor-1]->u.string;
96 int attr_find(AttrType *src, const Odr_oid **attribute_set_id)
98 return attr_find_ex(src, attribute_set_id, 0);
105 * c-file-style: "Stroustrup"
106 * indent-tabs-mode: nil
108 * vim: shiftwidth=4 tabstop=8 expandtab