diff options
-rw-r--r-- | main.c | 8 | ||||
-rw-r--r-- | plop.c | 8 | ||||
-rw-r--r-- | plop.h | 8 |
3 files changed, 12 insertions, 12 deletions
@@ -54,7 +54,7 @@ int main(int argc, char ** argv) return 8; } - if (LUA_OK != load_handler(L, argv[optind])) + if (LUA_OK != plop_load_handler(L, argv[optind])) { return 2; } @@ -69,7 +69,7 @@ int main(int argc, char ** argv) struct epoll_event e; e.events = EPOLLIN; e.data.ptr = NULL; // TODO: Consider putting server's Lua state in here? - const int server = make_server(NULL, service); // TODO: Check server's fd before ctl? + const int server = plop_make_server(NULL, service); // TODO: Check server's fd before ctl? if (-1 == epoll_ctl(efd, EPOLL_CTL_ADD, server, &e)) { @@ -92,14 +92,14 @@ int main(int argc, char ** argv) { if (NULL == events[i].data.ptr) { - if (-1 == handle_server(L, efd, server)) + if (-1 == plop_handle_server(L, efd, server)) { return 6; } } else { - if (-1 == handle_client(L, &events[i])) + if (-1 == plop_handle_client(L, &events[i])) { return 7; } @@ -23,7 +23,7 @@ /// \return File descriptor of the socket or -1 in case of an error /// \see getaddrinfo(3) // TODO: Handle UNIX sockets -int make_server(const char * node, const char * service) +int plop_make_server(const char * node, const char * service) { struct addrinfo hints = { .ai_family = AF_UNSPEC, @@ -86,7 +86,7 @@ int make_server(const char * node, const char * service) /// \param L Lua state to load the handler into /// \param path Path the script that returns handle is located at /// \param LUA_OK if successful, appropriate Lua error otherwise -int load_handler(lua_State * L, const char * path) +int plop_load_handler(lua_State * L, const char * path) { lua_getglobal(L, "package"); lua_pushstring(L, "loaded"); @@ -119,7 +119,7 @@ int load_handler(lua_State * L, const char * path) /// \param L Server's Lua state /// \param event Event for client /// \return -1 if an error occured -int handle_client(lua_State * L, struct epoll_event * event) +int plop_handle_client(lua_State * L, struct epoll_event * event) { // TODO: Temporary shenanigans to avoid too much changes. struct request * r = (struct request *) event->data.ptr; @@ -158,7 +158,7 @@ int handle_client(lua_State * L, struct epoll_event * event) /// \param efd File descriptor for epoll's context /// \param server File descriptor for server socket /// \return -1 if an error occured -int handle_server(lua_State * L, const int efd, const int server) +int plop_handle_server(lua_State * L, const int efd, const int server) { struct epoll_event e; e.events = EPOLLIN; // TODO: Add EPOLLOUT? @@ -6,7 +6,7 @@ #include "request.h" -int make_server(const char *, const char *); -int load_handler(lua_State *, const char *); -int handle_client(lua_State *, struct epoll_event *); -int handle_server(lua_State *, const int, const int); +int plop_make_server(const char *, const char *); +int plop_load_handler(lua_State *, const char *); +int plop_handle_client(lua_State *, struct epoll_event *); +int plop_handle_server(lua_State *, const int, const int); |