void call_response_callback()

in Sources/SLSIPA4Unity/SLSIPA4Unity.m [133:156]


    void call_response_callback(cs_sls_complete_callback callback, SLSResponse *response) {
        if (nil == response || nil == callback) {
            return;
        }
        
        const char * content = strdup(response.content.length > 0 ? response.content.UTF8String : "");
        const char * context = strdup(nil != response.context ? ((NSString *)response.context).length > 0 ? ((NSString *)response.context).UTF8String : "": "");
        const char * error = strdup(response.error.length > 0 ? response.error.UTF8String : "");
        
        int type = 0;
        if ([@"http" isEqualToString:response.type]) {
            type = 0;
        } else if ([@"ping" isEqualToString:response.type]) {
            type = 1;
        } else if ([@"tcpping" isEqualToString:response.type]) {
            type = 2;
        } else if ([@"mtr" isEqualToString:response.type]) {
            type = 3;
        } else if ([@"dns" isEqualToString:response.type]) {
            type = 4;
        }
        
        callback(type, content, context, error);
    }