Ejemplo n.º 1
0
/*
  1. Invokes the CREATE_PROCESS service, using the process attributes as input parameter.
  2. Checks the returned error code against the expected one.
  3. If the returned error code is ok, call the GET_PROCESS_STATUS service using the returned process
 	 parameter as input parameter.
  4. Check that the return code of the method is equal to NO_ERROR.
  5. If no error occurred, compare the attribute values returned by the method against the expected values
	 for them.
  6. Return the returned processId, the process status returned by the GET_PROCESS_STATUS service,
     the error code and one structure indicating the results of the comparisons between the expected values
     passed as parameters and the actual values, returned by the invoked services.
*/
struct create_process_error_type checkcreate_process(PROCESS_ATTRIBUTE_TYPE a, PROCESS_ID_TYPE id, RETURN_CODE_TYPE retCode, RETURN_CODE_TYPE code){
	struct create_process_error_type c_p_e;
	PROCESS_STATUS_TYPE status;
	char sal_code[MAX_CAD];

	c_p_e = initCreate();

	if (code == retCode){
		GET_PROCESS_STATUS(id, &status, &retCode);
		if (retCode == NO_ERROR){
			if (strcmp(a.NAME, status.ATTRIBUTES.NAME)!=0){
				c_p_e.test_name = TRUE;
			}else if (a.ENTRY_POINT != status.ATTRIBUTES.ENTRY_POINT){
				c_p_e.test_entry_p = TRUE;
			}else if (a.STACK_SIZE != status.ATTRIBUTES.STACK_SIZE){
				c_p_e.test_stack_s = TRUE;
			}else if (a.BASE_PRIORITY != status.ATTRIBUTES.BASE_PRIORITY){
				c_p_e.test_base_p = TRUE;
			}else if (a.PERIOD != status.ATTRIBUTES.PERIOD){
				c_p_e.test_period = TRUE;
			}else if (a.TIME_CAPACITY != status.ATTRIBUTES.TIME_CAPACITY){
				c_p_e.test_time_c = TRUE;
			}else if (a.DEADLINE != status.ATTRIBUTES.DEADLINE){
				c_p_e.test_deadline = TRUE;
			}
		}else{
			CHECK_CODE(": GET_PROCESS_STATUS in subfunction checkcreate_process", retCode, sal_code);
    		printf("%s\n", sal_code);
		}
	}else
		c_p_e.test_code = TRUE;

	return c_p_e;
}
Ejemplo n.º 2
0
//-------------------------------------------------------------------------------------
void ClientObject::gameTick()
{
	if(pChannel()->endpoint())
	{
		pChannel()->handleMessage(NULL);
		sendTick();
	}

	switch(state_)
	{
		case C_STATE_INIT:

			state_ = C_STATE_PLAY;

			if(!initCreate() || !createAccount())
				return;

			break;
		case C_STATE_LOGIN:

			state_ = C_STATE_PLAY;

			if(!login())
				return;

			break;
		case C_STATE_LOGIN_GATEWAY:

			state_ = C_STATE_PLAY;

			if(!initLoginGateWay() || !loginGateWay())
				return;

			break;
		case C_STATE_PLAY:
			break;
		default:
			KBE_ASSERT(false);
			break;
	};
}
Ejemplo n.º 3
0
//-------------------------------------------------------------------------------------
void ClientObject::gameTick()
{
    if(pServerChannel()->pEndPoint())
    {
        pServerChannel()->processPackets(NULL);
    }
    else
    {
        if(connectedGateway_)
        {
            EventData_ServerCloased eventdata;
            eventHandler_.fire(&eventdata);
            connectedGateway_ = false;
            canReset_ = true;
            state_ = C_STATE_INIT;

            DEBUG_MSG(fmt::format("ClientObject({})::tickSend: serverCloased! name({})!\n",
                                  this->appID(), this->name()));
        }
    }

    if(locktime() > 0 && timestamp() < locktime())
    {
        return;
    }

    switch(state_)
    {
    case C_STATE_INIT:

        state_ = C_STATE_PLAY;

        if(!initCreate())
            return;

        break;
    case C_STATE_CREATE:

        state_ = C_STATE_PLAY;

        if(!createAccount())
            return;

        break;
    case C_STATE_LOGIN:

        state_ = C_STATE_PLAY;

        if(!login())
            return;

        break;
    case C_STATE_LOGIN_GATEWAY_CREATE:

        state_ = C_STATE_PLAY;

        if(!initLoginGateWay())
            return;

        break;
    case C_STATE_LOGIN_GATEWAY:

        state_ = C_STATE_PLAY;

        if(!loginGateWay())
            return;

        break;
    case C_STATE_PLAY:
        break;
    default:
        KBE_ASSERT(false);
        break;
    };

    tickSend();
}
Ejemplo n.º 4
0
//-------------------------------------------------------------------------------------
void ClientObject::gameTick()
{
	if(pServerChannel()->endpoint())
	{
		pServerChannel()->processPackets(NULL);
	}
	else
	{
		if(connectedGateway_)
		{
			EventData_ServerCloased eventdata;
			eventHandler_.fire(&eventdata);
			connectedGateway_ = false;
			canReset_ = true;
		}
	}

	switch(state_)
	{
		case C_STATE_INIT:

			state_ = C_STATE_PLAY;

			if(!initCreate())
				return;

			break;
		case C_STATE_CREATE:

			state_ = C_STATE_PLAY;

			if(!createAccount())
				return;

			break;
		case C_STATE_LOGIN:

			state_ = C_STATE_PLAY;

			if(!login())
				return;

			break;
		case C_STATE_LOGIN_GATEWAY_CREATE:

			state_ = C_STATE_PLAY;

			if(!initLoginGateWay())
				return;

			break;
		case C_STATE_LOGIN_GATEWAY:

			state_ = C_STATE_PLAY;

			if(!loginGateWay())
				return;

			break;
		case C_STATE_PLAY:
			break;
		default:
			KBE_ASSERT(false);
			break;
	};

	tickSend();
}