Aw world ejection add
Jump to navigation
Jump to search
Minimum requirements | ||
---|---|---|
Added in version 3.0 | ||
SDK | build 16 |
int aw_world_ejection_add (void)
Description
Blocks all access to the world from a specific IP address, computer ID, or citizen number.
Callback
AW_CALLBACK_WORLD_EJECTION_RESULT
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.
For SDK build 24 or later, and world server version 3.3 and later: The world ejection mechanism has been extended to support ejections by computer ID or by citizen number, as well as by IP address.
Arguments
None
Argument attributes
- AW_EJECTION_TYPE
- This attribute specifies the type of the ejection and the format of AW_EJECTION_ADDRESS:
- AW_EJECT_BY_ADDRESS
- AW_EJECTION_ADDRESS is the IP address to be blocked (in network byte order.) If the least significant byte of the address is zero then the entire class C IP address is blocked.
- AW_EJECT_BY_COMPUTER
- AW_EJECTION_ADDRESS is the 32-bit ID of the computer to be blocked. However, there is currently no mechanism for directly querying the ID of a user's computer from the SDK. Ejections by computer ID are added automatically by the world server whenever a user is ejected via aw_world_eject and their computer has an ID available. Once the ejection is in place, the computer ID can be determined by scanning the ejection database using either aw_world_ejection_next or aw_world_ejection_previous.
- AW_EJECT_BY_CITIZEN
- AW_EJECTION_ADDRESS is the citizen number of the user to block. Ejections of this type will only block the user as long as they continue to use the account that has been blocked. Ejections by citizen number are added automatically by the world server whenever a citizen is ejected via aw_world_eject.
- AW_EJECTION_ADDRESS
- AW_EJECTION_EXPIRATION_TIME
- Expiration time of the ejection. If set to zero then the ejection never expires.
- AW_EJECTION_COMMENT
- Optional text comment to associate with the ejection record.
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)
(1) Possible return values when a callback is installed.
(2) Returned by the world server.
Returned attributes
None
Usage
int block_address_for_days (int address, int days) { aw_int_set (AW_EJECTION_TYPE, AW_EJECT_BY_ADDRESS); aw_int_set (AW_EJECTION_ADDRESS, address); aw_int_set (AW_EJECTION_EXPIRATION_TIME, time (NULL) + days * 24 * 60 * 60); aw_string_set (AW_EJECTION_COMMENT, "This person was very naughty!"); return aw_world_ejection_add (); } /* block a class C address from accessing the world for one week */ rc = block_address_for_days (inet_addr ("241.197.54.0"), 7); if (rc != RC_SUCCESS) printf ("Unable to add ejection (reason %d)\n", rc); else puts ("Added ejection");