This site uses cookies. In order to read how we handle cookies please click here. Click on this message to accept and hide.
Go to top
18.97.9.169.US.SSL

HeXHub HeXHub Plugins

* Lines marked with * are new to version 5.02b

3. Plugins

Plugins are Dynamic Link Libraries (DLL) that can be written in any programming language. If a plugin exports specific functions, they will be called by hub when a specific event occures. A plugin can call functions from hub when needed, it must first get their addresses using the GetFunction procedure (address of GetFunction is passed as the parameter of InitPlugin).

3.1. Functions exported by plugin


3.1.1. InitPlugin

LPCTSTR InitPlugin(LPFN _GetFunction);

This function MUST be exported by plugin, all other are optional. Plugins that don't export this function are not loaded.
Plugins are auto-detected by the presence of this function in export table. This function will be called on every plugin initialization, the parameter is a pointer to the GetFunction() procedure.
The function should return a pointer to a NULL-terminated string that specifies its description.
If the function returns NULL, there was an error, and plugin will no longer be used.

On initialization, the plugin can use the GetFunction() procedure to get addresses of procedures that can be called from hub. Its prototype is as follows:

LPFN GetFunction(LPCTSTR functionName);

functionName = pointer to a NULL terminated string specifying a procedure from hub

Function returns the pointer to specified function or NULL if function cannot be found.


3.1.2. UnloadPlugin

void UnloadPlugin(void);

This function is called (if exported by plugin) when plugin is unloaded from memory, or when hub quits. The plugin can unregister all commands / bots / help strings / etc.


3.1.3. SaveSettings

void SaveSettings(void);

If this function is exported by plugin, it will be called before UnloadPlugin() or when hub owner choses to save all hub's settings.


3.1.4. GetConfig

void GetConfig(HWND hParent);

This function is called when hub owner choses the "Configure" option from Plugins page. The plugin can show a custom configuration dialog with specific options related to its useage.
hParent = handle of configuration dialog's parent window.


3.1.5. GenerateLock

BOOL GenerateLock(LPVOID lpBuffer);

If this function is exported, it will be called before any user joins, and it can fill the buffer with a custom generated $Lock string. If the plugin changes the contents of this buffer, the hub will send the new Lock to the user who connects. Last plugin that changed this buffer wins. $Key will be calculated from this buffer. If no plugin changes the Lock string, the default one will be used.
lpBuffer = pointer to a buffer that will receive the new Lock string

Return False to prevent other plugins changing $Lock.


3.1.6. SetWelcomeText

LPCTSTR SetWelcomeText(void);

If this function is exported, it should return the pointer to a NULL terminated string that will be appended to hub's welcome message.


3.1.7. onDataFromUser

BOOL onDataFromUser(DWORD userId,LPVOID lpBuffer,int bufferSize);

This function is called every time a user sends data to hub.
userId = identifier of the connected user that sends data
lpBuffer = buffer with data
bufferSize = number of received bytes

The plugin should not change the contents of this buffer.
Return False to prevent further processing of received data (hub will discard this buffer).


3.1.8. onUnknownData

BOOL onUnknownData(DWORD userId,LPVOID lpBuffer,int bufferSize,LPFLOODINFO userFloodInfo,LPDEFINFO floodDefInfo);

This function will be called every time on a connection is sent unrecognized data (HTTP requests, hub registration attempts, etc).
userId = identifier of the connected user that sends data
lpBuffer = buffer with data
bufferSize = number of received bytes
userFloodInfo = pointer to a structure with flood detection parameters related to current user (see 3.3.1)
floodDefInfo = structure with parameters used to detect if user is flooding the hub (see 3.3.2.)

The plugin should not change the contents of this buffer.
Return False to prevent further processing of this data (hub will discard this buffer).


3.1.9. onCommand

BOOL onCommand(DWORD userId,LPVOID lpBuffer,int cmdSize,LPFLOODINFO userFloodInfo,LPDEFINFO floodDefInfo);

This function will be called every time a user sends a command to hub.
userId = identifier of the connected user that sends data
lpBuffer = buffer with data
cmdSize = size of received command including terminator
userFloodInfo = pointer to a structure with flood detection parameters related to current user (see 3.3.1)
floodDefInfo = structure with parameters used to detect if user is flooding the hub (see 3.3.2.)

The plugin should not change the contents of this buffer. Command detection procedure ignores the case of received commands.
Return False to prevent further processing of this command (hub will discard this buffer).


3.1.10. onUnknownCommand

BOOL onUnknownCommand(DWORD userId,LPVOID lpBuffer,int cmdSize,LPFLOODINFO userFloodInfo,LPDEFINFO floodDefInfo);

This function will be called every time a user sends an unrecognized command to hub.
userId = identifier of the connected user that sends data
lpBuffer = buffer with data
cmdSize = size of received command including terminator (this may be NULL or "|" terminator)
userFloodInfo = pointer to a structure with flood detection parameters related to current user (see 3.3.1)
floodDefInfo = structure with parameters used to detect if user is flooding the hub (see 3.3.2.)

The plugin should not change the contents of this buffer.
Return False to prevent further processing of this data (hub will discard this buffer).


3.1.11. onChatMessage

BOOL onChatMessage(DWORD userId,LPVOID lpBuffer,int bufferSize,LPFLOODINFO userFloodInfo,LPDEFINFO floodDefInfo);

This function will be called every time a user sends a private message or a message in mainchat.
userId = identifier of the connected user that sends data
lpBuffer = buffer with command
bufferSize = size of command including terminator
userFloodInfo = pointer to a structure with flood detection parameters related to current user (see 3.3.1)
floodDefInfo = structure with parameters used to detect if user is flooding the hub (see 3.3.2.)

The plugin should not change the contents of this buffer.
Mainchat messages will start with "<", private messages start with "$To:".
Return False to prevent further processing of this data (hub will discard this buffer).


3.1.12. onPublicMessage

BOOL onPublicMessage(DWORD userId,LPVOID lpBuffer,int bufferSize);

This function will be called every time the hub sends a message in mainchat.
userId = identifier of the connected user that caused the message to be sent
lpBuffer = buffer with data
bufferSize = number of received bytes

The plugin should not change the contents of this buffer.
Return False to prevent further processing of this data (hub will discard this buffer, message will not be sent).


3.1.13. onNickChange

void onNickChange(LPCTSTR lpszOldNick,LPCTSTR lpszNewNick);

This function will be called every time a user changes his nickname or an admin cause the nickname of a user to be changed.
lpszOldNick = pointer to a NULL terminated string with old nickname
lpszNewNick = pointer to a NULL terminated string with new nickname


3.1.14. onError

void onError(DWORD userId,DWORD dwFlags);

This function will be called if an error occures.
userId = identifier of the connected user that probably caused the error
dwFlags = flags that can be used to identify the error
bit 0 => validation timeout
bit 1 => send timeout
bit 2 => WSA error
bit 3 => maximum number of retries exceeded
bit 4 => unknown error
bit 5 => connection closed by client
bit 6 => send error
bit 7 => re-entrancy error
bit 8 => user disconnected
bit 9 => connection flood detected, user delayed

A value of 0 for dwFlags (ERROR_SUCCESS) indicates that a new connection was accepted. A connection is available from onError(userId,0) (new user connected) to onError(userId,0x100) (user disconnected).


3.1.15. onUserIdle

BOOL onUserIdle(DWORD userId);

This function will be called when the hub detects a user is idle.
userId = identifier of the connected user

Return False to prevent calling the other plugins on this event.


3.1.16. BannedUserJoins0

BOOL BannedUserJoins0(DWORD dwUserIp,DWORD dwFlags,BOOL permanent);

This function will be called when a banned user tryes to join the hub (_ban0_).
dwUserIp = IP of the banned user
dwFlags = ban type
bit 0 => hub is locked
bit 1 => DDoS filter
bit 2 => _ban0_
bit 3 => IP was detected as proxy
bit 4 => connection flood detected from user
bit 5 => connection flood detected from multiple IPs
bit 6 => socket error
permanent = true if the ban is permanent

