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) {
35 at = attr->first->data;
36 *s = *(char*)at->data;
41 destroyList(attr, (void(*)(void*))freeAttr);
48 int ngadmin_setQOSMode (struct ngadmin *nga, int s)
53 attr = createEmptyList();
54 pushBackList(attr, newByteAttr(ATTR_QOS_TYPE, s));
57 return writeRequest(nga, attr);
61 int ngadmin_getQOSValues (struct ngadmin *nga, char *ports)
66 int ret = ERR_OK, port;
70 if (nga == NULL || ports == NULL)
72 else if (nga->current == NULL)
76 attr = createEmptyList();
77 pushBackList(attr, newEmptyAttr(ATTR_QOS_CONFIG));
78 ret = readRequest(nga, attr);
82 filterAttributes(attr, ATTR_QOS_CONFIG, ATTR_END);
84 for (port = 0; port < nga->current->ports; port++)
85 ports[port] = PRIO_UNSPEC;
87 for (ln = attr->first; ln != NULL; ln = ln->next) {
90 ports[aq->port - 1] = aq->prio;
95 destroyList(attr, (void(*)(void*))freeAttr);
102 int ngadmin_setQOSValues (struct ngadmin *nga, const char *ports)
109 if (nga == NULL || ports == NULL)
111 else if (nga->current == NULL)
115 attr = createEmptyList();
117 for (port = 0; port < nga->current->ports; port++) {
118 if (ports[port] >= PRIO_HIGH && ports[port] <= PRIO_LOW) {
119 aq = malloc(sizeof(struct attr_qos));
123 aq->prio = ports[port];
124 pushBackList(attr, newAttr(ATTR_QOS_CONFIG, sizeof(struct attr_qos), aq));
129 return writeRequest(nga, attr);