-
Notifications
You must be signed in to change notification settings - Fork 201
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime/net_server: refactor to support multiple services
1 parent
7f4490a
commit 6ae41e6
Showing
3 changed files
with
91 additions
and
45 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
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 |
---|---|---|
@@ -1,7 +1,26 @@ | ||
#ifndef __NET_SERVER_H | ||
#define __NET_SERVER_H | ||
|
||
void net_server_init(void); | ||
struct net_server_connstate; | ||
struct tcp_pcb; | ||
|
||
struct net_server_instance { | ||
int port; | ||
|
||
void (*start)(void); | ||
void (*end)(void); | ||
int (*input)(void *data, int length); | ||
void (*poll)(void **data, int *length); | ||
void (*ack_consumed)(int length); | ||
void (*ack_sent)(int length); | ||
|
||
/* internal use */ | ||
struct tcp_pcb *listen_pcb; | ||
struct net_server_connstate *open_session_cs; | ||
struct tcp_pcb *open_session_pcb; | ||
}; | ||
|
||
void net_server_init(struct net_server_instance *instance); | ||
void net_server_service(void); | ||
|
||
#endif /* __NET_SERVER_H */ |