Return False to allow the user to join the hub.


3.1.16. BannedUserJoins1

BOOL BannedUserJoins1(DWORD dwUserIp,DWORD dwFlags,BOOL permanent);

This function will be called when a banned user tryes to join the hub (_ban1_).
dwUserIp = IP of the banned user
dwFlags = ban type
bit 0 => IP / MAC is banned, _ban1_
bit 1 => reconnect flood detected
bit 2 => number of clones exceeded
bit 3 => incorrect ISP
bit 4 => incorrect country
bit 5 => too many concurrent logins
bit 6 => attempt to join a private hub with no account
bit 7 => user limit exceeded
bit 8 => user connected twice on different hub ports
bit 9 => user is trying to join with a reserved prefix
permanent = true if the ban is permanent

Return False to allow the user to join the hub.


3.1.17. BannedUserJoins2

BOOL BannedUserJoins2(DWORD userId,LPCTSTR userName,DWORD userIp,LPCTSTR op,LPCTSTR reason,BOOL permanent);

This function will be called when a banned user tryes to join the hub (_ban2_).
userId = identifier of the user who tryes to join the hub
userName = nickname of the banned user
dwUserIp = IP of the banned user
op = nickname of the operator who banned the user (hub-security nickname if this is an auto-ban)
reason = reason why the user is banned, this may me a NULL pointer
permanent = true if the ban is permanent

Return False to allow the user to join the hub.


3.1.18. onNicklistChange

void onNicklistChange(DWORD dwUserId,BOOL addedToList);

This function will be called every time the hub needs to update the nicklist.
dwUserId = identifier of the user
addedToList = True if the user joined the hub, False if the user disconnected.


3.1.19. GetAboutText

LPCTSTR GetAboutText(void);

If this function is exported, it should return the pointer to a NULL terminated string that contains the copyright information.


3.1.20. onBadSettings

void onBadSettings(DWORD userId,DWORD dwReasonId);

This function will be called if the hub will disconnect a user because of the restrictions (and in some cases a temp ban will be set).
userId = identifier of the connected user that will be disconnected
dwReasonId = error code
1 = key was missing
2 = bad key
3 = bad version
4 = password needed
5 = bad nick when nickchanges are disabled
6 = wrong password
7 = the hub requires some features that are not supported by client
8 = syntax error in $GetINFO
9 = syntax error in $To:
10 = tag states passive/proxy but using active commands
11 = tag states active but using passive commands
12 = incorrect IP in $ConnectToMe
13 = incorrect nick in $RevConnectToMe
14 = syntax error in $SR
15 = incorrect IP in $Search
16 = incorrect nick in passive search
17 = syntax error in $Search
18 = syntax error in mainchat message
19 = syntax error in $MyINFO
20 = forbid, mainchat
21 = forbid, commands
22 = forbid, private message
23 = forbid, search
24 = forbid, search results
25 = forbid, description
26 = forbidden fields found in tag
27 = forbidden client
28 = forbidden connection mode
29 = forbidden connection string
30 = validation timeout
31 = unknown client / client description missing in tag
32 = user has to open more hubs as normal user
33 = user has to open more hubs as registered
34 = user has to open more hubs as op
35 = user has to open more hubs
36 = user is in too many hubs as normal user
37 = user is in too many hubs as registered
38 = user is in too many hubs as op
39 = user is in too many hubs
40 = user has to open more slots
41 = user has too many slots open
42 = low slot ratio
43 = tag missing
44 = invalid e-mail address
45 = fake share detected (too many identical consecutive groups)
46 = invalid characters in share size
47 = low share
48 = too much shared
49 = forbidden files found in share, share size didn't change
50 = wrong prefix
51 = irrelevant prefix found
52 = ISP prefix required
53 = fake number of slots detected
54 = client is using pinger commands
55 = bad client emulation
56 = forbid, share size
57 = forbid, e-mail
58 = forbid, web comments or topics
59 = fake client version
60 = search without $GetNickList
61 = search requests are not yet enabled for this connection
62 = a wrong address was added to favorites as the address of this hub
63 = passive search result without file path

Return False to prevent the user being disconnected.


3.1.21. UserSearch

int UserSearch(DWORD dwUserId,lpstr lpSearchText,lpvoid lpBuffer);

This function will be called every time somebody uses the !seen command to allow a plugin to add extra results.
dwUserId = identifier of the user
lpSearchText = a pipe-terminated string with text to search
lpBuffer = the buffer where the plugin should write the results (buffer size = 10240 bytes)

This function should return the number of bytes written or 0 if the buffer remains unchanged.


3.1.22. GetConfigurationStringsTable

LPVOID GetConfigurationStringsTable(void);

If this function is exported, it should return the pointer to a table of pointers to configurable items, last item in this table must be -1 (0xFFFFFFFF).
This function is called every time a hub administrator writes !set ext %[dll] config.
A configurable item begins with a byte specifying its index (must be 1-based), followed by a NULL-terminated string with first word as configuration parameter accepted by !set followed by a description of that parameter. After the NULL terminator follows a list of structures as follows:
1) boolean:
typedef struct _bool_str{
BYTE struct_id; // for boolean this is 110
DWORD data_ptr; // pointer to data
BYTE bit_pos; // bit index of boolean value
} bool_str;

2) byte:
typedef struct _byte_str{
BYTE struct_id; // for byte this is 111
DWORD data_ptr; // pointer to data
} byte_str;

3) integer:
typedef struct _int_str{
BYTE struct_id; // for integer this is 112
DWORD data_ptr; // pointer to data
} int_str;

3) longint:
typedef struct _long_str{
BYTE struct_id; // for longint this is 113
DWORD data_ptr; // pointer to data
} long_str;

4) int64:
typedef struct _int64_str{
BYTE struct_id; // for 64-bit integer this is 114
DWORD data_ptr; // pointer to data
} int64_str;

5) string:
typedef struct _string_str{
BYTE struct_id; // for strings this is 115
DWORD data_ptr; // pointer to data
WORD string_size; // size of string
} string_str;

6) definition terminator:
typedef struct _term_str{
BYTE struct_id; // if this is last structure in chain, this is -1
} term_str;

Last structure in chain must be 6). The plugin must preserve the configuration information between 2 calls of GetConfigurationStringsTable.


3.1.23. onHTTPRequest

DWORD onHTTPRequest(DWORD userId,LPCTSTR lpHeaders,LPSTR lpszHost,LPSTR lpszReferer,LPSTR lpszUserAgent,LPSTR lpszCookies,DWORD dwFlags);

This function will be called every HTTP request sent.
userId = identifier of the connected user that sent the request
lpHeaders = pointer to the request sent (supported requests are GET, POST and HEAD)
lpszHost = pointer to a null terminated string containing the hostname or pointer to "*" if the user is trying to access a host that is not declared
lpszReferer = pointer to a null terminated string containing the referer address
lpszUserAgent = pointer to a null terminated string containing client type
lpszCookies = pointer to a null terminated string having user's cookies
dwFlags = status flags detected by hub
bit 0 => connection: close
bit 1 => proxy was detected
bit 2 => a proxy was detected and it sent user's real IP

If the plugin exports this function, it should return one of the following values:
1 = the hub should process this request
0 = the hub should ignore this request
-1 = the hub should ignore this request and should not change connection flood detection parameters.


3.1.24. onHTTPerror

DWORD onHTTPerror(DWORD userId,DWORD dwErrorCode,LPSTR lpszPath,LPSTR lpszHost,LPSTR lpszReferer,LPSTR lpszUserAgent,LPSTR lpszCookies);

This function will be called for all HTTP errors.
userId = identifier of the connected user that sent the request
dwErrorCode = HTTP status code, this version will call plugins only for error 404
lpszPath = requested file or directory
lpszHost = pointer to a null terminated string containing the hostname or pointer to "*" if the user is trying to access a host that is not declared
lpszReferer = pointer to a null terminated string containing the referer address
lpszUserAgent = pointer to a null terminated string containing client type
lpszCookies = pointer to a null terminated string having user's cookies

