{"action":"created","comment":{"url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/comments/80698881","pull_request_review_id":1735159,"id":80698881,"diff_hunk":"@@ -26,103 +35,121 @@\n #include \"gatekeeper_lls.h\"\n #include \"gatekeeper_rt.h\"\n \n+#define RTE_LOGTYPE_CONFIG RTE_LOGTYPE_USER2\n+\n+/* TODO Get the install-path via Makefile. */\n+#define LUA_BASE_DIR \"./lua/\"\n+#define LUA_CONFIG_FILE     \"gatekeeper_config.lua\"\n+\n+struct gatekeeper_config {\n+\tstruct bp_config \t*bp_conf;\n+\tstruct catcher_config \t*catcher_conf;\n+\tstruct dynamic_config \t*dy_conf;\n+\tstruct cps_config \t*cps_conf;\n+\tstruct ggu_config \t*ggu_conf;\n+\tstruct gk_config \t*gk_conf;\n+\tstruct gt_config \t*gt_conf;\n+\tstruct rt_config \t*rt_conf;\n+};\n+\n+static lua_State *lua_state;\n+\n+/*\n+ * The configuration data structure will be created and \n+ * filled up by its corresponding Lua configuration script.\n+ */\n+static struct gatekeeper_config gatekeeper_conf;\n+\n+static int\n+set_lua_path(lua_State *l, const char *path)\n+{\n+\tint ret;\n+\tchar new_path[1024];\n+\tmemset(new_path, 0, sizeof(new_path));\n+\n+\tlua_getglobal(l, \"package\");\n+\tlua_getfield(l, -1, \"path\");\n+\n+\tret = snprintf(new_path, sizeof(new_path), \"%s;%s?.lua\", lua_tostring(l, -1), path);\n+\tRTE_ASSERT(ret < sizeof(new_path));\n+\n+\tlua_pop(l, 1);\n+\tlua_pushstring(l, new_path);\n+\tlua_setfield(l, -2, \"path\");\n+\tlua_pop(l, 1);\n+\n+\treturn ret;\n+}\n+\n int\n config_and_launch(void)\n {\n-\tstruct bp_config bp_conf;\n-\tstruct catcher_config catcher_conf;\n-\tstruct dynamic_config dy_conf;\n-\tstruct cps_config cps_conf;\n-\tstruct ggu_config ggu_conf;\n-\tstruct gk_config gk_conf;\n-\tstruct gt_config gt_conf;\n-\tstruct rt_config rt_conf;\n \tint ret;\n+\tchar lua_entry_path[128];\n \n-\t/*\n-\t * TODO Read in configuration file(s) using Lua and create\n-\t * config structs for each functional block. Then launch\n-\t * all functional blocks (with their config struct) that\n-\t * are needed with their own lcore(s).\n-\t */\n+\tret = snprintf(lua_entry_path, sizeof(lua_entry_path), \\\n+\t\t\t\"%s%s\", LUA_BASE_DIR, LUA_CONFIG_FILE);","path":"config/static.c","position":null,"original_position":87,"commit_id":"ca678aa601fcc9cfab7a44c437aab9ed9d449cf7","original_commit_id":"5dc121c03ef17847b42f5387595c728e4ab6606e","user":{"login":"AltraMayor","id":727014,"avatar_url":"https://avatars.githubusercontent.com/u/727014?v=3","gravatar_id":"","url":"https://api.github.com/users/AltraMayor","html_url":"https://github.com/AltraMayor","followers_url":"https://api.github.com/users/AltraMayor/followers","following_url":"https://api.github.com/users/AltraMayor/following{/other_user}","gists_url":"https://api.github.com/users/AltraMayor/gists{/gist_id}","starred_url":"https://api.github.com/users/AltraMayor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltraMayor/subscriptions","organizations_url":"https://api.github.com/users/AltraMayor/orgs","repos_url":"https://api.github.com/users/AltraMayor/repos","events_url":"https://api.github.com/users/AltraMayor/events{/privacy}","received_events_url":"https://api.github.com/users/AltraMayor/received_events","type":"User","site_admin":false},"body":"Please add a `/` between the two `%s`. This way, if someone edits `LUA_BASE_DIR` and forgets to add a `/`, the code will still work fine. In fact, you can even drop the current `/` at the end of `LUA_BASE_DIR`.","created_at":"2016-09-27T14:00:46Z","updated_at":"2016-09-27T14:00:46Z","html_url":"https://github.com/AltraMayor/gatekeeper/pull/5#discussion_r80698881","pull_request_url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/comments/80698881"},"html":{"href":"https://github.com/AltraMayor/gatekeeper/pull/5#discussion_r80698881"},"pull_request":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5","id":86644476,"html_url":"https://github.com/AltraMayor/gatekeeper/pull/5","diff_url":"https://github.com/AltraMayor/gatekeeper/pull/5.diff","patch_url":"https://github.com/AltraMayor/gatekeeper/pull/5.patch","issue_url":"https://api.github.com/repos/AltraMayor/gatekeeper/issues/5","number":5,"state":"open","locked":false,"title":"Configure the project via Lua scripts","user":{"login":"mengxiang0811","id":4590679,"avatar_url":"https://avatars.githubusercontent.com/u/4590679?v=3","gravatar_id":"","url":"https://api.github.com/users/mengxiang0811","html_url":"https://github.com/mengxiang0811","followers_url":"https://api.github.com/users/mengxiang0811/followers","following_url":"https://api.github.com/users/mengxiang0811/following{/other_user}","gists_url":"https://api.github.com/users/mengxiang0811/gists{/gist_id}","starred_url":"https://api.github.com/users/mengxiang0811/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengxiang0811/subscriptions","organizations_url":"https://api.github.com/users/mengxiang0811/orgs","repos_url":"https://api.github.com/users/mengxiang0811/repos","events_url":"https://api.github.com/users/mengxiang0811/events{/privacy}","received_events_url":"https://api.github.com/users/mengxiang0811/received_events","type":"User","site_admin":false},"body":"The first three commits mainly aim at supporting LuaJIT submodules, and fix the setup.sh and README files.\r\n\r\nThe  fourth commit actually removed some unused headers.\r\n\r\nThe fifth commit adds support to configure gatekeeper via Lua scripts. Now, we are ready to use LuaJIT FFI library to call functions defined in the C functional blocks.\r\n\r\nThe sixth commit configured GK block via Lua scripts.\r\n\r\nThe seventh commit configures the network via Lua scripts.","created_at":"2016-09-25T09:07:12Z","updated_at":"2016-09-27T14:04:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c2e1a6d6e6390c7e750943ebe4ea29c79c7c9f94","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5/commits","review_comments_url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5/comments","review_comment_url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/comments{/number}","comments_url":"https://api.github.com/repos/AltraMayor/gatekeeper/issues/5/comments","statuses_url":"https://api.github.com/repos/AltraMayor/gatekeeper/statuses/ca678aa601fcc9cfab7a44c437aab9ed9d449cf7","head":{"label":"mengxiang0811:lua-config","ref":"lua-config","sha":"ca678aa601fcc9cfab7a44c437aab9ed9d449cf7","user":{"login":"mengxiang0811","id":4590679,"avatar_url":"https://avatars.githubusercontent.com/u/4590679?v=3","gravatar_id":"","url":"https://api.github.com/users/mengxiang0811","html_url":"https://github.com/mengxiang0811","followers_url":"https://api.github.com/users/mengxiang0811/followers","following_url":"https://api.github.com/users/mengxiang0811/following{/other_user}","gists_url":"https://api.github.com/users/mengxiang0811/gists{/gist_id}","starred_url":"https://api.github.com/users/mengxiang0811/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengxiang0811/subscriptions","organizations_url":"https://api.github.com/users/mengxiang0811/orgs","repos_url":"https://api.github.com/users/mengxiang0811/repos","events_url":"https://api.github.com/users/mengxiang0811/events{/privacy}","received_events_url":"https://api.github.com/users/mengxiang0811/received_events","type":"User","site_admin":false},"repo":{"id":67135759,"name":"gatekeeper","full_name":"mengxiang0811/gatekeeper","owner":{"login":"mengxiang0811","id":4590679,"avatar_url":"https://avatars.githubusercontent.com/u/4590679?v=3","gravatar_id":"","url":"https://api.github.com/users/mengxiang0811","html_url":"https://github.com/mengxiang0811","followers_url":"https://api.github.com/users/mengxiang0811/followers","following_url":"https://api.github.com/users/mengxiang0811/following{/other_user}","gists_url":"https://api.github.com/users/mengxiang0811/gists{/gist_id}","starred_url":"https://api.github.com/users/mengxiang0811/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mengxiang0811/subscriptions","organizations_url":"https://api.github.com/users/mengxiang0811/orgs","repos_url":"https://api.github.com/users/mengxiang0811/repos","events_url":"https://api.github.com/users/mengxiang0811/events{/privacy}","received_events_url":"https://api.github.com/users/mengxiang0811/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mengxiang0811/gatekeeper","description":"First open source DoS protection system","fork":true,"url":"https://api.github.com/repos/mengxiang0811/gatekeeper","forks_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/forks","keys_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/teams","hooks_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/hooks","issue_events_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/issues/events{/number}","events_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/events","assignees_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/assignees{/user}","branches_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/branches{/branch}","tags_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/tags","blobs_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/languages","stargazers_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/stargazers","contributors_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/contributors","subscribers_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/subscribers","subscription_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/subscription","commits_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/contents/{+path}","compare_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/merges","archive_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/downloads","issues_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/issues{/number}","pulls_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/labels{/name}","releases_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/releases{/id}","deployments_url":"https://api.github.com/repos/mengxiang0811/gatekeeper/deployments","created_at":"2016-09-01T13:55:13Z","updated_at":"2016-09-01T13:56:38Z","pushed_at":"2016-09-27T05:41:57Z","git_url":"git://github.com/mengxiang0811/gatekeeper.git","ssh_url":"git@github.com:mengxiang0811/gatekeeper.git","clone_url":"https://github.com/mengxiang0811/gatekeeper.git","svn_url":"https://github.com/mengxiang0811/gatekeeper","homepage":"","size":56,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"AltraMayor:master","ref":"master","sha":"91a2bdb847441a8af4e27acae5d2a1f0fc238ab7","user":{"login":"AltraMayor","id":727014,"avatar_url":"https://avatars.githubusercontent.com/u/727014?v=3","gravatar_id":"","url":"https://api.github.com/users/AltraMayor","html_url":"https://github.com/AltraMayor","followers_url":"https://api.github.com/users/AltraMayor/followers","following_url":"https://api.github.com/users/AltraMayor/following{/other_user}","gists_url":"https://api.github.com/users/AltraMayor/gists{/gist_id}","starred_url":"https://api.github.com/users/AltraMayor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltraMayor/subscriptions","organizations_url":"https://api.github.com/users/AltraMayor/orgs","repos_url":"https://api.github.com/users/AltraMayor/repos","events_url":"https://api.github.com/users/AltraMayor/events{/privacy}","received_events_url":"https://api.github.com/users/AltraMayor/received_events","type":"User","site_admin":false},"repo":{"id":62745741,"name":"gatekeeper","full_name":"AltraMayor/gatekeeper","owner":{"login":"AltraMayor","id":727014,"avatar_url":"https://avatars.githubusercontent.com/u/727014?v=3","gravatar_id":"","url":"https://api.github.com/users/AltraMayor","html_url":"https://github.com/AltraMayor","followers_url":"https://api.github.com/users/AltraMayor/followers","following_url":"https://api.github.com/users/AltraMayor/following{/other_user}","gists_url":"https://api.github.com/users/AltraMayor/gists{/gist_id}","starred_url":"https://api.github.com/users/AltraMayor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AltraMayor/subscriptions","organizations_url":"https://api.github.com/users/AltraMayor/orgs","repos_url":"https://api.github.com/users/AltraMayor/repos","events_url":"https://api.github.com/users/AltraMayor/events{/privacy}","received_events_url":"https://api.github.com/users/AltraMayor/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AltraMayor/gatekeeper","description":"First open source DoS protection system","fork":false,"url":"https://api.github.com/repos/AltraMayor/gatekeeper","forks_url":"https://api.github.com/repos/AltraMayor/gatekeeper/forks","keys_url":"https://api.github.com/repos/AltraMayor/gatekeeper/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AltraMayor/gatekeeper/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AltraMayor/gatekeeper/teams","hooks_url":"https://api.github.com/repos/AltraMayor/gatekeeper/hooks","issue_events_url":"https://api.github.com/repos/AltraMayor/gatekeeper/issues/events{/number}","events_url":"https://api.github.com/repos/AltraMayor/gatekeeper/events","assignees_url":"https://api.github.com/repos/AltraMayor/gatekeeper/assignees{/user}","branches_url":"https://api.github.com/repos/AltraMayor/gatekeeper/branches{/branch}","tags_url":"https://api.github.com/repos/AltraMayor/gatekeeper/tags","blobs_url":"https://api.github.com/repos/AltraMayor/gatekeeper/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AltraMayor/gatekeeper/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AltraMayor/gatekeeper/git/refs{/sha}","trees_url":"https://api.github.com/repos/AltraMayor/gatekeeper/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AltraMayor/gatekeeper/statuses/{sha}","languages_url":"https://api.github.com/repos/AltraMayor/gatekeeper/languages","stargazers_url":"https://api.github.com/repos/AltraMayor/gatekeeper/stargazers","contributors_url":"https://api.github.com/repos/AltraMayor/gatekeeper/contributors","subscribers_url":"https://api.github.com/repos/AltraMayor/gatekeeper/subscribers","subscription_url":"https://api.github.com/repos/AltraMayor/gatekeeper/subscription","commits_url":"https://api.github.com/repos/AltraMayor/gatekeeper/commits{/sha}","git_commits_url":"https://api.github.com/repos/AltraMayor/gatekeeper/git/commits{/sha}","comments_url":"https://api.github.com/repos/AltraMayor/gatekeeper/comments{/number}","issue_comment_url":"https://api.github.com/repos/AltraMayor/gatekeeper/issues/comments{/number}","contents_url":"https://api.github.com/repos/AltraMayor/gatekeeper/contents/{+path}","compare_url":"https://api.github.com/repos/AltraMayor/gatekeeper/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AltraMayor/gatekeeper/merges","archive_url":"https://api.github.com/repos/AltraMayor/gatekeeper/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AltraMayor/gatekeeper/downloads","issues_url":"https://api.github.com/repos/AltraMayor/gatekeeper/issues{/number}","pulls_url":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls{/number}","milestones_url":"https://api.github.com/repos/AltraMayor/gatekeeper/milestones{/number}","notifications_url":"https://api.github.com/repos/AltraMayor/gatekeeper/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AltraMayor/gatekeeper/labels{/name}","releases_url":"https://api.github.com/repos/AltraMayor/gatekeeper/releases{/id}","deployments_url":"https://api.github.com/repos/AltraMayor/gatekeeper/deployments","created_at":"2016-07-06T18:53:45Z","updated_at":"2016-09-01T12:23:53Z","pushed_at":"2016-09-27T05:41:59Z","git_url":"git://github.com/AltraMayor/gatekeeper.git","ssh_url":"git@github.com:AltraMayor/gatekeeper.git","clone_url":"https://github.com/AltraMayor/gatekeeper.git","svn_url":"https://github.com/AltraMayor/gatekeeper","homepage":"","size":41,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":1,"forks":3,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5"},"html":{"href":"https://github.com/AltraMayor/gatekeeper/pull/5"},"issue":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/issues/5"},"comments":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/AltraMayor/gatekeeper/statuses/ca678aa601fcc9cfab7a44c437aab9ed9d449cf7"}}}}
{"actor":{"display_login":"AltraMayor"}}