Aw universe ejection add

From ActiveWiki
Revision as of 11:49, 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.1
SDKbuild 13


int aw_universe_ejection_add (void)

Description

Blocks all access to the universe from a specific IP address or computer.

Callback

AW_CALLBACK_UNIVERSE_EJECTION_RESULT

Notes

For SDK build 14 and later, and universe server build 22 and later: The behaviour of this method has been changed from SDK build 13 and earlier. Previous versions had no callback and specified the address in host byte order. It now has a callback and takes the address to block in network byte order, in order to be consistent with other methods in the API that manipulate IP addresses.

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 (in network byte order) to be ejected. If the least significant byte of the address is zero then the entire class C IP address is blocked.
AW_EJECTION_EXPIRATION_TIME
Specifies when the ejection will expire. If it is set to zero then the ejection never expires.
AW_EJECTION_COMMENT (1)
(Optional) Comment to associate with the ejection record. This can be set to "serial=0x%x" to add an ejection by computer ID %x. For example, "serial=0x1A1B1C1D" would eject a computer with ID #1A1B1C1D (hexadecimal). It is checked separately from the address.

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

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)

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

(2) Returned by the universe server.

Returned attributes

None

Usage

Block a class C address from accessing the universe for one week.

aw_int_set (AW_EJECTION_ADDRESS, inet_addr ("241.197.54.0"));
aw_int_set (AW_EJECTION_EXPIRATION_TIME, time (NULL) + 7 * 24 * 60 * 60);
aw_string_set (AW_EJECTION_COMMENT, "Keep 'em out for a week");

if (aw_universe_ejection_add () != RC_SUCCESS)
  printf ("Unable to add ejection\n");

See also