diff options
Diffstat (limited to 'lib/include')
-rw-r--r-- | lib/include/libostp/server.h | 17 | ||||
-rw-r--r-- | lib/include/net/auth.h | 4 |
2 files changed, 15 insertions, 6 deletions
diff --git a/lib/include/libostp/server.h b/lib/include/libostp/server.h index a7a737b..0e232f6 100644 --- a/lib/include/libostp/server.h +++ b/lib/include/libostp/server.h @@ -32,23 +32,32 @@ #include <sys/select.h> #include <libostp/session.h> +#include <pthread.h> #include <stddef.h> #define MAX_CLIENTS 32 +struct ostp_client { + struct ostp_session session; + int sockfd; + pthread_t td; +}; + struct ostp_listener { - int(*on_recv)(struct ostp_session *session, const char *buf, size_t len); + int(*on_recv)(struct ostp_client *c, const char *buf, size_t len); int port; /* -- Private -- */ - int clients[MAX_CLIENTS]; + struct ostp_client clients[MAX_CLIENTS]; + size_t client_count; int serv_sockfd; fd_set client_fds; }; void listener_init(struct ostp_listener *lp); -int listener_bind(struct ostp_session *sp, struct ostp_listener *lp); -int listener_poll(struct ostp_session *sp, struct ostp_listener *lp); +int listener_bind(struct ostp_listener *lp); +int listener_poll(struct ostp_listener *lp); void listener_cleanup(struct ostp_listener *lp); +void listener_close(struct ostp_listener *lp, struct ostp_client *c); #endif /* !LIBOSTP_SERVER_H_ */ diff --git a/lib/include/net/auth.h b/lib/include/net/auth.h index d672231..0f22d22 100644 --- a/lib/include/net/auth.h +++ b/lib/include/net/auth.h @@ -34,8 +34,8 @@ #include <libostp/session.h> #include <libostp/server.h> -int handle_srq(struct ostp_session *sp, struct ostp_listener *lp, +int handle_srq(struct ostp_client *c, struct ostp_listener *lp, struct session_request *srq); -int negotiate_spw(struct ostp_session *sp, unsigned char *session_key); +int negotiate_spw(struct ostp_client *c, unsigned char *session_key); #endif /* NET_AUTH_H_ */ |