Exemplo n.º 1
0
/**
 *  \param id MessageID of requested message
 *
 *  Reads data from message queue until message with matching id is found.
 *
 *  \return GString containing unpacked message.
 **/
GString *get_message_by_id(MessageID id)
{
    GString *data = NULL;
    guint x, len;
    gboolean found = FALSE;

    g_mutex_lock(message_queue_mutex);
    do {
        len = g_queue_get_length(message_queue);
        for (x = 0; x<len; x++) {
            data = g_queue_peek_nth(message_queue, x);
            if (get_message_id(data) == id) {
                found = TRUE;
                g_queue_pop_nth(message_queue, x);
                break;
            }
        }

        if (found == FALSE)
            g_cond_wait(message_queue_cond, message_queue_mutex);

    } while (found == FALSE);
    g_mutex_unlock(message_queue_mutex);

    unpack_message(data);

    return data;
}
Exemplo n.º 2
0
/**
 *  \param list list containing unpacked preset SysEx messages.
 *
 *  Parses message
 *
 *  \return Preset which must be freed using preset_free, or NULL on error.
 **/
Preset *create_preset_from_data(GList *list)
{
    GString *data;
    GList *iter;
    gint total, n, x;
    gint bank, number, modified;
    gchar *name;

    g_return_val_if_fail(list != NULL, NULL);

    Preset *preset = g_slice_new(Preset);
    preset->name = NULL;
    preset->params = NULL;
    preset->genetxs = NULL;

    iter = list;
    for (iter = list; iter; iter = g_list_next(iter)) {
        data = (GString*) iter->data;
        switch (get_message_id(data)) {
        case RECEIVE_PRESET_START:
            bank = (unsigned char)data->str[8];
            number = (unsigned char)data->str[9];
            name = g_strdup(&data->str[10]);
            modified = (unsigned char)data->str[11+strlen(name)];

            if ((bank == PRESETS_EDIT_BUFFER) && (number == 0)) {
                g_message("Received current edit buffer");
            } else {
                g_message("Received preset %d from bank %d", number, bank);
            }

            g_message("Modified flag: %d Name: %s", modified, name);
            preset->name = name;
            break;
        case RECEIVE_PRESET_PARAMETERS:
            x = 0x09;
            n = 0;
            total = (unsigned char)data->str[x];
            x++;

            do {
                SettingParam *param = setting_param_new_from_data(&data->str[x], &x);
                n++;
                preset->params = g_list_prepend(preset->params, param);
                g_message("%d ID %d Position %d Value %d", n, param->id, param->position, param->value);
            } while ((x < data->len) && n<total);
            g_message("TOTAL %d", total);
            preset->params = g_list_reverse(preset->params);
            break;
        case RECEIVE_PRESET_END:
            break;
        default:
            g_message("Unhandled message in preset messages list");
        }
    }

    return preset;
}
Exemplo n.º 3
0
void 
NSetSCU
::set(std::shared_ptr<DataSet> dataset) const
{
    auto request = std::make_shared<message::NSetRequest const>(
        this->_association.next_message_id(),
        this->_affected_sop_class,
        dataset->as_string(registry::RequestedSOPInstanceUID, 0),
        dataset);

    this->_association.send_message(request, this->_affected_sop_class);
    
    auto response = std::make_shared<message::NSetResponse const>(
        this->_association.receive_message());

    if(response->get_message_id_being_responded_to() != request->get_message_id())
    {
        std::ostringstream message;
        message << "DIMSE: Unexpected Response MsgId: "
                << response->get_message_id_being_responded_to()
                << "(expected: " << request->get_message_id() << ")";
        throw Exception(message.str());
    }
}
Exemplo n.º 4
0
int get_sno(int stat,infostruct user, char *sno,char *header,char *ask){
	WINDOW *send_reply;
	char conf;
	int retval = 2;
	int x,y;
	char *screen_name;
	double message_id;
	char *message;
	screen_name = (char *)malloc(25 * sizeof(char));
	if(screen_name == NULL){
		return 1;
	}

	message = (char *)malloc(200 * sizeof(char));
	if(message == NULL){
		return 1;
	}

	echo();
	send_reply = newwin(10,80,user.row/2, (user.col - 80)/2);
	keypad(send_reply,TRUE);
	box(send_reply,0,0);
	wattron(send_reply,A_BOLD);
	mvwprintw(send_reply,2,(getmaxx(send_reply) -strlen(header))/2,"%s",header);
	wattroff(send_reply,A_BOLD);
	mvwprintw(send_reply,4,5,"%s",ask);
	wrefresh(send_reply);
	wscanw(send_reply,"%s",sno);

	if((message_id = get_message_id(stat,sno,&screen_name,&message)) == 1)
		return 1;

	getyx(send_reply,y,x);
	mvwprintw(send_reply,getmaxy(send_reply)- 2,5,"%s","Confirm? [y/N]");
	wrefresh(send_reply);
	do {
		conf = wgetch(send_reply);
		if(conf == 'Y' || conf == 'y')
			retval = 0;
		else if (conf == 'N' || conf == 'n')
			retval = 1;
	}while(conf != 'y' && conf != 'Y' && conf != 'N' && conf != 'n');
	
	noecho();
	refresh();
	delwin(send_reply);
	return retval;
}
Exemplo n.º 5
0
int get_reply_to_post(infostruct user,char *reply, char *sno){
	WINDOW *send_reply;
	WINDOW *msgwind;
	char conf;
	int retval = 2;
	int x,y;
	char *header = "*** Send A Reply ***";
	int i = 0;
	char *screen_name;
	double message_id;
	char *message;
	screen_name = (char *)malloc(25 * sizeof(char));
	if(screen_name == NULL){
		return 1;
	}
	/* i dont need this here.. needed in the retweet */
	message = (char *)malloc(140 * sizeof(char));
	if(message == NULL){
		return 1;
	}

	echo();
	cbreak();
	send_reply = newwin(10,80,user.row/2, (user.col - 80)/2);
	keypad(send_reply,TRUE);
	msgwind = derwin(send_reply,5,50,4,5 + strlen("Enter reply: "));
	keypad(msgwind,TRUE);
	box(send_reply,0,0);
	wattron(send_reply,A_BOLD);
	mvwprintw(send_reply,2,(getmaxx(send_reply) -strlen(header))/2,"%s",header);
	wattroff(send_reply,A_BOLD);
	mvwprintw(send_reply,4,5,"%s","Reply to sno :");
	wrefresh(send_reply);
	wscanw(send_reply,"%s",sno);

	if((message_id = get_message_id(0,sno,&screen_name,&message)) == 1)
		return 1;
	mvwprintw(send_reply,4,5,"%s","Enter reply: ");
	noecho();
	wrefresh(send_reply);
	getyx(send_reply,y,x);
	touchwin(send_reply);
	mvwprintw(msgwind,0,0,"@%s " ,screen_name);
	wrefresh(msgwind);

	while (1){
		int k;

		if(i > (140 - (int)strlen(screen_name) -2))
			wattron(send_reply,COLOR_PAIR(2));
		mvwprintw(send_reply,8,76,"   ");
		mvwprintw(send_reply,8,76,"%i",140 - strlen(screen_name) - 2 -i);
		if(i > (140 - (int)strlen(screen_name) -2))
			wattroff(send_reply,COLOR_PAIR(2));

		wrefresh(send_reply);
		wrefresh(msgwind);

		k = wgetch(msgwind);
		if(k == '\n')
			break;

		if ((k == KEY_BACKSPACE) && i > 0){
			getyx(msgwind,y,x);
			/* if on 1st of line 2, please go back to the last of line 1*/
			if((i + strlen(screen_name) + 2) == 50){
				mvwaddch(msgwind,y-1,49,' ');
				wmove(msgwind,y-1,49);
			}
			else if((i + strlen(screen_name) + 2) == 100){
				mvwaddch(msgwind,y-1,49,' ');
				wmove(msgwind,y-1,49);
			}
			else if((i + strlen(screen_name) + 2 ) == 150){
				mvwaddch(msgwind,y-1,49,' ');
				wmove(msgwind,y-1,49);
			}
			else {
				mvwaddch(msgwind,y,x -1,' ');
				wmove(msgwind,y,x-1);
			}
				
			i = i-1;
			
			
		}
		else {
			/* if its at 0 and i press a bcakspace, i dont want anything to happen, without the if, it was printing ^G etc */
			if(k != KEY_BACKSPACE){
				reply[i] = k;
				waddch(msgwind,reply[i]);
				i++;
			}
		}

	}

	reply[i+1] = '\0';
	wrefresh(send_reply);
	echo();
		

	getyx(send_reply,y,x);
	mvwprintw(send_reply,getmaxy(send_reply)- 2,5,"%s","Send? [y/N]");
	wrefresh(send_reply);
	do {
		conf = wgetch(send_reply);
		if(conf == 'Y' || conf == 'y')
			retval = 0;
		else if (conf == 'N' || conf == 'n')
			retval = 1;
	}while(conf != 'y' && conf != 'Y' && conf != 'N' && conf != 'n');
	
	noecho();
	refresh();
	delwin(send_reply);
	return retval;
}
Exemplo n.º 6
0
/* retweet : almost same as send reply.. small alterations.. */
int retweet(infostruct user,char * error){
	char *update  = "http://twitter.com/statuses/update.xml";
	CURL *easy_handle;
	CURLcode success;
	int retval = 0;
	char *status_send;
	FILE *temp_file;
	char sno[4];
	double message_id = 0;
	char *screen_name;
	char *message;
	char *header = "*** Retweet ***";
	char *ask = "Sno to retweet: ";

	if(get_sno(0,user,sno,header,ask)){
		refresh();
		return 2;
	}

	screen_name = (char *)malloc(25 * sizeof(char));
	if(screen_name == NULL){
		return 1;
	}
	message = (char *)malloc(300 * sizeof(char));
	if(message == NULL){
		return 1;
	}

	if((message_id = get_message_id(0,sno,&screen_name,&message)) == 1)
		return 1;

	if(!(temp_file = fopen("/dev/null","w"))){
		return 1;
	}
	/* debug 
	printw("%.0f",message_id);
	refresh();
	sleep(2);
	*/


	status_send = (char*)malloc(strlen("status=") + 50 + strlen(message) * sizeof(char));
	/*strcpy(status_send,"status=");
	strcat(status_send,reply);*/
	sprintf(status_send,"status=RT @%s %s&in_reply_to_status_id=%.0f",screen_name,message,message_id);
	/*sprintf(status_send + strlen(status_send) -1,"&in_reply_to_status_id=%.0f",message_id);*/
	
	/* debug
	clear();
	printw("%s",status_send);
	refresh();
	sleep(2);*/

	easy_handle = curl_easy_init();
	curl_easy_setopt(easy_handle,CURLOPT_NOPROGRESS,1);
	curl_easy_setopt(easy_handle,CURLOPT_VERBOSE, 0);
	curl_easy_setopt(easy_handle,CURLOPT_URL,update);
	curl_easy_setopt(easy_handle,CURLOPT_HTTPAUTH,CURLAUTH_ANY);
	curl_easy_setopt(easy_handle,CURLOPT_ERRORBUFFER,error);
	curl_easy_setopt(easy_handle,CURLOPT_USERNAME,user.username);
	curl_easy_setopt(easy_handle,CURLOPT_PASSWORD,user.password);
	if(strcmp(user.proxy,"0")){
		curl_easy_setopt(easy_handle,CURLOPT_PROXY,user.proxy);

		if(strcmp(user.proxy_port,"0"))
			curl_easy_setopt(easy_handle,CURLOPT_PROXYPORT,user.proxy_port);
		if(strcmp(user.proxy_username,"0"))
			curl_easy_setopt(easy_handle,CURLOPT_PROXYUSERNAME,user.proxy_username);
		if(strcmp(user.proxy_password,"0"))
			curl_easy_setopt(easy_handle,CURLOPT_PROXYPASSWORD,user.proxy_password);
	}
	curl_easy_setopt(easy_handle,CURLOPT_WRITEDATA,temp_file);	
	curl_easy_setopt(easy_handle,CURLOPT_POST,1);
	curl_easy_setopt(easy_handle,CURLOPT_COPYPOSTFIELDS,status_send);
	if((success = curl_easy_perform(easy_handle)))
		retval = 1;
	
	curl_easy_cleanup(easy_handle);

	free(screen_name);
	/*free(status_send);*/
	fclose(temp_file);
	refresh();
	return retval;

}
Exemplo n.º 7
0
void push_message(GString *msg)
{
    MessageID msgid = get_message_id(msg);
    if (((unsigned char)msg->str[0] == 0xF0) &&
            ((unsigned char)msg->str[msg->len-1] == 0xF7)) {
        debug_msg(DEBUG_VERBOSE, "Pushing correct message!");
    } else {
        g_warning("Pushing incorrect message!");
    }

    int x;
    if (debug_flag_is_set(DEBUG_HEX)) {
        for (x = 0; x<msg->len; x++) {
            if (x && (x % HEX_WIDTH) == 0) {
                printf("\n");
            }
            printf("%02x ", (unsigned char)msg->str[x]);
        }
        if (x % HEX_WIDTH) {
            printf("\n");
        }
    }
    debug_msg(DEBUG_VERBOSE, "Received %s", get_message_name(msgid));

    SettingParam *param;
    switch (msgid) {
        case ACK:
            g_string_free(msg, TRUE);
            return;

        case NACK:
            g_warning("Received NACK!");
            g_string_free(msg, TRUE);
            return;

        case RECEIVE_PARAMETER_VALUE:
        {
            unpack_message(msg);
            param = setting_param_new_from_data(&msg->str[8], NULL);
            if (debug_flag_is_set(DEBUG_MSG2HOST)) {
                GString *ipv = format_ipv(param->id,
                                          param->position,
                                          param->value);
                debug_msg(DEBUG_MSG2HOST, "RECEIVE_PARAMETER_VALUE\n%s",
                                          ipv->str);
                g_string_free(ipv, TRUE);
            }

            GDK_THREADS_ENTER();
            apply_setting_param_to_gui(param);
            GDK_THREADS_LEAVE();

            setting_param_free(param);
            g_string_free(msg, TRUE);
            return;
        }

        case RECEIVE_DEVICE_NOTIFICATION:
            unpack_message(msg);
            unsigned char *str = (unsigned char*)msg->str;
            switch (str[8]) {
            case NOTIFY_PRESET_MOVED:
                if (str[11] == PRESETS_EDIT_BUFFER && str[12] == 0) {

                    GDK_THREADS_ENTER();
                    g_timeout_add(0, apply_current_preset_to_gui, NULL);
                    GDK_THREADS_LEAVE();
                    debug_msg(DEBUG_MSG2HOST,
                              "RECEIVE_DEVICE_NOTIFICATION: Loaded preset "
                              "%d from bank %d",
                              str[10], str[9]);
                } else {
                    debug_msg(DEBUG_MSG2HOST,
                              "RECEIVE_DEVICE_NOTIFICATION: %d %d moved to "
                              "%d %d",
                              str[9], str[10],
                              str[11], str[12]);
                }
                break;

            case NOTIFY_MODIFIER_GROUP_CHANGED:
            {
                int i;
                if (debug_flag_is_set(DEBUG_HEX)) {
                    printf("\n");
                    for (i = 0; i < msg->len; i++) {
                        printf(" %02x", (unsigned char) str[i]);
                    }
                    printf("\n");
                }

                debug_msg(DEBUG_MSG2HOST,
                          "NOTIFY_MODIFIER_GROUP_CHANGED: Modifier group "
                          "id %d changed",
                          (str[9] << 8) | (str[10]));

                if (!modifier_linkable_list_request_pending) {
                    send_message(REQUEST_MODIFIER_LINKABLE_LIST, "\x00\x01", 2);
                    modifier_linkable_list_request_pending = TRUE;
                }

                break;
            }
            default:
                g_warning("Received unhandled device notification 0x%x",
                          str[11]);
            }
            g_string_free(msg, TRUE);
            return;
        case RECEIVE_GLOBAL_PARAMETERS:
            unpack_message(msg);
            gint tot, n, x;
            tot = (unsigned char)msg->str[9];
            if (debug_flag_is_set(DEBUG_HEX)) {
                for (n = 0; n < msg->len; n++) {
                    printf("%02x ",(unsigned char) msg->str[n]);
                }
                printf("\n");
            }

            n = 0;
            x = 10;
            do {
                param = setting_param_new_from_data(&msg->str[x], &x);
                debug_msg(DEBUG_MSG2HOST,
                          "RECEIVE_GLOBAL_PARAMETERS ID: %5d "
                          "Position: %2.1d Value: %6.1d: %s",
                          param->id,
                          param->position, param->value, "XXX");

                GDK_THREADS_ENTER();
                apply_setting_param_to_gui(param);
                GDK_THREADS_LEAVE();

                setting_param_free(param);
            } while ( (x < msg->len) && n < tot);

            g_string_free(msg, TRUE);
            return;


        case RECEIVE_MODIFIER_LINKABLE_LIST:

            modifier_linkable_list_request_pending = FALSE;
            unpack_message(msg);
            tot = (unsigned char)msg->str[9];

            if (debug_flag_is_set(DEBUG_HEX)) {
                for (n = 0; n < msg->len; n++) {
                    printf("%02x ",(unsigned char) msg->str[n]);
                }
                printf("\n");
            }


            update_modifier_linkable_list(msg);

            g_string_free(msg, TRUE);

            GDK_THREADS_ENTER();

            create_modifier_group(EXP_POSITION, EXP_ASSIGN1);
            create_modifier_group(LFO1_POSITION, LFO_TYPE);
            create_modifier_group(LFO2_POSITION, LFO_TYPE);

            GDK_THREADS_LEAVE();

            return;


        default:
            g_mutex_lock(message_queue_mutex);
            g_queue_push_tail(message_queue, msg);
            g_cond_signal(message_queue_cond);
            g_mutex_unlock(message_queue_mutex);
            break;
    }
}
Exemplo n.º 8
0
void push_message(GString *msg)
{
    if (((unsigned char)msg->str[0] == 0xF0) && ((unsigned char)msg->str[msg->len-1] == 0xF7))
        g_message("Pushing correct message!");
    else
        g_warning("Pushing incorrect message!");

    int x;
    for (x = 0; x<msg->len; x++)
        printf("%02x ", (unsigned char)msg->str[x]);
    printf("\n");

    switch (get_message_id(msg)) {
        case ACK:
            g_message("Received ACK");
            g_string_free(msg, TRUE);
            return;

        case NACK:
            g_message("Received NACK");
            g_string_free(msg, TRUE);
            return;

        case RECEIVE_PARAMETER_VALUE:
            unpack_message(msg);
            SettingParam *param = setting_param_new_from_data(&msg->str[8], NULL);
            g_message("Received parameter change ID: %d Position: %d Value: %d", param->id, param->position, param->value);

            GDK_THREADS_ENTER();
            apply_setting_param_to_gui(param);
            GDK_THREADS_LEAVE();

            setting_param_free(param);
            g_string_free(msg, TRUE);
            return;

        case RECEIVE_DEVICE_NOTIFICATION:
            unpack_message(msg);
            unsigned char *str = (unsigned char*)msg->str;
            switch (str[8]) {
                case NOTIFY_PRESET_MOVED:
                    if (str[11] == PRESETS_EDIT_BUFFER && str[12] == 0) {
                        g_message("Loaded preset %d from bank %d", str[10], str[9]);

                        GDK_THREADS_ENTER();
                        g_timeout_add(0, apply_current_preset_to_gui, NULL);
                        GDK_THREADS_LEAVE();
                    } else
                        g_message("%d %d moved to %d %d", str[9], str[10], str[11], str[12]);
                default:
                    g_message("Received unhandled device notification");
            }
            g_string_free(msg, TRUE);
            return;
        default:
            g_mutex_lock(message_queue_mutex);
            g_queue_push_tail(message_queue, msg);
            g_cond_signal(message_queue_cond);
            g_mutex_unlock(message_queue_mutex);
    }
}
Exemplo n.º 9
0
Arquivo: libsql.c Projeto: kulhos/pip
/*-------------------------------------------------------------------*/
int ProfileSQL (const unsigned char *sql_token,
		const unsigned char *sql_message,
		const unsigned char *sql_qualifiers,
		unsigned char *profile_reply,
		unsigned char *retry,
		int   time_out)
{
	STR_DESCRIPTOR request, reply;
        char request_buffer[MAX_MSG_SIZE], reply_buffer[MAX_MSG_SIZE];
	int aa, i, j, k, num_size, error_code, error_code2, offset;
	unsigned char *(header_and_message[6]);
        unsigned char *(header_strings[6]);
        unsigned char *(message_strings1[1000]);
        unsigned char *(message_strings2[1000]);
	char buffer[MAX_MSG_SIZE];
	char	*pszSql = NULL,*new_sql_message = NULL, *new_using_clause;
	long	len_new_sql_message, len_new_using_clause;
	unsigned char *col_attributes= NULL, *new_sql_qualifiers = NULL;
	char	*lpsSelect;
	char	*tokens;
	int	nLen = 0;
	struct tm *curTime; 
	time_t	ltime;
	char	tmpBuf[128];
	
	if(sql_message == NULL) {
		strcpy((char *)profile_reply,"MSG_8564|Invalid SQL Command");
		strcat((char *)profile_reply,(char *)sql_message);
		return 1;
	}
	
	memset (request_buffer,0,sizeof(request_buffer));
	memset (reply_buffer,0,sizeof(reply_buffer));
	request.str = request_buffer;
	reply.str   = reply_buffer;

	/* Get time as number */
	time(&ltime);
	curTime = localtime( &ltime );

	/* Use strftime to build a customized time string. */
	strftime( tmpBuf, 128,"OPEN CURSOR CUR%H%M%S AS \n", curTime );

	/* For SELECT add open cursor */
	tokens = (char *)strstr((char *)sql_message, " ");
	nLen = tokens - (char *)sql_message;
	lpsSelect  = (char *) calloc(nLen + 1,1);
	if(NULL == lpsSelect)
		return -1;
	strncpy(lpsSelect,(char *)sql_message,nLen);
	pszSql = (char *)calloc(MAX_MSG_SIZE,1);
	if(strcasecmp(lpsSelect,"SELECT") == 0) {
		strcpy(pszSql,tmpBuf);
		strcat(pszSql,(char *)sql_message);
	}
	else
		strcpy(pszSql,(char *)sql_message);
	free(lpsSelect);

	new_sql_message = (char *) calloc(MAX_MSG_SIZE,1);
	new_using_clause = (char *) calloc(MAX_MSG_SIZE,1);
	len_new_sql_message = MAX_MSG_SIZE;
	len_new_using_clause = MAX_MSG_SIZE;

	error_code = ParseHostSQL(pszSql, strlen(pszSql),
		NULL ,0 ,new_sql_message, &len_new_sql_message,
		new_using_clause, &len_new_using_clause );
	free(pszSql);

        logging (NULL, "\nSQL MESSAGE\n");
        logging (NULL,(char*) sql_message);
        logging (NULL, "\nCLEANED SQL MESSAGE\n");
        logging (NULL,(char*) new_sql_message);
		
	if(len_new_using_clause) {
		nLen = strlen((char *)sql_qualifiers)+ len_new_using_clause + 1;
		new_sql_qualifiers = (unsigned char *)calloc(nLen + 1, 1);
		strcpy((char *)new_sql_qualifiers, (char *)sql_qualifiers);
		strcat((char *)new_sql_qualifiers,new_using_clause);
		pack_sql(&request,(unsigned char *)new_sql_message,
			new_sql_qualifiers,sql_token,retry);
	}
	else
	{
		pack_sql(&request,(unsigned char *)new_sql_message,
			sql_qualifiers,sql_token,retry);
	}
	/* thoniyim 09/21/2001
	   memory leak fix
	*/
	free(new_sql_message);
        free(new_using_clause); 

	k=0;
        logging (&request, "\nSQL MESSAGE SENT TO SERVER\n");        

   	ClExchmsg(4, &request, &reply, time_out, &k);

        logging (&reply, "\nSERVER RESPONSE TO SQL MESSAGE\n");
        error_code = error_check (k,CLSQL,&reply,profile_reply);

        if (error_code == OK_BUT_EMPTY_MESSAGE_BODY) {
              profile_reply[0] = 0;
              return OK;
        }

	if (error_code != OK && error_code != SQL_OK) {
           if (error_code == 4) {
              total_time_outs++;
              conseg_time_outs++;
               if (total_time_outs > 50000 || conseg_time_outs > 5000) {
                   printf ("\nValue of total_time_outs and conseg_time_outs: %d  %d\n", 
                        total_time_outs, conseg_time_outs);
                   exit (1);
               }
               ClDisconnect(2, buffer);
               ClConnect(2, passed_mtm_address, &k);
               error_code2 = error_check (k,CLCONNECT,(unsigned
                           char*)0,profile_reply);
               if (error_code2 != OK) {
	           i = get_message_id (retry,FALSE);
                   return error_code2;
               }
           }

	   i = get_message_id (retry,FALSE);
	   return error_code;
	}
        conseg_time_outs = 0;

        i = move_number(reply_buffer, reply.length-2);
	memcpy(reply_buffer+i,reply.str+1,reply.length-2);
        reply.str = reply_buffer;
        parse_string(reply.str,header_and_message);
 
        /*
         * thoniyim - CR 7426 - 01/16/2004
         * Check the data from the host for message id.
         * Check if the message id of request and reply matches.
         */
 
        parse_string(header_and_message[1],header_strings);
 
        i = memcmp(header_array[2].field,
                   header_strings[2]+1,
                   header_array[2].field_size);
        if (i != 0)
        {
                strcpy(profile_reply,"Message Ids for the request and reply does
n't match. Disconnect and connect again.");
                return -1001;
        }