If the plugin exports this function, it should return one of the following values:
1 = the hub should send error response to client
0 = the hub should not reply to client


3.1.25. HTTPFormatPage

DWORD HTTPFormatPage(DWORD userId,LPSTR lpszPath,LPSTR lpszHost,LPSTR lpszReferer,LPSTR lpszUserAgent,LPSTR lpszCookies,LPSTR lpszVariables,LPVOID lpBuffer,DWORD bufferSize);

This function is called if the user enters an URL with root path as this plugin's DLL name.
userId = identifier of the connected user that sent the request
lpszPath = requested file or directory
lpszHost = pointer to a null terminated string containing the hostname or pointer to "*" if the user is trying to access a host that is not declared
lpszReferer = pointer to a null terminated string containing the referer address
lpszUserAgent = pointer to a null terminated string containing client type
lpszCookies = pointer to a null terminated string having user's cookies
lpszVariables = pointer to a null terminated string having variables sent by user
lpBuffer = a pointer to an allocated buffer where the plugin can store the new page as a NULL terminated string. The plugin can re-allocate this buffer. If the plugin reallocated the buffer, it also must free the memory allocated for the old buffer.
bufferSize = initial size of allocated memory

If the plugin exports this function, it should return one of the following:
0 = the hub should parse this request and send a default response
-1 = the hub should ignore this request and don't send anything
any other value = a pointer to the buffer containing the page that will be sent


3.1.26. HTTPEnumData

DWORD HTTPEnumData(DWORD userId,LPSTR lpszPath,LPSTR lpszHost,LPSTR lpszReferer,LPSTR lpszUserAgent,LPSTR lpszCookies,LPSTR lpszVariables,DWORD enumerationIndex,LPSTR lpParameters,LPVOID lpBuffer,DWORD dataOffset);

This function is called for %[plugin dllname] blocks to enumerate plugin's data in a loop.
userId = identifier of the connected user that sent the request
lpszPath = requested file or directory
lpszHost = pointer to a null terminated string containing the hostname or pointer to "*" if the user is trying to access a host that is not declared
lpszReferer = pointer to a null terminated string containing the referer address
lpszUserAgent = pointer to a null terminated string containing client type
lpszCookies = pointer to a null terminated string having user's cookies
lpszVariables = pointer to a null terminated string having variables sent by user
enumerationIndex = loop counter for this enumeration. If this is an enumeration, enumerationIndex will have consecutive values. The hub may call this function at a later time with a random index to request some parts of this data again.
lpParameters = a pointer to the parameters found in the index file after "%[plugin dllname". String terminator is "]" or null.
lpBuffer = a pointer to a buffer that will receive plugin's data related to current enumeration index. Default buffer size is 4096 bytes.
dataOffset = if last call to this function returned 4096 written bytes, the hub may or may not call it again with same enumerationIndex to request the rest of the data. This variable will be an index in plugin's data (number of bytes already received for this item).

If the plugin exports this function, it should return one of the following:
-1 = end of enumeration, index is too big
any other value = number of bytes written to buffer.


3.1.27. FirewallIOCTL

BOOL FirewallIOCTL(DWORD hDriver,DWORD dwIoControlCode,LPVOID lpInBuffer,DWORD nInBufferSize,LPVOID lpOutBuffer,DWORD nOutBufferSize,LPDWORD lpBytesReturned,LPOVERLAPPED lpOverlapped);

This function allows a plugin to provide, change or to intercept firewall functions as described in firewall.txt.
hDriver = a handle to loaded driver (by default DDoSflt) that can be used in a DeviceIoControl to call functions that are not supported by this plugin or 1 if no driver is loaded
dwIoControlCode = control code of operation
lpInBuffer = input buffer
nInBufferSize = size of input buffer
lpOutBuffer = output buffer
nOutBufferSize = size of output buffer
lpBytesReturned = pointer to variable to receive the number of bytes written
lpOverlapped = pointer to an overlapped structure as described in MSDN

If a plugin exports this function, it must update the buffer pointed by lpBytesReturned with the correct number of bytes written.



3.2. Hub's functions that can be called by plugin

3.2.1. GetFunction

LPFN GetFunction(LPCTSTR functionName);

functionName = pointer to a NULL terminated string specifying a procedure from hub

Function returns the pointer to specified function or NULL if function cannot be found. The address of GetFunction is sent as the parameter of InitPlugin.


3.2.2. GetVersion

DWORD GetVersion(void);

This function returns current hub's version (versionHigh<<16 + versionLow<<8 + betaRelease).


3.2.3. SendTo

BOOL SendTo(DWORD userId,LPVOID lpBuffer,int bufferSize);

Send data to a connected user.
userId = identifier of the user who tryes to join the hub
lpBuffer = buffer with data
bufferSize = size of data to send

On success, this function returns True.


3.2.4. SendToAll

void SendToAll(LPVOID lpBuffer,int bufferSize);

Send data to all users
lpBuffer = buffer with data
bufferSize = size of data to send

This function generates public messages and will call all plugins that export onPublicMessage.


3.2.5. SendNotificationMessage

void SendNotificationMessage(LPCTSTR lpszMessage);

Use this function to send a notification message in opchat to all operators who have info1 right.
lpszMessage = message to be sent as a private message from hub-security in opchat


3.2.6. NickFromId

BOOL NickFromId(DWORD userId,LPVOID lpBuffer);

This function returns the nickname of a connected user
userId = identifier of the user
lpBuffer = buffer that will receive nickname (MAX_NICK=40 bytes)

Reserved identifiers: 0 = hub-security bot, 1 = opchat
On success, this function returns True.


3.2.7. ClientnickFromId

BOOL ClientnickFromId(DWORD userId,LPVOID lpBuffer);

This function returns the nickname known by a connected user's client (usually nick before !nick or !rename) of a connected user
userId = identifier of the user
lpBuffer = buffer that will receive nickname (MAX_NICK=40 bytes)

Reserved identifiers: 0 = hub-security bot, 1 = opchat
On success, this function returns True.


3.2.8. IdFromNick

DWORD IdFromNick(LPCTSTR lpBuffer);

This function returns the identifier of a connected user
lpBuffer = buffer that contains nickname

If this function fails it will return -1.


3.2.9. GetInfo

DWORD GetInfo(DWORD userId,LPVOID lpBuffer);

This function returns the MyINFO string of a connected user, restrictions apply.
userId = identifier of the user
lpBuffer = buffer that will receive MyINFO (MAX_MYINFO=400 bytes)

This function returns number of bytes written.


3.2.10. GetFullInfo

DWORD GetFullInfo(DWORD userId,LPVOID lpBuffer);

This function returns the MyINFO string of a connected user with all information.
userId = identifier of the user
lpBuffer = buffer that will receive MyINFO (MAX_MYINFO=400 bytes)

This function returns number of bytes written.


3.2.11. SetInfo

BOOL SetInfo(DWORD userId,LPCTSTR lpBuffer);

This function sets tag, description, e-mail, share and connection using a MyINFO string but does not send $MyINFO to users.
userId = identifier of the user
lpBuffer = buffer with a MyINFO string, nickname is ignored

On success, this function returns True.


3.2.12. GetDescription

DWORD GetDescription(DWORD userId,LPVOID lpBuffer);

This function copies the description of a connected user.
userId = identifier of the user
lpBuffer = buffer that will receive description (MAX_DESCRIPTION=200 bytes)

This function returns number of bytes written.


3.2.13. SetDescription

BOOL SetDescription(DWORD userId,LPCTSTR lpszDescription);

This function changes the description of a connected user but does not send $MyINFO to users.
userId = identifier of the user
lpszDescription = a NULL terminated string with the new description

On success, this function returns True.


3.2.14. GetTag

DWORD GetTag(DWORD userId,LPVOID lpBuffer);

This function copies the tag of a connected user. This may not be the original tag sent by user.
userId = identifier of the user
lpBuffer = buffer that will receive tag (MAX_TAG=53 bytes)

This function returns number of bytes written.


3.2.15. SetTag

BOOL SetTag(DWORD userId,LPCTSTR lpszTag);

