src/config_opc.c
IG_Status create_subscriptions_response(xmlXPathObjectPtr obj, IG_ConfigResponse * response) {
    xmlNodePtr curr_node = NULL;
    IG_UInt32 amount;
    if(obj->nodesetval == NULL || obj->nodesetval->nodeTab == NULL) {
        printf("no nodes in xpathobj\n");
        return IG_STATUS_BAD;
    }
    amount = obj->nodesetval->nodeNr;
    
    IG_OPC_Subscription * subs = (IG_OPC_Subscription *) malloc( amount * sizeof(IG_OPC_Subscription));
    
    IG_UInt32 j = 0;
    for(IG_UInt32 i = 0;i < amount; i++) {
        curr_node = obj->nodesetval->nodeTab[i];
        unsigned char * curr_node_interval = xmlGetProp(curr_node, IG_CONFIG_OPC_INTERVALATTRNAME);
        if(curr_node_interval == NULL) {
            continue;
        }

        unsigned char * curr_node_subid = xmlGetProp(curr_node, IG_CONFIG_OPC_SUBID);
        if(curr_node_subid == NULL) {
            continue;
        }

        IG_UInt32 subid = atoi(curr_node_subid);
        if(subid == 0) {
            free(curr_node_interval);
            free(curr_node_subid);
            continue;
        }
        IG_UInt32 interval = atoi(curr_node_interval);
        if(interval == 0) {
            free(curr_node_interval);
            free(curr_node_subid);
            continue;
        }

        free(curr_node_interval);
        free(curr_node_subid);
        
        subs[j].subscription_id = subid;
        subs[j].timeintervalms = interval;
        j++;
    }

    response->data = (void *) subs;
    response->responseAmount = j;
    return IG_STATUS_GOOD;


}
//parse the xpath answer to real structs
parse the xpath answer to real structs
parse the xpath answer to real structs
IG_Status create_subscriptions_response(xmlXPathObjectPtr obj, IG_ConfigResponse * response) {
    xmlNodePtr curr_node = NULL;
    IG_UInt32 amount;
    if(obj->nodesetval == NULL || obj->nodesetval->nodeTab == NULL) {
        printf("no nodes in xpathobj\n");
        return IG_STATUS_BAD;
    }
    amount = obj->nodesetval->nodeNr;
    IG_OPC_Subscription * subs = (IG_OPC_Subscription *) malloc( amount * sizeof(IG_OPC_Subscription));
    IG_UInt32 j = 0;
    for(IG_UInt32 i = 0;i < amount; i++) {
        curr_node = obj->nodesetval->nodeTab[i];
        unsigned char * curr_node_interval = xmlGetProp(curr_node, IG_CONFIG_OPC_INTERVALATTRNAME);
        if(curr_node_interval == NULL) {
            continue;
        }
        unsigned char * curr_node_subid = xmlGetProp(curr_node, IG_CONFIG_OPC_SUBID);
        if(curr_node_subid == NULL) {
            continue;
        }
        IG_UInt32 subid = atoi(curr_node_subid);
        if(subid == 0) {
            free(curr_node_interval);
            free(curr_node_subid);
            continue;
        }
        IG_UInt32 interval = atoi(curr_node_interval);
        if(interval == 0) {
            free(curr_node_interval);
            free(curr_node_subid);
            continue;
        }
        free(curr_node_interval);
        free(curr_node_subid);
        subs[j].subscription_id = subid;
        subs[j].timeintervalms = interval;
        j++;
    }
    response->data = (void *) subs;
    response->responseAmount = j;
    return IG_STATUS_GOOD;
}
IG_Status create_subscriptions_response ( xmlXPathObjectPtr obj , IG_ConfigResponse * response ) { xmlNodePtr curr_node = NULL ; IG_UInt32 amount ; if ( obj -> nodesetval == NULL || obj -> nodesetval -> nodeTab == NULL ) { printf ( " \n " ) ; return IG_STATUS_BAD ; } amount = obj -> nodesetval -> nodeNr ; IG_OPC_Subscription * subs = ( IG_OPC_Subscription * ) malloc ( amount * sizeof ( IG_OPC_Subscription ) ) ; IG_UInt32 j = 0 ; for ( IG_UInt32 i = 0 ; i < amount ; i ++ ) { curr_node = obj -> nodesetval -> nodeTab [ i ] ; unsigned char * curr_node_interval = xmlGetProp ( curr_node , IG_CONFIG_OPC_INTERVALATTRNAME ) ; if ( curr_node_interval == NULL ) { continue ; } unsigned char * curr_node_subid = xmlGetProp ( curr_node , IG_CONFIG_OPC_SUBID ) ; if ( curr_node_subid == NULL ) { continue ; } IG_UInt32 subid = atoi ( curr_node_subid ) ; if ( subid == 0 ) { free ( curr_node_interval ) ; free ( curr_node_subid ) ; continue ; } IG_UInt32 interval = atoi ( curr_node_interval ) ; if ( interval == 0 ) { free ( curr_node_interval ) ; free ( curr_node_subid ) ; continue ; } free ( curr_node_interval ) ; free ( curr_node_subid ) ; subs [ j ] . subscription_id = subid ; subs [ j ] . timeintervalms = interval ; j ++ ; } response -> data = ( void * ) subs ; response -> responseAmount = j ; return IG_STATUS_GOOD ; }
parse the xpath answer to real structs
parse the xpath answer to real structs