-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
8cf1780
commit af0ccf4
Showing
6 changed files
with
94 additions
and
1 deletion.
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 |
---|---|---|
|
@@ -11,4 +11,6 @@ icmp_close_handle | |
icmp_create_handle | ||
icmp_last_code_type | ||
icmp_ping | ||
|
||
:TEXT_WRAP | ||
somemopt |
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,8 @@ | ||
#pragma once | ||
|
||
/** | ||
* \defgroup nn_nets2 nn_nets2 | ||
* Network functions 2. | ||
*/ | ||
|
||
#include <nn/nets2/somemopt.h> |
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,68 @@ | ||
#pragma once | ||
#include <wut.h> | ||
|
||
/** | ||
* \defgroup nn_nets2_somemopt | ||
* \ingroup nn_nets2 | ||
* User provided socket memory options. | ||
* @{ | ||
*/ | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
typedef enum SOMemOptRequest | ||
{ | ||
//! Initialize buffer managment from user-provided buffer. | ||
//! This is a blocking request, which only returns once nsysnet is shut down/the application quits. | ||
SOMEMOPT_REQUEST_INIT = 1, | ||
//! Return the amount of bytes used for buffer management. | ||
SOMEMOPT_REQUEST_GET_BYTES_USED = 2, | ||
//! Wait for buffer management initialization to be done. | ||
SOMEMOPT_REQUEST_WAIT_FOR_INIT = 3, | ||
//! Cancel pending wait for init. | ||
SOMEMOPT_REQUEST_CANCEL_WAIT = 4, | ||
} SOMemOptRequest; | ||
|
||
typedef enum SOMemOptFlags | ||
{ | ||
SOMEMOPT_FLAGS_NONE = 0, | ||
//! Changes the distribution between small and big buffers to 50-50 instead of 80-20. | ||
SOMEMOPT_FLAGS_BIG_BUFFERS = 1 << 0, | ||
} SOMemOptFlags; | ||
|
||
/** | ||
* Perform a somemopt request. | ||
* | ||
* \param request | ||
* The request to perform. | ||
* | ||
* \param buffer | ||
* A 0x40 aligned buffer for \link SOMEMOPT_REQUEST_INIT \endlink. | ||
* | ||
* \param size | ||
* The size of the buffer for \link SOMEMOPT_REQUEST_INIT \endlink. | ||
* Minimum size is \c 0x20000 bytes, maximum size is \c 0x300000. | ||
* | ||
* \param flags | ||
* A combination of flags. | ||
* | ||
* \return | ||
* -1 on error. | ||
*/ | ||
int | ||
somemopt(SOMemOptRequest request, | ||
void *buffer, | ||
uint32_t size, | ||
SOMemOptFlags flags); | ||
|
||
int | ||
RPLWRAP(somemopt)(SOMemOptRequest request, | ||
void *buffer, | ||
uint32_t size, | ||
SOMemOptFlags flags); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "wut_socket.h" | ||
|
||
#include <nn/nets2.h> | ||
|
||
int | ||
somemopt(SOMemOptRequest request, | ||
void *buffer, | ||
uint32_t size, | ||
SOMemOptFlags flags) | ||
{ | ||
int rc = RPLWRAP(somemopt)(request, buffer, size, flags); | ||
return __wut_get_nsysnet_result(NULL, rc); | ||
} |
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