api.h, api_lib.c, api_msg.c: Add macro API_EVENT in the same spirit than TCP_EVENT_xxx macros to get a code more readable. It could also help to remove some code (like we have talk in "patch #5919 : Create compile switch to remove select code"), but it could be done later.

This commit is contained in:
fbernon
2007-10-24 12:09:18 +00:00
parent 270c7c1110
commit 7077d51f1f
4 changed files with 37 additions and 49 deletions

View File

@@ -53,6 +53,7 @@ extern "C" {
* the same byte order as in the corresponding pcb.
*/
/* Flags for netconn_write */
#define NETCONN_NOCOPY 0x00
#define NETCONN_COPY 0x01
@@ -128,6 +129,10 @@ struct netconn {
void (* callback)(struct netconn *, enum netconn_evt, u16_t len);
};
/* Register an Network connection event */
#define API_EVENT(c,e,l) if (c->callback) { \
(*c->callback)(c, e, l); \
}
/* Network connection functions: */
#define netconn_new(t) netconn_new_with_proto_and_callback(t, 0, NULL)