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;
71 if (nga == NULL || ports == NULL)
78 attr = createEmptyList();
79 pushBackList(attr, newEmptyAttr(ATTR_QOS_CONFIG));
80 ret = readRequest(nga, attr);
84 filterAttributes(attr, ATTR_QOS_CONFIG, ATTR_END);
86 for (port = 0; port < sa->ports; port++)
87 ports[port] = PRIO_UNSPEC;
89 for (ln = attr->first; ln != NULL; ln = ln->next) {
92 if (aq->port <= sa->ports)
93 ports[aq->port - 1] = aq->prio;
98 destroyList(attr, (void(*)(void*))freeAttr);
105 int ngadmin_setQOSValues (struct ngadmin *nga, const char *ports)
112 if (nga == NULL || ports == NULL)
114 else if (nga->current == NULL)
118 attr = createEmptyList();
120 for (port = 0; port < nga->current->ports; port++) {
121 if (ports[port] >= PRIO_HIGH && ports[port] <= PRIO_LOW) {
122 aq = malloc(sizeof(struct attr_qos));
126 aq->prio = ports[port];
127 pushBackList(attr, newAttr(ATTR_QOS_CONFIG, sizeof(struct attr_qos), aq));
132 return writeRequest(nga, attr);