Added client, fixed typo
This commit is contained in:
39
client.h
Normal file
39
client.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef __CLIENT_H
|
||||
#define __CLIENT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
// Setup client module.
|
||||
// Returns:
|
||||
// - true on success
|
||||
// - false on failure
|
||||
bool client_init();
|
||||
|
||||
// Cleanup all pending connections.
|
||||
void client_deinit();
|
||||
|
||||
// Connect to the server.
|
||||
// Parameters:
|
||||
// - host - server host
|
||||
// - port - server port
|
||||
// Returns:
|
||||
// - true on success
|
||||
// Remarks:
|
||||
// - the socket is managed by this module. It will be
|
||||
// added to connection module after connection succeeds.
|
||||
bool client_connect(const char *host, uint16_t port);
|
||||
|
||||
// Handle event on the socket managed by this module.
|
||||
// Parameters:
|
||||
// - fd - socket
|
||||
// - events - events as returned by epoll
|
||||
// Returns:
|
||||
// - true if the socket is managed by this module
|
||||
// - false if the socket is not managed by this module
|
||||
// Remarks:
|
||||
// - no checks are done
|
||||
bool client_event(int fd, uint32_t events);
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user