This function changes the tag of a connected user but does not send $MyINFO to users and does not check its parameters.
userId = identifier of the user
lpszTag = a NULL terminated string with the new tag

On success, this function returns True.


3.2.16. GetConnection

DWORD GetConnection(DWORD userId,LPVOID lpBuffer);

This function copies the connection identifier of a connected user.
userId = identifier of the user
lpBuffer = buffer that will receive connection string (MAX_DESCRIPTION=20 bytes)

This function returns number of bytes written.


3.2.17. SetConnection

BOOL SetConnection(DWORD userId,LPCTSTR lpszConnection);

This function changes the connection string of a connected user but does not send $MyINFO to users.
userId = identifier of the user
lpszConnection = a NULL terminated string with the new connection

On success, this function returns True.


3.2.18. GetMail

DWORD GetMail(DWORD userId,LPVOID lpBuffer);

This function copies the e-mail address of a connected user.
userId = identifier of the user
lpBuffer = buffer that will receive e-mail (MAX_MAIL=30 bytes)

This function returns number of bytes written.


3.2.19. SetMail

BOOL SetMail(DWORD userId,LPCTSTR lpszMail);

This function changes the e-mail address of a connected user but does not send $MyINFO to users.
userId = identifier of the user
lpszMail = a NULL terminated string with the new e-mail

On success, this function returns True.


3.2.20. GetShareString

DWORD GetShareString(DWORD userId,LPVOID lpBuffer);

This function copies the number of bytes shared by a connected user.
userId = identifier of the user
lpBuffer = buffer that will receive share (MAX_SHARE=40 bytes)

This function returns number of bytes written.


3.2.21. SetShareString

BOOL SetShareString(DWORD userId,LPCTSTR lpszShare);

This function changes the number of bytes shared by a user but does not send $MyINFO to users.
userId = identifier of the user
lpszShare = a NULL terminated string with the new share

On success, this function returns True.


3.2.22. GetIP

DWORD GetIP(DWORD userId);

This function returns the IP of a connected user or NULL if user is not found.
userId = identifier of the user


3.2.23. GetIPString

DWORD GetIPString(DWORD userId,LPVOID lpBuffer);

This function copies the IP of a connected user.
userId = identifier of the user
lpBuffer = buffer that will receive a NULL-terminated string with the IP address (MAX_IP=16 bytes)

This function returns number of bytes written.


3.2.24. GetISPName

DWORD GetISPName(DWORD userId,LPVOID lpBuffer);

This function copies the ISP of a connected user as defined in ISPs section.
userId = identifier of the user
lpBuffer = buffer that will receive a NULL-terminated string with the ISP name (MAX_ISP=256 bytes)

This function returns number of bytes written.


3.2.25. GetOpStatus

DWORD GetOpStatus(DWORD userId);

This function returns Op status as follows:
0 = normal user
1 = public op
2 = hidden op
-1= user not found

userId = identifier of the user


3.2.26. SetOpStatus

BOOL SetOpStatus(DWORD userId,DWORD isOp);

This function changes the op status of a connected user.
userId = identifier of the user
isOp can be one of the following:
0 = normal user
1 = public op
2 = hidden op

This function will change user's rights if necessarry.


3.2.27. GetLanguage

DWORD GetLanguage(DWORD userId,LPVOID lpBuffer);

This function copies the language identifier of a connected user
userId = identifier of the user
lpBuffer = buffer that will receive a NULL-terminated string with the language identifier (MAX_LANG=3 bytes)

This function returns number of bytes written.


3.2.28. SetLanguage

BOOL SetLanguage(DWORD userId,LPCTSTR lpszLanguage);

This function changes the language setting of a connected user.
userId = identifier of the user
lpszLanguage = a NULL terminated string with the new language identifier

On success, this function returns True.


3.2.29. GetMode

DWORD GetMode(DWORD userId,LPVOID lpBuffer);

This function copies the identifier of the chat filter used to process the messages written by a connected user.
userId = identifier of the user
lpBuffer = buffer that will receive a NULL-terminated string with the mode name (MAX_MODE=5 bytes)

This function returns number of bytes written.


3.2.30. SetMode

DWORD SetMode(DWORD userId,LPCTSTR lpszMode);

This function changes the chat filter used to process the messages written by a connected user.
userId = identifier of the user
lpszMode = the name of the chat filter

The function returns the filter identifier, or -1 if user was not found.


3.2.31. ModeTransform

DWORD ModeTransform(DWORD userId,LPCTSTR lpszModeName,LPCTSTR lpszSource,LPVOID destination);

This function uses a specified chat filter to convert a string
userId = identifier of the user
lpszModeName = name of the chat filter used
lpszSource = pointer to a NULL terminated string that will be converted
destination = pointer to a buffer that will receive the converted string

The function returns the number of bytes written.


3.2.32. GetUserCount

DWORD GetUserCount(void);

This function returns the number of connected users.


3.2.33. GetUserIds

DWORD GetUserIds(LPVOID lpBuffer,DWORD dwIds);

This function copies the specified number of IDs from userlist.
lpBuffer = buffer that will receive the ID list
dwIds = number of IDs to copy

This function returns number of IDs written.


3.2.34. GetMastersCount

DWORD GetMastersCount(void);

This function returns the number of users who can send commands to bots registered by this plugin.


3.2.35. GetMastersIds

DWORD GetMastersIds(LPVOID lpBuffer,DWORD dwIds);

This function copies the specified number of IDs of users who have rights and/or access to send commands to bots registered by this plugin.
lpBuffer = buffer that will receive the ID list
dwIds = number of IDs to copy

This function returns number of IDs written.


3.2.36. GetIpCacheInfo

BOOL GetIpCacheInfo(DWORD Ip,LPVOID lpBuffer);

This function copies the information related to specified IP from IP cache.
Ip = requested IP
lpBuffer = buffer that will receive the contents of the ipInfo structure (see 3.3.3.)

This function returns false if specified IP was not found in cache.


3.2.37. SetIpCacheInfo

void SetIpCacheInfo(LPIPINFO ipInfo);

This function updates the information related to an IP in IP cache. If the IP is not found, a new entry is created.

ipInfo = pointer to an ipInfo structure with data (see 3.3.3.)


3.2.38. GetAccessLevel

DWORD GetAccessLevel(DWORD userId);

This function returns the access level of a connected user or -1 if user is not found.
userId = identifier of the user


3.2.39. SetAccessLevel

BOOL SetAccessLevel(DWORD userId,DWORD dwNewAccess);

This function changes the access level of a connected user, registration information remains unchanged.
userId = identifier of the user
dwNewAccess = a value between 0 and 49999 specifying the new access level

On success, this function returns True.


3.2.40. GetRights

BOOL GetRights(DWORD userId,LPQWORD lpRights);

This function returns user's rights as a quad word.
userId = identifier of the user
lpRights = a buffer that receives user's rights (8 bytes)

On success, this function returns True.


3.2.41. SetRights

BOOL SetRights(DWORD userId,LPQWORD lpRights);

This function changes the rights of a connected user, registration information remains unchanged.
userId = identifier of the user
lpRights = a buffer with user's new rights (8 bytes)

On success, this function returns True.


3.2.42. GetProfileId

DWORD GetProfileId(DWORD userId);

This function returns the identifier of the profile used by a connected user or -1 if user is not found.
userId = identifier of the user


3.2.43. GetAccountId

DWORD GetAccountId(DWORD userId);

This function returns the identifier of the account of a registered user or -1 if user is not found.
For unregistered users, account identifier is 0.
userId = identifier of the user


3.2.44. CreateAccount

void CreateAccount(LPCTSTR lpszUserName,LPCTSTR lpszIp,LPCTSTR lpzsPassword,LPCTSTR lpszReason,DWORD dwProfileId);

This function creates a new account.
lpszUserName = nickname or NULL if not used
lpszIp = a string specifying an IP, IP range, ISP or MAC address, or NULL if account is not restricted
lpszPassword = a string specifying the password used to protect the account or NULL if not used
lpszReason = reason for banning the user, a comment or NULL if this is not used
dwProfileId = identifier of the profile where this account will be created


