Aw world ejection lookup

From ActiveWiki
Jump to: navigation, search


Minimum requirements
Added in version 3.0
SDKbuild 16


int aw_world_ejection_lookup (void)

Description

Queries information about an ejection in the world ejection database.

Callback

AW_CALLBACK_WORLD_EJECTION

Notes

Only world server administration instances or those owned by a caretaker (i.e. aw_bool (AW_WORLD_CARETAKER_CAPABILITY) returns 1) may use this method.

Arguments

None

Argument attributes

AW_EJECTION_TYPE (1)
AW_EJECTION_ADDRESS (1)

(1) Specifies the ejection to be queried. See aw_world_ejection_add for more information.

Return values

RC_SUCCESS (1) (2)
RC_NOT_INITIALIZED (1)
RC_NO_INSTANCE (1)
RC_NO_CONNECTION (1)
The connection to the world is down.
RC_DATABASE_ERROR (2)
RC_NO_SUCH_EJECTION (2)

(1) Possible return values when a callback is installed.

(2) Returned by the world server.

Returned attributes

AW_EJECTION_TYPE
AW_EJECTION_ADDRESS
AW_EJECTION_CREATION_TIME
AW_EJECTION_EXPIRATION_TIME
AW_EJECTION_COMMENT

Usage

void lookup_ejection (char *address)
{
  aw_int_set (AW_EJECTION_TYPE, AW_EJECT_BY_ADDRESS);
  aw_int_set (AW_EJECTION_ADDRESS, inet_addr (address));
  
  if (aw_world_ejection_lookup () != RC_SUCCESS)
    printf ("IP address %s is not blocked.\n", address);
  else
  {
    if (!aw_int (AW_EJECTION_EXPIRATION_TIME))
      printf ("%s is blocked indefinitely.\n", address);
    else
      printf ("%s will remain blocked for %d more seconds.\n",
              address,
              aw_int (AW_EJECTION_EXPIRATION_TIME) - time (NULL));
  } 
}

See also