5 #include <nsdp/protocol.h>
11 int ngadmin_getMirror (struct ngadmin *nga, char *ports)
18 if (nga == NULL || ports == NULL)
20 else if (nga->current == NULL)
24 attr = createEmptyList();
25 pushBackList(attr, newEmptyAttr(ATTR_MIRROR));
26 ret = readRequest(nga, attr);
30 filterAttributes(attr, ATTR_MIRROR, ATTR_END);
32 memset(ports, 0, 1 + nga->current->ports);
34 if (attr->first != NULL) {
35 at = attr->first->data;
36 memcpy(ports, at->data, 1 + nga->current->ports);
41 destroyList(attr, (void(*)(void*))freeAttr);
48 int ngadmin_setMirror (struct ngadmin *nga, const char *ports)
63 p = malloc(1 + sa->ports);
68 memset(p, 0, 1 + sa->ports);
70 memcpy(p, ports, 1 + sa->ports);
72 attr = createEmptyList();
73 pushBackList(attr, newAttr(ATTR_MIRROR, 1 + sa->ports, p));
76 return writeRequest(nga, attr);