3.2.45. DeleteAccount

BOOL DeleteAccount(DWORD dwAccountId);

This function deletes an existing account. The account will be permanently deleted.
dwAccountId = identifier of the account that will be deleted

On success, this function returns True.


3.2.46. MoveAccount

BOOL MoveAccount(DWORD dwAccountId,DWORD dwProfileId,DWORD dwContextId);

This function moves an account to another profile.
dwAccountId = identifier of the account that will be moved
dwProfileId = identifier of the destination profile
dwContextId = identifier of a bot created by plugin

On success, this function returns True.


3.2.47. SetProfile

BOOL SetProfile(DWORD dwProfileId,LPCTSTR lpszProfileName,LPPROFILEINFO profileInfo,LPCTSTR lpszRaw1,LPCTSTR lpszRaw2);

This function changes the information related to an existing profile.
dwProfileId = identifier of the profile that will be changed
lpszProfileName = pointer to a NULL terminated string containing the new profile name or NULL if this parameter is not used
profileInfo = pointer to a structure with profile information (see 3.3.4.)
lpszRaw1 = raw sent to user or NULL if this parameter is not used
lpszRaw2 = raw sent to everyone else or NULL if this parameter is not used

On success, this function returns True.


3.2.48. GetProfile

BOOL GetProfile(DWORD dwProfileId,LPCTSTR lpszProfileName,LPPROFILEINFO profileInfo,LPCTSTR lpszRaw1,LPCTSTR lpszRaw2);

This function copies required information from a profile
dwProfileId = identifier of the profile
lpszProfileName = pointer to a buffer that will receive profile name or NULL if not used
profileInfo = pointer to a buffer that will receive profileInfo structure or NULL if not used (see 3.3.4.)
lpszRaw1 = pointer to a buffer that will receive raw sent to user or NULL if not used
lpszRaw2 = pointer to a buffer that will receive raw sent to everyone else or NULL if not used

On success, this function returns True.


3.2.49. GetNextProfile

DWORD GetNextProfile(DWORD dwProfileId);

This function returns the profile ID that follows dwProfileId in registration data. Use a value of -1 to retrieve the first profile's ID.
dwProfileId = identifier of the profile

If all profiles were enumerated, this function returns -1.


3.2.50. SetAccount

BOOL SetAccount(DWORD dwAccountId,LPACCOUNTINFO accountInfo);

This function changes the information related to an existing account.
dwAccountId = identifier of the account that will be changed
accountInfo = pointer to a structure with account information (see 3.3.5.)

On success, this function returns True.


3.2.51. GetAccount

BOOL GetAccount(DWORD dwAccountId,LPACCOUNTINFO accountInfo);

This function copies required information from an existing account
dwAccountId = identifier of the account
accountInfo = pointer to a buffer that will receive accountInfo structure (see 3.3.5.)

On success, this function returns True.


3.2.52. GetNextAccount

DWORD GetNextAccount(DWORD dwAccountId,DWORD dwProfileId);

This function returns the account ID that follows dwAccountId in registration data belonging to the profile specified by dwProfileId. Use a value of -1 to retrieve the first account's ID.
dwAccountId = identifier of the account
dwProfileId = identifier of the profile

If all accounts were enumerated, this function returns -1.


3.2.53. AllocUserData

DWORD AllocUserData(void);

This function reserves one byte in all buffers allocated for users. Total number of bytes that can be reserved by all plugins in a buffer is 40.

On success, this function returns an index in user buffer. Use this index in calls to GetUserData / SetUserData. If the function fails it returns -1.


3.2.54. FreeUserData

BOOL FreeUserData(DWORD dwIndex);

This function removes reservation of a specific index for user structures that was reserved by this plugin using AllocUserData.
dwIndex = the index that will be unallocated

On success, this function returns True.


3.2.55. GetUserData

DWORD GetUserData(DWORD userId,DWORD dwIndex);

This function returns one byte reserved in a buffer of a connected user located at specified index. You need to reserve an index before using this function.
userId = identifier of a connected user
dwIndex = index in user's buffer

On failure, this function returns -1.


3.2.56. SetUserData

BOOL SetUserData(DWORD userId,DWORD dwIndex,BYTE bData);

This function changes one byte reserved in a buffer of a connected user located at specified index. You need to reserve an index before using this function.
userId = identifier of a connected user
dwIndex = index in user's buffer
bData = data that will be written at specified index

On failure, this function returns -1.


3.2.57. RegisterCommand

DWORD RegisterCommand(LPCTSTR lpszCommandName,LPFN functionAddr);

This function registers a new command. When a user will write that command in mainchat or as a private message to hub-security, hub will call the specified function.
lpszCommandName = pointer to a NULL terminated string specifying the new command's name
functionAddr = pointer to a function that will be called

On success, this function returns a command identifier that can be used as a parameter to UnregisterCommand to unregister the command. If function fails it returns -1.
Rights needed for the registered command and minimum access level are checked by hub and can be changed by hub owner.
The function that will be called can be defined as follows:

void onRegisteredCommand(DWORD dwCommandId,DWORD userId,LPVOID rights,LPVOID commandParameters,BOOL isPM);

dwCommandId = registered command's identifier
userId = user who wrote the command
rights = user's rights (pointer to a 8-bytes buffer)
commandParameters = pointer to a buffer with command's parameters, terminator = '|'
isPM = 1 if the user wrote the command as a PM to hub-security, 0 for mainchat


3.2.58. UnregisterCommand

BOOL UnregisterCommand(DWORD dwCommandId);

This function unregisters a command that was previously registered by this plugin using RegisterCommand.
dwCommandId = registered command's identifier

If function succeeds, it returns True.


3.2.59. RegisterHelpString

DWORD RegisterHelpString(LPCTSTR lpszLanguage,LPCTSTR lpszString,DWORD dwSectionId);

This function adds a new string in hub's help. Rights needed for the registered string to be shown and minimum access level are checked by hub and can be changed by hub owner.
lpszLanguage = a NULL terminated string with the 2-letter language identifier
lpszString = a string that will be added in help
dwSectionId = identifier of the help section that will have this new string, can be one of the following:
0 = Hub information
1 = Commands for messages
2 = Operator commands
3 = reserved
4 = Profile management
5 = DC++ commands
6 = Extra
7 = User defined, lpszString will start with a new section name separated by the actual string with a new line

On success, this function returns a help identifier that can be used as a parameter to UnregisterHelpString to unregister the string. If function fails it returns -1.


3.2.60. UnregisterHelpString

BOOL UnregisterHelpString(DWORD dwHelpId);

This function unregisters a string that was previously registered by this plugin using RegisterHelpString.
dwHelpId = registered string's identifier

If function succeeds, it returns True.


3.2.61. RegisterUserCommand

DWORD RegisterUserCommand(LPCTSTR lpszUserCommand);

This function adds a new string in user menus. Rights needed for the registered string to be shown and minimum access level are checked by hub and can be changed by hub owner.
lpszUserCommand = raw command that will be added (should start with $UserCommand)

On success, this function returns a user command identifier that can be used as a parameter to UnregisterUserCommand to unregister the string. If function fails it returns -1.


3.2.62. UnregisterUserCommand

BOOL UnregisterUserCommand(DWORD dwUserCommandId);

This function unregisters a string that was previously registered by this plugin using RegisterUserCommand.
dwUserCommandId = registered string's identifier

If function succeeds, it returns True.


3.2.63. RegisterChatFilter

DWORD RegisterChatFilter(LPCTSTR lpszFilterName,LPFN filterProc,LPCTSTR filterDescription);

This function register a new chat filter. Rights needed for the registered string to be shown and minimum access level are checked by hub and can be changed by hub owner. Chat filters can be changed using the !mode command.
lpszFilterName = name of the new chat mode
filterProc = pointer to a function that will be called to make the translation or chat filtering
filterDescription = a NULL terminated string specifying filter's description (this string will also be added in help at section 1 (commands for messages)

On success, this function returns a user filter identifier that can be used as a parameter to UnregisterChatFilter to unregister the filter. If function fails it returns -1.


