User's Guide

LibW3 - User's Guide

This part of the documentation talk about the public functions of LibW3 and how to use them.
Headers:

W3Core.h

W3Core.h has the following public functions:

W3_Library_Init

Definition: int W3_Library_Init(void)
Initialises the LibW3.
Returns 0 on success, 1 on fail.

W3_Create

Definition: struct W3* W3_Create(const char* protocol, const char* hostname, int port)
Creates the W3 struct and try to connect.
Returns the non-NULL on the success, NULL on fail.

W3_Set_Method

Definition: void W3_Set_Method(struct W3* w3, const char* method)
Sets the method.

W3_Set_Path

Definition: void W3_Set_Path(struct W3* w3, const char* path)
Sets the path.

W3_Set_Header

Definition: void W3_Set_Header(struct W3* w3, const char* key, const char* value)
Sets the header.

W3_Set_Data

Definition: void W3_Set_Data(struct W3* w3, char* data, size_t size)
Sets the data to send.

W3_Set_Read_Size

Definition: void W3_Set_Read_Size(struct W3* w3, size_t size)
Sets the read buffer size.

W3_On

Definition: void W3_On(struct W3* w3, const char* eventname, void* func)
Set the event handler.
Handlers should be like them:

W3_Disconnect

Definition: void W3_Disconnect(struct W3* w3)
Force-disconnects the client.

W3_Send_Request

Definition: void W3_Send_Request(struct W3* w3)
Sends the request.

W3_Free

Definition: void W3_Free(struct W3* w3)
Frees the struct.

W3HTTP.h

W3HTTP.h has the following public functions:

W3_HTTP_Enable_Redirect

Definition: void W3_HTTP_Enable_Redirect(struct W3* w3)
Enables the redirect.

W3POP3.h

W3POP3.h has the following public functions:

W3_POP3_Set_Username

Definition: void W3_POP3_Set_Username(struct W3* w3, const char* username)
Sets the username for the login.

W3_POP3_Set_Password

Definition: void W3_POP3_Set_Password(struct W3* w3, const char* password)
Sets the password for the login.

W3_POP3_Send_Request

Definition: void W3_POP3_Send_Request(struct W3* w3)
NOTE Not to be confused with W3_Send_Request. This function sends the POP3 command when W3_Send_Request does the login and the stuff.
Sends the POP3 request.

W3_POP3_Disconnect

Definition: void W3_POP3_Disconnect(struct W3* w3)
Disconnects from the server using the QUIT command.

W3FTP.h

W3FTP.h has the following public functions:

W3_FTP_Set_Username

Definition: void W3_FTP_Set_Username(struct W3* w3, const char* username)
Sets the username for the login.

W3_FTP_Set_Password

Definition: void W3_FTP_Set_Password(struct W3* w3, const char* password)
Sets the password for the login.

W3_FTP_Send_Request

Definition: void W3_FTP_Send_Request(struct W3* w3)
NOTE Not to be confused with W3_Send_Request. This function sends the FTP command when W3_Send_Request does the login and the stuff.
Sends the FTP request.

W3_FTP_Disconnect

Definition: void W3_FTP_Disconnect(struct W3* w3)
Disconnects from the server using the QUIT command.

W3NNTP.h

W3NNTP.h has the following public functions:

W3_NNTP_Set_Username

Definition: void W3_NNTP_Set_Username(struct W3* w3, const char* username)
Sets the username for the login.

W3_NNTP_Set_Password

Definition: void W3_NNTP_Set_Password(struct W3* w3, const char* password)
Sets the password for the login.

W3_NNTP_Send_Request

Definition: void W3_NNTP_Send_Request(struct W3* w3)
NOTE Not to be confused with W3_Send_Request. This function sends the NNTP command when W3_Send_Request does the login and the stuff.
Sends the NNTP request.

W3_NNTP_Disconnect

Definition: void W3_NNTP_Disconnect(struct W3* w3)
Disconnects from the server using the QUIT command.

W3IRC.h

W3IRC.h has the following public functions:

W3_IRC_Set_Username

Definition: void W3_IRC_Set_Username(struct W3* w3, const char* username)
Sets the username for the login.

W3_IRC_Set_Realname

Definition: void W3_IRC_Set_Realname(struct W3* w3, const char* realname)
Sets the realname for the login.

W3_IRC_Set_Servername

Definition: void W3_IRC_Set_Servername(struct W3* w3, const char* servername)
Sets the servername for the login.

W3_IRC_Set_Hostname

Definition: void W3_IRC_Set_Hostname(struct W3* w3, const char* hostname)
Sets the hostname for the login.

W3_IRC_Set_Nickname

Definition: void W3_IRC_Set_Nickname(struct W3* w3, const char* nickname)
Sets the nickname for the login.

W3_IRC_Set_Password

Definition: void W3_IRC_Set_Password(struct W3* w3, const char* password)
Sets the password for the login.

W3_IRC_Send_Request

Definition: void W3_IRC_Send_Request(struct W3* w3)
NOTE Not to be confused with W3_Send_Request. This function sends the IRC command when W3_Send_Request does the login and the stuff.
Sends the IRC request.

W3Tag.h

W3Tag.h has the following public functions:

W3_Tag_Parse

Definition: void W3_Tag_Parse(char* data, size_t size, void (*tagfunc)(char* tagname, char* attr), void (*textfunc)(char* data))
Parses the HTML/XML-like things.
tagfunc gets called when a tag gets parsed, and textfunc gets called when a text gets parsed.

W3_Tag_Attr

Definition: char* W3_Tag_Attr(char* data, const char* name)
Returns the value of the specified attribute.
Returns NULL on the fail.

W3URL.h

W3URL.h has the following public functions:

W3_Parse_URL

Definition: struct W3URL* W3_Parse_URL(const char* url)
Parses the URL.
Returns the non-NULL on success, NULL on fail.
Check how struct looks like in Library/W3URL.h.

W3_Free_URL

Definition: void W3_Free_URL(struct W3URL* url)
Frees the URL struct.

W3Util.h

W3Util.h has the following public functions:

W3_Do_Debug

Definition: void W3_Do_Debug(bool debug)
Enables/Disables the debug.


Nishi <nishi@nishi.boats>
$Id: index.html,v 1.17 2024/02/24 00:32:06 nishi Exp $