5 #include <nsdp/protocol.h>
11 int ngadmin_getQOSMode (struct ngadmin *nga, int *s)
18 if (nga == NULL || s == NULL)
20 else if (nga->current == NULL)
24 attr = createEmptyList();
25 pushBackList(attr, newEmptyAttr(ATTR_QOS_TYPE));
26 ret = readRequest(nga, attr);
30 filterAttributes(attr, ATTR_QOS_TYPE, ATTR_END);
34 if (attr->first == NULL) {
38 at = attr->first->data;
43 *s = *(char*)at->data;
47 destroyList(attr, (void(*)(void*))freeAttr);
54 int ngadmin_setQOSMode (struct ngadmin *nga, int s)
59 attr = createEmptyList();
60 pushBackList(attr, newByteAttr(ATTR_QOS_TYPE, s));
63 return writeRequest(nga, attr);
67 int ngadmin_getQOSValues (struct ngadmin *nga, char *ports)
72 int ret = ERR_OK, port;
77 if (nga == NULL || ports == NULL)
84 attr = createEmptyList();
85 pushBackList(attr, newEmptyAttr(ATTR_QOS_CONFIG));
86 ret = readRequest(nga, attr);
90 filterAttributes(attr, ATTR_QOS_CONFIG, ATTR_END);
92 for (port = 0; port < sa->ports; port++)
93 ports[port] = PRIO_UNSPEC;
95 for (ln = attr->first; ln != NULL; ln = ln->next) {
102 if (aq->port <= sa->ports)
103 ports[aq->port - 1] = aq->prio;
108 destroyList(attr, (void(*)(void*))freeAttr);
115 int ngadmin_setQOSValues (struct ngadmin *nga, const char *ports)
122 if (nga == NULL || ports == NULL)
124 else if (nga->current == NULL)
128 attr = createEmptyList();
130 for (port = 0; port < nga->current->ports; port++) {
131 if (ports[port] >= PRIO_HIGH && ports[port] <= PRIO_LOW) {
132 aq = malloc(sizeof(struct attr_qos));
136 aq->prio = ports[port];
137 pushBackList(attr, newAttr(ATTR_QOS_CONFIG, sizeof(struct attr_qos), aq));
142 return writeRequest(nga, attr);