3.2.64. UnregisterChatFilter

BOOL UnregisterChatFilter(DWORD dwFilterId);

This function unregisters a chat filter that was previously registered by this plugin using RegisterChatFilter.
dwFilterId = registered filter's identifier

If function succeeds, it returns True.
The function that will be called can be defined as follows:

void FilterMessage(DWORD dwUserId,DWORD dwFilterId,LPCTSTR sourceString,LPVOID destinationString,DWORD filteredMessages);

dwUserId = identifier of the user who wrote the message that will be filtered
dwFilterId = identifier of the registered filter
sourceString = the string that will be filtered, string terminator = '|'
destinationString = a buffer that will return the result of filtering
filteredMessages = number of filtered messages for this user since his filter identifier was changed


3.2.65. RegisterBot

DWORD RegisterBot(LPCTSTR lpszBotName,LPFN onPM);

This function creates a new bot. Rights needed for accessing the registered bot and minimum access level are checked by hub and can be changed by hub owner.
lpszBotName = nickname of the bot that will be added in nicklist or a MyINFO string
onPM = pointer to a function that is called if a user who has access to bot sends a private message to it.

On success, this function returns a bot identifier that can be used as a parameter to UnregisterBot to unregister the bot. If function fails it returns -1.

void onPM(DWORD dwBotId,DWORD userId,LPVOID lpMessage,int bufferSize);

dwBotId = identifier of a bot registered by this plugin
userId = identifier of the user who sent the private message
lpMessage = a string containing the message, not including the "$To: %[bot] From %[nick] $", terminated by '|'
bufferSize = number of bytes



3.2.66. UnregisterBot

BOOL UnregisterBot(DWORD dwBotId);

This function unregisters and removes from nicklist a bot that was created by this plugin using RegisterBot.
dwBotId = registered string's identifier

If function succeeds, it returns True.


3.2.67. CallHubCommand

BOOL CallHubCommand(DWORD dwBotId,LPCTSTR lpszCommand);

This function calls a hub command in the context of a registered bot.
dwBotId = identifier of a bot registered using RegisterBot
lpszCommand = pointer to a string with the command and its parameters

If function succeeds, it returns True.


3.2.68. ProcessUserTraffic

BOOL ProcessUserTraffic(DWORD userId,LPFN _onData,DWORD dwReserved,DWORD dwFlags);

This function determines the hub to call the plugin for all incoming data from a user, and prevents further processing of that data.
userId = identifier of a connected user
_onData = pointer to the funtion that will be called on incoming data
dwReserved = reserved for next versions
dwFlags = flags
bit 0 = disconnect the user when plugin exits

If function succeeds, it returns True.
The function that will be called can be defined as follows:

void _onData(DWORD userId,LPVOID lpBuffer,int bufferSize);

userId = identifier of the connected user that sends data
lpBuffer = buffer with data
bufferSize = number of received bytes


3.2.69. DisableOutputToUser

BOOL DisableOutputToUser(DWORD userId,LPFN filterTraffic,BOOL disable);

This function enables/disables sending data to a connected user.
dwUserId = identifier of a connected user
filterTraffic = pointer to a function that will be called by hub when it needs to send data to user, this parameter is ignored if disable=true
disable = 1 if hub will no longer send data to this user, 0 to enable sending to that user

If function succeeds, it returns True.

BOOL filterTraffic(LPSTR lpBuffer,DWORD numBytes);

lpBuffer = address of buffer that should be sent
numBytes = number of bytes

If this function returns false, the data will not be sent.


3.2.70. AcceptUser

void AcceptUser(SOCKET s,DWORD userIp);

This function registers in hub a connection accepted by the plugin.
s = a socket with a connection accepted by the plugin
userIp = IP of the connected user

If function fails, the socket is closed.


3.2.71. DisconnectUser

BOOL DisconnectUser(DWORD dwUserId);

This function disconnects a user from the hub.
dwUserId = identifier of a connected user

If function succeeds, it returns True.


3.2.72. GetTopic

DWORD GetTopic(LPVOID topic,DWORD maxTopic);

This function returns current topic.
topic = a buffer that receives current topic
maxTopic = maximum characters to copy, including NULL terminator

The function returns the number of characters copied.


3.2.73. SetTopic

void SetTopic(LPCTSTR lpszNewTopic);

This function changes current topic.
lpszNewTopic = a NULL terminated string with the new topic


3.2.74. GetMOTD

DWORD GetMOTD(LPVOID motd,DWORD maxMotd);

This function returns current Message Of The Day.
motd = a buffer that receives current MOTD
maxMotd = maximum characters to copy, including NULL terminator

The function returns the number of characters copied.


3.2.75. SetMOTD

void SetMOTD(LPCTSTR lpszNewMotd);

This function changes current MOTD.
lpszNewMotd = a NULL terminated string with the new MOTD


3.2.76. GetHubUptime

DWORD GetHubUptime(void);

This function returns the number of seconds since hub was started or restarted.


3.2.77. GetHublistEntry

DWORD GetHublistEntry(DWORD iIndex,LPVOID buffer,DWORD bufferSize);

This function returns an entry in hub's hublist.
iIndex = index of the entry that will be copied
buffer = a buffer that receives the entry information
bufferSize = maximum number of bytes to copy

The function returns the number of characters copied.


3.2.78. RegisterBotEx

DWORD RegisterBot(LPCTSTR lpszBotName,LPFN onPM,DWORD rights1,DWORD rights2,DWORD access);

This function creates a new bot. Rights needed for accessing the registered bot and minimum access level are checked by hub and can be changed by hub owner.
lpszBotName = nickname of the bot that will be added in nicklist or a MyINFO string
onPM = pointer to a function that is called if a user who has access to bot sends a private message to it.
rights1 = first dword that contains rights
rights2 = second dword that contains rights
access = access level

On success, this function returns a bot identifier that can be used as a parameter to UnregisterBot to unregister the bot. If function fails it returns -1.

void onPM(DWORD dwBotId,DWORD userId,LPVOID lpMessage,int bufferSize)

dwBotId = identifier of a bot registered by this plugin
userId = identifier of the user who sent the private message
lpMessage = a string containing the message, not including the "$To: %[bot] From %[nick] $", terminated by '|'
bufferSize = number of bytes


3.2.79. SetBan

BOOL SetBan(DWORD banType,DWORD dwIP1,DWORD dwIP2,lpstr lpszNick,lpstr lpszReason,DWORD dwTime);

This function bans a user, account, IP, IP range, ISP, MAC address or a nick.
banType = level of the ban that will be set (0 = _ban0_, 1 = _ban1_, 2 = _ban2)
dwIP1 = IP address that will be banned, use NULL if it's not an IP ban
dwIP2 = second IP address from a range, use NULL if it's not a range ban
lpszNick = optional pointer to a NULL-terminated string specifying a nick or a string that contains an entity that will be banned (can be the nickname of a connected user, an account, IP, IP range, MAC or ISP)
lpszReason = optional pointer to a string specifying a reason that will be used
dwTime = time in seconds until ban expires, use 0 for permanent ban

If function succeeds, it returns True.


3.2.80. FirewallGetVersion

int FirewallGetVersion(void);

This function returns the version number of installed firewall driver. Low byte will be major version number.
If the firewall is not loaded this function returns -1.


3.2.81. FirewallGetAboutString

int FirewallGetAboutString(lpvoid lpBuffer,int bufferSize);

lpBuffer = the buffer that receives copyright information
bufferSize = size of buffer

The function returns the number of bytes written.
If the firewall is not loaded this function returns -1.


3.2.82. FirewallEnable

int FirewallEnable(void);

If the firewall is loaded but disabled, use this function to enable it. This function affects all started hubs that use the firewall.

If the function succeeds the return value is 1.
If the firewall is not loaded this function returns -1.


3.2.83. FirewallDisable

int FirewallDisable(void);

This function disables the firewall in all started hubs.

If the function succeeds the return value is 1.
If the firewall is not loaded this function returns -1.


3.2.84. FirewallBanRange

int FirewallBanRange(lpvoid lpRange);

