summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2020-08-24 18:57:02 +0200
committerAki <please@ignore.pl>2020-08-24 18:57:02 +0200
commitbeab4f743429525add08cd22341470c972cb01be (patch)
tree19c9a8f34c0953d880c3e34f9818314e6169d89f
parent96b6d2a1cfccb060fadce11c50737000c7bf036c (diff)
downloadplop-beab4f743429525add08cd22341470c972cb01be.zip
plop-beab4f743429525add08cd22341470c972cb01be.tar.gz
plop-beab4f743429525add08cd22341470c972cb01be.tar.bz2
Added prefix to plop functions
-rw-r--r--main.c8
-rw-r--r--plop.c8
-rw-r--r--plop.h8
3 files changed, 12 insertions, 12 deletions
diff --git a/main.c b/main.c
index 2259caa..15747f1 100644
--- a/main.c
+++ b/main.c
@@ -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;
}
diff --git a/plop.c b/plop.c
index 1e34c99..b1c5944 100644
--- a/plop.c
+++ b/plop.c
@@ -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?
diff --git a/plop.h b/plop.h
index 78c307c..5b8e387 100644
--- a/plop.h
+++ b/plop.h
@@ -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);