Skip to content

Commit

Permalink
Sync SDL3_net header -> wiki
Browse files Browse the repository at this point in the history
  • Loading branch information
SDLWikiBot committed Dec 10, 2024
1 parent 467e807 commit 2960de7
Show file tree
Hide file tree
Showing 39 changed files with 210 additions and 39 deletions.
41 changes: 41 additions & 0 deletions SDL3_net/CategorySDLNet.md
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)

65 changes: 65 additions & 0 deletions SDL3_net/QuickReference.md
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.
```
64 changes: 64 additions & 0 deletions SDL3_net/QuickReferenceNoUnicode.md
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.
```
2 changes: 1 addition & 1 deletion SDL3_net/SDLNet_AcceptClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ This function is available since SDL_Net 3.0.0.
- [SDLNet_DestroyStreamSocket](SDLNet_DestroyStreamSocket)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
2 changes: 1 addition & 1 deletion SDL3_net/SDLNet_CompareAddresses.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ It is safe to call this function from any thread.
This function is available since SDL_Net 3.0.0.
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
2 changes: 1 addition & 1 deletion SDL3_net/SDLNet_CreateClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ This function is available since SDL_Net 3.0.0.
- [SDLNet_DestroyStreamSocket](SDLNet_DestroyStreamSocket)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
9 changes: 5 additions & 4 deletions SDL3_net/SDLNet_CreateDatagramSocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ SDLNet_DatagramSocket * SDLNet_CreateDatagramSocket(SDLNet_Address *addr, Uint16
## Function Parameters
| | | |
| ------ | -------- | --------------------------------------------------------------------------------------------- |
| Uint16 | **port** | the port on the local address to listen for connections on, or zero for the system to decide. |
| | | |
| ---------------------------------- | -------- | --------------------------------------------------------------------------------------------------- |
| [SDLNet_Address](SDLNet_Address) * | **addr** | the local address to listen for connections on, or NULL to listen on all available local addresses. |
| Uint16 | **port** | the port on the local address to listen for connections on, or zero for the system to decide. |
## Return Value
Expand Down Expand Up @@ -83,5 +84,5 @@ This function is available since SDL_Net 3.0.0.
- [SDLNet_DestroyDatagramSocket](SDLNet_DestroyDatagramSocket)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
2 changes: 1 addition & 1 deletion SDL3_net/SDLNet_CreateServer.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ This function is available since SDL_Net 3.0.0.
- [SDLNet_DestroyServer](SDLNet_DestroyServer)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
2 changes: 1 addition & 1 deletion SDL3_net/SDLNet_DestroyDatagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ It is safe to call this function from any thread.
This function is available since SDL_Net 3.0.0.
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
2 changes: 1 addition & 1 deletion SDL3_net/SDLNet_DestroyDatagramSocket.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ This function is available since SDL_Net 3.0.0.
- [SDLNet_ReceiveDatagram](SDLNet_ReceiveDatagram)
----
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction)
[CategoryAPI](CategoryAPI), [CategoryAPIFunction](CategoryAPIFunction), [CategorySDLNet](CategorySDLNet)
Loading

0 comments on commit 2960de7

Please sign in to comment.