This function will ban an IP range, all incoming traffic from that range will be filtered by firewall.

lpRange = pointer to a buffer that contains the IP range as 2 dwords (starting IP and ending IP)

If the function succeeds the return value is 1.
If the firewall is not loaded this function returns -1.


3.2.85. FirewallUnbanRange

int FirewallUnbanRange(lpvoid lpRange);

This function removes a range ban from firewall data. Range information must have the exact range that will be unbanned.

lpRange = pointer to a buffer that contains the IP range information (starting and ending IPs)

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.86. FirewallLookupRange

WORD FirewallLookupRange(lpvoid lpRange);

This function returns a WORD value containing the status of an IP range as following:
bit 0 = the exact range was found in banlist
bit 1 = the range is intersected with a banned range (only a part of the range is banned)
bit 2 = the range is included in a bigger range that is banned
bit 3 = the range includes a banned range in it

lpRange = pointer to a buffer that has IP range information

If no IP from that range is filtered by firewall, the return value is 0.
If the firewall is not loaded this function returns -1. Requires DDoSflt 1.03.


3.2.87. FirewallGetSettings

int FirewallGetSettings(lpvoid lpSettings);

This function returns current firewall's configuration used by all started hubs.

lpSettings = pointer to a firewallSettingsInfo structure that will receive firewall's settings

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1. Requires DDoSflt 1.03.


3.2.88. FirewallChangeSettings

int FirewallChangeSettings(lpvoid lpSettings);

This function changes firewall's configuration used by all started hubs.

lpSettings = pointer to a firewallSettingsInfo structure that has the new settings

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.89. FirewallRegisterHubPort

int FirewallRegisterHubPort(DWORD portInfo);

This function registers a port used by hub or changes flood check settings associated with a port.

portInfo = a DWORD value that contains port information - low word = port number, high word = maximum number of SYN packets allowed

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.90. FirewallUnregisterHubPort

int FirewallUnregisterHubPort(WORD portNumber);

This function unregisters a port used by hub.

portNumber = number of port that will be removed.

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.91. FirewallGetStats

int FirewallGetStats(lpvoid firewallStats);

This function returns firewall's statistics related to detected flood attempts.

firewallStats = pointer to a firewallStatisticsInfo structure that will receive firewall's statistics.

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.92. FirewallGetPortStats

int FirewallGetPortStats(int portNumber,lpvoid portStats);

This function returns statistics for a registered port.

portNumber = number of a registered port
portStats = pointer to a variable that will receive average TCP/SYN / second sent to specified port.

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.93. DDoSFilterIP

int DDoSFilterIP(DWORD dwIP);

This function adds an IP to DDoS filter, this will affect all started hubs.

dwIP = IP that will be added to filter.

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.94. DDoSDeleteFilter

int DDoSDeleteFilter(void);

This function deletes all IPs from DDoS filter, this will affect all started hubs.

If the firewall is loaded this function returns 1.
If the firewall is not loaded this function returns -1.


3.2.95. DDoSCountFilteredIPs

int DDoSCountFilteredIPs(void);

This function returns the number of IPs that are currently in DDoS filter.

If the firewall is not loaded this function returns -1. Requires DDoSflt 1.03.


3.2.96. DDoSGetFilter

int DDoSFilterIP(lpvoid lpFilter,int nIPs);

This function returns specified number of IPs from DDoS filter.

lpFilter = pointer to a buffer that will receive the IP list as dword values.
nIPs = number of IPs that will be copied

If this function succeeds the return value is number of IPs copied to buffer.
If the firewall is not loaded this function returns -1. Requires DDoSflt 1.03.


3.2.97. HTTPSendTo

BOOL HTTPSendTo(DWORD userId,lpvoid lpBuffer,int bufferSize,lpstr lpszCookies);

This function formats HTTP headers and sends data from buffer to a user through HTTP.

userId = identifier of the user
lpBuffer = buffer with data that needs to be sent
bufferSize = size of buffer
lpszCookies = optional pointer to the new cookies that will be set. If no cookies need to be changed this may be null. If more cookies are needed to be sent, separate them by a new line.

If this function succeeds the return value is 1.


3.2.98. HTTPSendHeaders

BOOL HTTPSendHeaders(DWORD userId,lpvoid lpBuffer,int bufferSize,lpstr lpszCookies);

This function formats HTTP headers and sends them to a user through HTTP.

userId = identifier of the user
lpBuffer = buffer with data
bufferSize = size of buffer
lpszCookies = optional pointer to the new cookies that will be set. If no cookies need to be changed this may be null. If more cookies are needed to be sent, separate them by a new line.

If this function succeeds the return value is 1.


3.2.99. HTTPRedirect

BOOL HTTPSendTo(DWORD userId,LPCTSTR lpszLocation);

This function will redirect a user to another location.

userId = identifier of the user
lpszLocation = the URL where the user will be redirected to

If this function succeeds the return value is 1.


3.2.100. GetHubWindow

HWND GetHubWindow(void);

This function returns hub's window handle. If the hub didn't create its window in the moment of this call, this function returns NULL.


3.2.101. RegisterPluginWindow

BOOL RegisterPluginWindow(HWND hWnd,LPCTSTR lpszName);

This function is a replacement for GetConfig for plugins that need to display statistics in real time. The window must be a child window and after being registered using this function it will have hub's window as parent. For this function to succeed, call GetHubWindow to make sure that the hub created its own window. A plugin can register a maximum of 4 child windows. A plugin can use a callback from HeXHub's main dialog procedure with SendMessage(GetHubWindow(),WM_USER+500,1,lpCallBackFn);.
hWnd = the handle of the child window that will be registered
lpszName = pointer to a NULL-terminated string specifying a name for this window that will be shown in hub's GUI.


3.2.102. UnregisterPluginWindow

BOOL UnregisterPluginWindow(HWND hWnd);

This function unregisters a window that was registered using RegisterPluginWindow. This function does not destroy plugin's window.
hWnd = the handle of the window that was previously registered using RegisterPluginWindow

*3.2.103. GetHubInfo

* int GetHubInfo(UINT infoIdx,LPVOID lpBuffer,int nBufferSize);

* This function returns a hub configuration setting.
* infoIdx = a parameter identifier, which can be one of the following:
* 1 = hub name, maximum possible length: 512 bytes (HeXHub 5.02b)
* 2 = hub description, maximum possible length: 1000 bytes (HeXHub 5.02b)
* 3 = hub address, maximum possible length: 255 bytes (HeXHub 5.02b)
* 4 = hub owner's e-mail address, maximum possible length: 255 bytes (HeXHub 5.02b)
* 5 = path to hub icon, maximum possible length: 255 bytes (HeXHub 5.02b)
* 6 = hub's topic, maximum possible length: 2000 bytes (HeXHub 5.02b)
* 100 = forbidden words searched in search requests, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 101 = forbidden words searched in search results, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 102 = forbidden words searched in descriptions, e-mails and share sizes, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 103 = forbidden words searched in mainchat messages, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 104 = forbidden words searched in !topic and !motd, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 105 = forbidden words searched in private messages, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 106 = automatic responses of Hub-Security, maximum possible length: 32768 bytes (HeXHub 5.02b)
* lpBuffer = a buffer that receives requested data
* nBufferSize = maximum number of bytes that can be written to buffer

* The function returns the number of bytes written to buffer if infoIdx has a supported value, else it returns -1.

*3.2.104. SetHubInfo

* int SetHubInfo(UINT infoIdx,LPVOID lpBuffer);

