Atrinik Server  4.0
Typedefs | Enumerations | Functions
ban.h File Reference

Go to the source code of this file.

Typedefs

typedef enum ban_error ban_error_t
 

Enumerations

enum  ban_error {
  BAN_OK, BAN_EXIST, BAN_NOTEXIST, BAN_REMOVED,
  BAN_BADID, BAN_BADIP, BAN_BADPLEN, BAN_BADSYNTAX,
  BAN_MAX
}
 

Functions

void toolkit_ban_init (void)
 
void toolkit_ban_deinit (void)
 
ban_error_t ban_add (const char *str)
 
ban_error_t ban_remove (const char *str)
 
bool ban_check (socket_struct *ns, const char *name)
 
void ban_list (object *op)
 
void ban_reset (void)
 
const char * ban_strerror (ban_error_t errnum)
 

Detailed Description

Ban API header file.

Author
Alex Tokar

Definition in file ban.h.

Typedef Documentation

typedef enum ban_error ban_error_t

Used as return codes for ban API functions.

Use ban_strerror() to get a string representation of returned error codes.

Enumeration Type Documentation

enum ban_error

Used as return codes for ban API functions.

Use ban_strerror() to get a string representation of returned error codes.

Enumerator
BAN_OK 

Success.

BAN_EXIST 

Ban entry exists.

BAN_NOTEXIST 

Ban entry doesn't exist.

BAN_REMOVED 

Ban was already removed.

BAN_BADID 

Bad ban ID.

BAN_BADIP 

Invalid IP address.

BAN_BADPLEN 

Invalid prefix length.

BAN_BADSYNTAX 

Invalid syntax.

BAN_MAX 

Number of ban error codes.

Definition at line 40 of file ban.h.

Function Documentation

ban_error_t ban_add ( const char *  str)

Adds a new ban.

Parameters
strBan command parameters.
Returns
BAN_OK on success, one of the errors defined in ban_error_t on failure.

Definition at line 363 of file ban.c.

bool ban_check ( socket_struct ns,
const char *  name 
)

Checks if the specified connection is banned from the game.

Parameters
nsThe connection.
namePlayer name to check. Can be NULL.
Returns
True if the connection is banned, false otherwise.

Definition at line 441 of file ban.c.

void ban_list ( object op)

List existing bans to the specified player.

Parameters
opPlayer.

Definition at line 479 of file ban.c.

ban_error_t ban_remove ( const char *  str)

Remove an existing ban.

Parameters
strBan command parameters.
Returns
BAN_OK on success, one of the errors defined in ban_error_t on failure.

Definition at line 393 of file ban.c.

void ban_reset ( void  )

Removes all existing bans.

Definition at line 502 of file ban.c.

const char* ban_strerror ( ban_error_t  errnum)

Create string representation of an error code.

Parameters
errnumError code. Cannot be BAN_OK.
Returns
String representation, never NULL.

Definition at line 515 of file ban.c.