-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
467e807
commit 2960de7
Showing
39 changed files
with
210 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# CategorySDLNet | ||
|
||
Header file for SDL_net library | ||
|
||
A simple library to help with networking. | ||
|
||
<!-- END CATEGORY DOCUMENTATION --> | ||
|
||
## Functions | ||
|
||
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. --> | ||
<!-- BEGIN CATEGORY LIST: CategorySDLNet, CategoryAPIFunction --> | ||
<!-- END CATEGORY LIST --> | ||
|
||
## Datatypes | ||
|
||
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. --> | ||
<!-- BEGIN CATEGORY LIST: CategorySDLNet, CategoryAPIDatatype --> | ||
<!-- END CATEGORY LIST --> | ||
|
||
## Structs | ||
|
||
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. --> | ||
<!-- BEGIN CATEGORY LIST: CategorySDLNet, CategoryAPIStruct --> | ||
<!-- END CATEGORY LIST --> | ||
|
||
## Enums | ||
|
||
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. --> | ||
<!-- BEGIN CATEGORY LIST: CategorySDLNet, CategoryAPIEnum --> | ||
<!-- END CATEGORY LIST --> | ||
|
||
## Macros | ||
|
||
<!-- DO NOT HAND-EDIT CATEGORY LISTS, THEY ARE AUTOGENERATED AND WILL BE OVERWRITTEN, BASED ON TAGS IN INDIVIDUAL PAGE FOOTERS. EDIT THOSE INSTEAD. --> | ||
<!-- BEGIN CATEGORY LIST: CategorySDLNet, CategoryAPIMacro --> | ||
<!-- END CATEGORY LIST --> | ||
|
||
---- | ||
[CategoryAPICategory](CategoryAPICategory) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!-- DO NOT EDIT THIS PAGE ON THE WIKI. IT WILL BE OVERWRITTEN BY WIKIHEADERS AND CHANGES WILL BE LOST! --> | ||
|
||
If you want to paste this into a text editor that can't handle | ||
the fancy Unicode section headers, try using | ||
[QuickReferenceNoUnicode](QuickReferenceNoUnicode) instead. | ||
|
||
```c | ||
// SDL3_net API Quick Reference | ||
// | ||
// https://libsdl.org/ | ||
// | ||
// The latest version of this document can be found at https://wiki.libsdl.org/SDL3_net/QuickReference | ||
// Based on SDL_net version 3.0.0 | ||
// | ||
// This can be useful in an IDE with search and syntax highlighting. | ||
// | ||
// Original idea for this document came from Dan Bechard (thanks!) | ||
// ASCII art generated by: https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow (with modified 'S' for readability) | ||
|
||
|
||
// ██████╗ ██████╗ ██╗ ███╗ ██╗ ███████╗ ████████╗ | ||
// ██╔════╝ ██╔══██╗ ██║ ████╗ ██║ ██╔════╝ ╚══██╔══╝ | ||
// ███████╗ ██║ ██║ ██║ ██╔██╗ ██║ █████╗ ██║ | ||
// ╚════██║ ██║ ██║ ██║ ██║╚██╗██║ ██╔══╝ ██║ | ||
// ██████╔╝ ██████╔╝ ███████╗ ██║ ╚████║ ███████╗ ██║ | ||
// ╚═════╝ ╚═════╝ ╚══════╝ ╚═╝ ╚═══╝ ╚══════╝ ╚═╝ | ||
|
||
#define SDL_NET_MAJOR_VERSION // Printable format: "%d.%d.%d", MAJOR, MINOR, MICRO | ||
#define SDL_NET_VERSION // This is the version number macro for the current SDL_net version. | ||
#define SDL_NET_VERSION_ATLEAST(X, Y, Z) // This macro will evaluate to true if compiled with SDL_net at least X.Y.Z. | ||
int SDLNet_Version(void); // This function gets the version of the dynamically linked SDL_net library. | ||
bool SDLNet_Init(void); // Initialize the SDL_net library. | ||
void SDLNet_Quit(void); // Deinitialize the SDL_net library. | ||
SDLNet_Address * SDLNet_ResolveHostname(const char *host); // Resolve a human-readable hostname. | ||
int SDLNet_WaitUntilResolved(SDLNet_Address *address, Sint32 timeout); // Block until an address is resolved. | ||
int SDLNet_GetAddressStatus(SDLNet_Address *address); // Check if an address is resolved, without blocking. | ||
const char * SDLNet_GetAddressString(SDLNet_Address *address); // Get a human-readable string from a resolved address. | ||
SDLNet_Address * SDLNet_RefAddress(SDLNet_Address *address); // Add a reference to an SDLNet_Address. | ||
void SDLNet_UnrefAddress(SDLNet_Address *address); // Drop a reference to an SDLNet_Address. | ||
void SDLNet_SimulateAddressResolutionLoss(int percent_loss); // Enable simulated address resolution failures. | ||
int SDLNet_CompareAddresses(const SDLNet_Address *a, const SDLNet_Address *b); // Compare two SDLNet_Address objects. | ||
SDLNet_Address ** SDLNet_GetLocalAddresses(int *num_addresses); // Obtain a list of local addresses on the system. | ||
void SDLNet_FreeLocalAddresses(SDLNet_Address **addresses); // Free the results from SDLNet_GetLocalAddresses. | ||
SDLNet_StreamSocket * SDLNet_CreateClient(SDLNet_Address *address, Uint16 port); // Begin connecting a socket as a client to a remote server. | ||
int SDLNet_WaitUntilConnected(SDLNet_StreamSocket *sock, Sint32 timeout); // Block until a stream socket has connected to a server. | ||
SDLNet_Server * SDLNet_CreateServer(SDLNet_Address *addr, Uint16 port); // Create a server, which listens for connections to accept. | ||
bool SDLNet_AcceptClient(SDLNet_Server *server, SDLNet_StreamSocket **client_stream); // Create a stream socket for the next pending client connection. | ||
void SDLNet_DestroyServer(SDLNet_Server *server); // Dispose of a previously-created server. | ||
SDLNet_Address * SDLNet_GetStreamSocketAddress(SDLNet_StreamSocket *sock); // Get the remote address of a stream socket. | ||
int SDLNet_GetConnectionStatus(SDLNet_StreamSocket *sock); // Check if a stream socket is connected, without blocking. | ||
bool SDLNet_WriteToStreamSocket(SDLNet_StreamSocket *sock, const void *buf, int buflen); // Send bytes over a stream socket to a remote system. | ||
int SDLNet_GetStreamSocketPendingWrites(SDLNet_StreamSocket *sock); // Query bytes still pending transmission on a stream socket. | ||
int SDLNet_WaitUntilStreamSocketDrained(SDLNet_StreamSocket *sock, Sint32 timeout); // Block until all of a stream socket's pending data is sent. | ||
int SDLNet_ReadFromStreamSocket(SDLNet_StreamSocket *sock, void *buf, int buflen); // Receive bytes that a remote system sent to a stream socket. | ||
void SDLNet_SimulateStreamPacketLoss(SDLNet_StreamSocket *sock, int percent_loss); // Enable simulated stream socket failures. | ||
void SDLNet_DestroyStreamSocket(SDLNet_StreamSocket *sock); // Dispose of a previously-created stream socket. | ||
SDLNet_DatagramSocket * SDLNet_CreateDatagramSocket(SDLNet_Address *addr, Uint16 port); // Create and bind a new datagram socket. | ||
bool SDLNet_SendDatagram(SDLNet_DatagramSocket *sock, SDLNet_Address *address, Uint16 port, const void *buf, int buflen); // Send a new packet over a datagram socket to a remote system. | ||
bool SDLNet_ReceiveDatagram(SDLNet_DatagramSocket *sock, SDLNet_Datagram **dgram); // Receive a new packet that a remote system sent to a datagram socket. | ||
void SDLNet_DestroyDatagram(SDLNet_Datagram *dgram); // Dispose of a datagram packet previously received. | ||
void SDLNet_SimulateDatagramPacketLoss(SDLNet_DatagramSocket *sock, int percent_loss); // Enable simulated datagram socket failures. | ||
void SDLNet_DestroyDatagramSocket(SDLNet_DatagramSocket *sock); // Dispose of a previously-created datagram socket. | ||
int SDLNet_WaitUntilInputAvailable(void **vsockets, int numsockets, Sint32 timeout); // Block on multiple sockets until at least one has data available. | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<!-- DO NOT EDIT THIS PAGE ON THE WIKI. IT WILL BE OVERWRITTEN BY WIKIHEADERS AND CHANGES WILL BE LOST! --> | ||
|
||
If you want to paste this into a text editor that can handle | ||
fancy Unicode section headers, try using | ||
[QuickReference](QuickReference) instead. | ||
|
||
```c | ||
// SDL3_net API Quick Reference | ||
// | ||
// https://libsdl.org/ | ||
// | ||
// The latest version of this document can be found at https://wiki.libsdl.org/SDL3_net/QuickReference | ||
// Based on SDL_net version 3.0.0 | ||
// | ||
// This can be useful in an IDE with search and syntax highlighting. | ||
// | ||
// Original idea for this document came from Dan Bechard (thanks!) | ||
// ASCII art generated by: https://patorjk.com/software/taag/#p=display&f=ANSI%20Shadow (with modified 'S' for readability) | ||
|
||
|
||
// XXXXXX XXXXXX XX XXX XX XXXXXXX XXXXXXXX | ||
// XX XX XX XX XXXX XX XX XX | ||
// XXXXXXX XX XX XX XX XX XX XXXXX XX | ||
// XX XX XX XX XX XX XX XX XX | ||
// XXXXXX XXXXXX XXXXXXX XX XXXX XXXXXXX XX | ||
|
||
#define SDL_NET_MAJOR_VERSION // Printable format: "%d.%d.%d", MAJOR, MINOR, MICRO | ||
#define SDL_NET_VERSION // This is the version number macro for the current SDL_net version. | ||
#define SDL_NET_VERSION_ATLEAST(X, Y, Z) // This macro will evaluate to true if compiled with SDL_net at least X.Y.Z. | ||
int SDLNet_Version(void); // This function gets the version of the dynamically linked SDL_net library. | ||
bool SDLNet_Init(void); // Initialize the SDL_net library. | ||
void SDLNet_Quit(void); // Deinitialize the SDL_net library. | ||
SDLNet_Address * SDLNet_ResolveHostname(const char *host); // Resolve a human-readable hostname. | ||
int SDLNet_WaitUntilResolved(SDLNet_Address *address, Sint32 timeout); // Block until an address is resolved. | ||
int SDLNet_GetAddressStatus(SDLNet_Address *address); // Check if an address is resolved, without blocking. | ||
const char * SDLNet_GetAddressString(SDLNet_Address *address); // Get a human-readable string from a resolved address. | ||
SDLNet_Address * SDLNet_RefAddress(SDLNet_Address *address); // Add a reference to an SDLNet_Address. | ||
void SDLNet_UnrefAddress(SDLNet_Address *address); // Drop a reference to an SDLNet_Address. | ||
void SDLNet_SimulateAddressResolutionLoss(int percent_loss); // Enable simulated address resolution failures. | ||
int SDLNet_CompareAddresses(const SDLNet_Address *a, const SDLNet_Address *b); // Compare two SDLNet_Address objects. | ||
SDLNet_Address ** SDLNet_GetLocalAddresses(int *num_addresses); // Obtain a list of local addresses on the system. | ||
void SDLNet_FreeLocalAddresses(SDLNet_Address **addresses); // Free the results from SDLNet_GetLocalAddresses. | ||
SDLNet_StreamSocket * SDLNet_CreateClient(SDLNet_Address *address, Uint16 port); // Begin connecting a socket as a client to a remote server. | ||
int SDLNet_WaitUntilConnected(SDLNet_StreamSocket *sock, Sint32 timeout); // Block until a stream socket has connected to a server. | ||
SDLNet_Server * SDLNet_CreateServer(SDLNet_Address *addr, Uint16 port); // Create a server, which listens for connections to accept. | ||
bool SDLNet_AcceptClient(SDLNet_Server *server, SDLNet_StreamSocket **client_stream); // Create a stream socket for the next pending client connection. | ||
void SDLNet_DestroyServer(SDLNet_Server *server); // Dispose of a previously-created server. | ||
SDLNet_Address * SDLNet_GetStreamSocketAddress(SDLNet_StreamSocket *sock); // Get the remote address of a stream socket. | ||
int SDLNet_GetConnectionStatus(SDLNet_StreamSocket *sock); // Check if a stream socket is connected, without blocking. | ||
bool SDLNet_WriteToStreamSocket(SDLNet_StreamSocket *sock, const void *buf, int buflen); // Send bytes over a stream socket to a remote system. | ||
int SDLNet_GetStreamSocketPendingWrites(SDLNet_StreamSocket *sock); // Query bytes still pending transmission on a stream socket. | ||
int SDLNet_WaitUntilStreamSocketDrained(SDLNet_StreamSocket *sock, Sint32 timeout); // Block until all of a stream socket's pending data is sent. | ||
int SDLNet_ReadFromStreamSocket(SDLNet_StreamSocket *sock, void *buf, int buflen); // Receive bytes that a remote system sent to a stream socket. | ||
void SDLNet_SimulateStreamPacketLoss(SDLNet_StreamSocket *sock, int percent_loss); // Enable simulated stream socket failures. | ||
void SDLNet_DestroyStreamSocket(SDLNet_StreamSocket *sock); // Dispose of a previously-created stream socket. | ||
SDLNet_DatagramSocket * SDLNet_CreateDatagramSocket(SDLNet_Address *addr, Uint16 port); // Create and bind a new datagram socket. | ||
bool SDLNet_SendDatagram(SDLNet_DatagramSocket *sock, SDLNet_Address *address, Uint16 port, const void *buf, int buflen); // Send a new packet over a datagram socket to a remote system. | ||
bool SDLNet_ReceiveDatagram(SDLNet_DatagramSocket *sock, SDLNet_Datagram **dgram); // Receive a new packet that a remote system sent to a datagram socket. | ||
void SDLNet_DestroyDatagram(SDLNet_Datagram *dgram); // Dispose of a datagram packet previously received. | ||
void SDLNet_SimulateDatagramPacketLoss(SDLNet_DatagramSocket *sock, int percent_loss); // Enable simulated datagram socket failures. | ||
void SDLNet_DestroyDatagramSocket(SDLNet_DatagramSocket *sock); // Dispose of a previously-created datagram socket. | ||
int SDLNet_WaitUntilInputAvailable(void **vsockets, int numsockets, Sint32 timeout); // Block on multiple sockets until at least one has data available. | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.