* This function changes a hub configuration setting.
* infoIdx = a parameter identifier, which can be one of the following:
* 1 = hub name, maximum possible length: 512 bytes (HeXHub 5.02b)
* 2 = hub description, maximum possible length: 1000 bytes (HeXHub 5.02b)
* 3 = hub address, maximum possible length: 255 bytes (HeXHub 5.02b)
* 4 = hub owner's e-mail address, maximum possible length: 255 bytes (HeXHub 5.02b)
* 5 = path to hub icon, maximum possible length: 255 bytes (HeXHub 5.02b)
* 6 = hub's topic, maximum possible length: 2000 bytes (HeXHub 5.02b)
* 100 = forbidden words searched in search requests, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 101 = forbidden words searched in search results, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 102 = forbidden words searched in descriptions, e-mails and share sizes, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 103 = forbidden words searched in mainchat messages, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 104 = forbidden words searched in !topic and !motd, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 105 = forbidden words searched in private messages, maximum possible length: 32768 bytes (HeXHub 5.02b)
* 106 = automatic responses of Hub-Security, maximum possible length: 32768 bytes (HeXHub 5.02b)
* lpBuffer = a buffer that contains hub configuration data

* The function returns the number of bytes written or -1 if infoIdx has a value that is not supported.



3.3. Structure definitions

3.3.1. userFloodInfo

typedef struct _userFloodInfo{
DWORD lasttick; //number of seconds since hub was started
WORD flcnt1; //command counter, current user
WORD flcnt2; //command counter, all users
BYTE flag1; //command flags
} userFloodInfo;

3.3.2. floodDefInfo

typedef struct _floodDefInfo{
LPSTR lpszCmdName; //command name
LPFN cmdproc; //address of procedure that is called when specified command is received
DWORD floodFlags; //flags used by flood check procedures
//bit 0
//bit 1
//bit 2 => bits 0,1,2 are used as follows:
// 210
// 000 = /session
// 001 = /second
// 010 = /minute
// 011 = /hour
// 100 = /day
//bit 3
//bit 4
//bit 5 => bits 3,4,5 are used as follows:
// 543
// 000 = /session
// 001 = /second
// 010 = /minute
// 011 = /hour
// 100 = /day
//bit 8 => keep only the last of a command chain
//bit 9 => restriction enabled: "allow only ... from one"
//bit 10 => restriction enabled: "allow only ... from all"
//bit 11 => reserved
//bit 12 => if flood is detected, user is delayed
//bit 13 => if flood is detected, command is ignored
//bit 14 => if flood is detected, a notification message will be sent
//bit 15 => if flood is detected, user will be disconnected
//bit 16 => do Not combine messages
WORD flcnt1; //maximum allowed from one user
WORD flcnt2; //maximum allowed from all users
DWORD counter; //total number of commands received from all users (for !stats command)
DWORD cmdFlags; //flags related to specified command
DWORD cmdParam1; //parameters specific to this command
DWORD cmdParam2; //parameters specific to this command
DWORD lastTick; //number of seconds since hub was started
WORD _flcnt1; //command counter, all users
WORD _flcnt2; //number of times when flood was detected from all users
} floodDefInfo;

3.3.3. ipInfo

typedef struct _ipInfo{
DWORD lastIp; //IP number
WORD timer1;
WORD timer2;
WORD timer3;
WORD timer4;
WORD timer5; //timers used to check for reconnect flood
BYTE fcount; //number of reconnects
BYTE flags1; //flags
//bit 0 => reserved
//bit 1 => reserved
//bit 2 => used by DDoS filter
//bit 3 => IP was checked for public proxy
//bit 4 => IP is a public proxy
//bit 5 => from this IP a user was disconnected because of incorrect settings for active mode
//bit 6 => this IP belongs to a faker and a notification message was sent
//bit 7 => reserved
DWORD lastconn; //last connection time in seconds relative to hub startup
DWORD tc_save; //reserved
BYTE langtmp; //language index in language table
BYTE invpasvd; //number of invalid passwords sent
BYTE timeskicked; //number of kicks
BYTE modetmp; //last chat filter's index (used by older versions)
BYTE country; //country name index
BYTE flagextra; //flags
//bit 0 => country ID was detected
//bit 1 => user was banned for forbidden files in share, share size must change
BYTE share_check; //checksum for share size
BYTE macaddr[6]; //MAC address
BYTE reserved[3]; //reserved
} ipInfo;

3.3.4. profileInfo

typedef struct _profileInfo{
BYTE rights[8]; //rights
DWORD minAccess; //minimum access
DWORD maxAccess; //maximum access
DWORD accessIncrease; //increment
DWORD availability; //availability in hours (0 = permanent)
} profileInfo;

3.3.5. accountInfo

typedef struct _accountInfo{
DWORD reserved1; //reserved
CHAR name[40]; //user name
WORD profileId; //profile identifier
WORD profileReset; //identifier of the profile it resets to
DWORD userId; //user identifier
BYTE rights[8]; //rights
DWORD access; //access level
DWORD maxAccess; //maximum access for current profile
DWORD accessTime; //timer increment
DWORD availability; //account availability
DWORD maxClones; //maximum clones allowed (if the account is for an IP)
CHAR language[2]; //language identifier
WORD mode; //last chat filter used
CHAR password[40]; //password
BYTE ipInformation; //1 = IP/IP range, 2 = ISP, 3 = MAC
DWORD IP1; //first IP in range
DWORD IP2; //last IP in range
CHAR ipstr[40]; //string containing IP, ISP or MAC (as ipInformation specifies)
DWORD reserved2; //reserved
CHAR creator[40]; //nickname of the admin who created this account
BYTE reserved[8]; //reserved, date+time
CHAR modifier[40]; //nickname of the last admin who modified this account
BYTE reserved[8]; //reserved, date+time
BYTE reserved[50]; //reserved
CHAR reason[220]; //reason or comment
BYTE reserved[62]; //reserved
} accountInfo;

3.3.6. firewallSettingsInfo

typedef struct _firewallSettingsInfo{
WORD pcapFlags; //flags used by WinPCap procedures, bit 0 = WinPCap enabled, bit 1 = adapters were detected
WORD pcapAdapters; //flags used by WinPCap procedures to enable / disable adapters (bit 0 = first adapter, bit 1 = second adapter, etc)
DWORD pcapTimeout; //timeout used by WinPCap procedures for capturing packets
BYTE maxSyn; //maximum number of TCP/SYN packets / second allowed from same IP
BYTE maxUdp; //maximum number of UDP packets / second allowed from same IP
BYTE maxIcmp; //maximum number of ICMP packets / second allowed from same IP
BYTE firewallFlags; //flags used by firewall
// bit 0 => firewall is registered
// bit 1 => firewall is loaded
// bit 2 => SYN flood check on hub's ports is enabled
// bit 3 => SYN flood check on ports not used by hub is enabled
// bit 4 => incoming ICMP traffic is blocked
// bit 5 => TCP/RST packets are not sent on connection resets
// bit 6 => if flood is detected, a _ban0_ is added for source IP
// bit 7 => if flood is detected, a notification message is sent in opchat
int hubPortSyn; //maximum number of SYN packets allowed to be sent to a port opened by hub
int otherPortsSyn; //maximum number of SYN packets allowed to be sent to all other ports that are not used by hub
} firewallSettingsInfo;

3.3.7. firewallStatisticsInfo

typedef struct _firewallStatisticsInfo{
syn_str synFlood; //statistics for SYN packets
syn_str udpFlood; //statistics for UDP packets
syn_str icmpFlood; //statistics for ICMP packets
long ddosSyn; //filtered SYN packets sent from IPs found in DDoS filter
long banSyn; //filtered SYN packets sent from banned IPs
long fltPort; //filtered SYN packets sent to all registered ports if flood was detected
DWORD reserved; //pointer to last syn_str structure that was written
} firewallStatisticsInfo;

3.3.8. syn_str

typedef struct _syn_str{
BYTE syn_idx; //index of next syn_info structure that will be used
BYTE isFlood; //detected flood type, 2 = portscan, 3 = SYN flood, 4 = UDP flood, 5 = ICMP flood
DWORD lastIP; //last IP that was detected as flooding
sin_info sInfo[20]; //information about last sent packets
} syn_str;

3.3.8. syn_info

typedef struct _syn_info{
long lastCount; //number of seconds since firewall was started when packet was sent
DWORD sourceIP; //source IP
DWORD destinationIP; //destination IP
DWORD lastPort; //destination port
WORD isflood; //flood indicator, 1 = flood is detected
WORD reserved; //reserved
} syn_info;

Comments

There are no comments for this page, you can leave one here.