Aw universe ejection lookup

From ActiveWiki
Revision as of 12:05, 26 October 2008 by Macavity (talk | contribs) (Added in, cleanup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Minimum requirements
Added in version 2.2
SDKbuild 14
Universebuild 22


int aw_universe_ejection_lookup (void)

Description

Looks up a blocked universe IP address.

Callback

AW_CALLBACK_UNIVERSE_EJECTION

Notes

Only instances owned by the root account (citizen #1 - universe administrators) may use this method.

Arguments

None

Argument attributes

AW_EJECTION_ADDRESS
Specifies the IP address to be queried (in network order).

Return values

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

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

(2) Returned by the universe server.

Returned attributes

AW_EJECTION_ADDRESS
AW_EJECTION_CREATION_TIME (1)
AW_EJECTION_EXPIRATION_TIME
AW_EJECTION_COMMENT (1)
(Optional)

(1) Added in version 3.0, SDK build 16 and universe server build 23.

Usage

void lookup_ejection (char *address)
{
  aw_int_set (AW_EJECTION_ADDRESS, inet_addr (address));
  
  if (aw_universe_ejection_lookup ())
    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