Exemplo n.º 1
0
int dsp_server_connection_info::iteratePost(const char* key, const char* data, size_t size) 
{
    if (size > 0) {
        if (strcmp(key, "name") == 0) {
            fNameApp += nameWithoutSpaces(data);
            if (fNameApp == "") {
                fNameApp = "RemoteDSPServer_DefaultName";
            }
        } else if (strcmp(key, "audio_type") == 0) {
            fAudioType = data;
        } else if (strcmp(key, "dsp_data") == 0) {
            fFaustCode += data;  // Possibly several post ?
        } else if (strcmp(key,"target") == 0) {
            fTarget = data;  
        } else if (strcmp(key, "NJ_ip") == 0) {
            fIP = data;
        } else if (strcmp(key, "NJ_port") == 0) {
            fPort = data;   
        } else if (strcmp(key, "NJ_latency") == 0) {
            fLatency = data;
        } else if (strcmp(key, "NJ_compression") == 0) {
            fCompression = data;        
        } else if (strcmp(key, "NJ_mtu") == 0) {
            fMTU = data;
        } else if (strcmp(key, "shaKey") == 0) {
            fSHAKey = data;
        } else if (strcmp(key, "instanceKey") == 0) {
            fInstanceKey = data;
        } else if (strcmp(key, "options") == 0) {
            fCompilationOptions.push_back(data);
        } else if (strcmp(key, "opt_level") == 0) {
            fOptLevel = data;
        } else if (strcmp(key, "LA_sample_rate") == 0) {
            fSampleRate = data;
        } else if (strcmp(key, "LA_buffer_size") == 0) {
            fBufferSize = data;
        } else if (strcmp(key, "poly") == 0) {
            fPoly = data;
        } else if (strcmp(key, "voices") == 0) {
            fVoices = data;
        } else if (strcmp(key, "group") == 0) {
            fGroup = data;
        } else if (strcmp(key, "osc") == 0) {
            fOSC = data;
        } else if (strcmp(key, "httpd") == 0) {
            fHTTPD = data;
        } else if (strcmp(key, "midi") == 0) {
            fMIDI = data;
        }  
    }
    
    fAnswercode = MHD_HTTP_OK;
    return MHD_YES;
}
Exemplo n.º 2
0
// Callback processing the received data.
// The datas are stocked in connection_info_struct
int Server::iterate_post(void *coninfo_cls, MHD_ValueKind /*kind*/, const char *key, const char */*filename*/, const char */*content_type*/, const char */*transfer_encoding*/, const char *data, uint64_t /*off*/, size_t size){
    
    struct connection_info_struct *con_info = (connection_info_struct*)coninfo_cls;
    
//    printf("FLServer::iterate_post %s\n", key);
    
    if (size > 0) {
        
        if(strcmp(key,"name") == 0){
            con_info->fNameApp+=nameWithoutSpaces(data);
            if(con_info->fNameApp.compare("") == 0)
                con_info->fNameApp = "RemoteServer_DefaultName";
        }
        if(strcmp(key,"data") == 0)
            con_info->fFaustCode+=data;        
            
        if(strcmp(key,"NJ_ip") == 0) 
            con_info->fIP = data;
        
        if(strcmp(key,"NJ_port") == 0) 
            con_info->fPort =data;   
        
        if(strcmp(key,"NJ_latency") == 0)
            con_info->fLatency = data;
        
        if(strcmp(key,"NJ_compression") == 0)
            con_info->fCV = data;        
        
        if(strcmp(key,"NJ_mtu") == 0) 
            con_info->fMTU = data;
        
        if(strcmp(key,"shaKey") == 0)
            con_info->fSHAKey = data;
        
        if(strcmp(key,"instanceKey") == 0)
            con_info->fInstanceKey = data;
        
        if(strcmp(key,"factoryKey") == 0)
            con_info->fFactoryKey = data;
        
        if(strcmp(key,"options") == 0)
            con_info->fCompilationOptions.push_back(string(data));
        
        if(strcmp(key,"opt_level") == 0)
            con_info->fOptLevel = data;
    }
    
    con_info->fAnswercode = MHD_HTTP_OK;
    
    return MHD_YES;
}