{"action":"created","comment":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/comments/57951763","id":57951763,"diff_hunk":"@@ -0,0 +1,352 @@\n+/*\n+ * This file is part of the Soletta Project\n+ *\n+ * Copyright (C) 2015 Intel Corporation. All rights reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *     http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+#pragma once\n+\n+#include <sol-common-buildopts.h>\n+#include <sol-network.h>\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+/**\n+ * @defgroup Socket Socket\n+ * @ingroup Comms\n+ *\n+ * @brief API to create an endpoint communication using sockets.\n+ *\n+ * @{\n+ */\n+\n+struct sol_socket;\n+\n+/**\n+ * @brief The defaults' socket types.\n+ */\n+enum sol_socket_default_type {\n+    SOL_SOCKET_UDP,\n+#ifdef SOL_DTLS_ENABLED\n+    SOL_SOCKET_DTLS,\n+#endif\n+};\n+\n+/**\n+ * @brief Available socket options\n+ */\n+enum sol_socket_option {\n+    SOL_SOCKET_OPTION_REUSEADDR,\n+    SOL_SOCKET_OPTION_REUSEPORT\n+};\n+\n+/**\n+ * @brief The socket option level\n+ */\n+enum sol_socket_level {\n+    SOL_SOCKET_LEVEL_SOCKET,\n+    SOL_SOCKET_LEVEL_IP,\n+    SOL_SOCKET_LEVEL_IPV6,\n+};\n+\n+/**\n+ * @brief Structure to represent a socket class.\n+ *\n+ * This struct contains the necessary information do deal with\n+ * a socket. This contains the methods necessaries to create\n+ * a new type of socket.\n+ */\n+struct sol_socket_type {\n+#ifndef SOL_NO_API_VERSION\n+#define SOL_SOCKET_TYPE_API_VERSION (1)  /**< compile time API version to be checked during runtime */\n+    /**\n+     * must match #SOL_SOCKET_TYPE_API_VERSION at runtime.\n+     */\n+    uint16_t api_version;\n+#endif\n+\n+    /**\n+     * @brief Function to be called when the socket is deleted.\n+     */\n+    void (*del)(struct sol_socket *s);\n+\n+    /**\n+     * @brief Register a function to be called when the socket has data to\n+     * be read.\n+     */\n+    int (*set_on_read)(struct sol_socket *s, bool (*cb)(void *data, struct sol_socket *s),\n+        const void *data);\n+\n+    /**\n+     * @brief Register a function to be called when the socket is ready to\n+     * be written.\n+     */\n+    int (*set_on_write)(struct sol_socket *s, bool (*cb)(void *data, struct sol_socket *s),\n+        const void *data);\n+\n+    /**\n+     * @brief Function to be called to read data from socket.\n+     */\n+    ssize_t (*recvmsg)(struct sol_socket *s, void *buf, size_t len,\n+        struct sol_network_link_addr *cliaddr);\n+\n+    /**\n+     * @brief Function to be called to write data in the socket.\n+     */\n+    int (*sendmsg)(struct sol_socket *s, const void *buf, size_t len,\n+        const struct sol_network_link_addr *cliaddr);\n+\n+    /**\n+     * @brief Function to be called to join a multicast group.\n+     */\n+    int (*join_group)(struct sol_socket *s, int ifindex,\n+        const struct sol_network_link_addr *group);\n+\n+    /**\n+     * @brief Function to be called to bind the socket to a network address.\n+     */\n+    int (*bind)(struct sol_socket *s, const struct sol_network_link_addr *addr);\n+\n+    /**\n+     * @brief Function to be called to set a option in the socket.\n+     */\n+    int (*setsockopt)(struct sol_socket *s, enum sol_socket_level level,\n+        enum sol_socket_option optname, const void *optval, size_t optlen);\n+\n+    /**\n+     * @brief Function to be called to get a socket option.\n+     */\n+    int (*getsockopt)(struct sol_socket *s, enum sol_socket_level level,\n+        enum sol_socket_option optname, void *optval, size_t *optlen);\n+};\n+\n+#ifndef SOL_NO_API_VERSION\n+/**\n+ * @brief Macro used to check if a struct @ref sol_socket_type\n+ * has the expected API version.\n+ *\n+ * In case it's a wrong version, it'll return extra arguments passed\n+ * to the macro.\n+ */\n+#define SOL_SOCKET_TYPE_CHECK_API_VERSION(type_, ...) \\","path":"src/lib/comms/include/sol-socket.h","position":145,"original_position":145,"commit_id":"366ecc698cd627a8bee13d626e6d32156a994be5","original_commit_id":"366ecc698cd627a8bee13d626e6d32156a994be5","user":{"login":"ceolin","id":882919,"avatar_url":"https://avatars.githubusercontent.com/u/882919?v=3","gravatar_id":"","url":"https://api.github.com/users/ceolin","html_url":"https://github.com/ceolin","followers_url":"https://api.github.com/users/ceolin/followers","following_url":"https://api.github.com/users/ceolin/following{/other_user}","gists_url":"https://api.github.com/users/ceolin/gists{/gist_id}","starred_url":"https://api.github.com/users/ceolin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceolin/subscriptions","organizations_url":"https://api.github.com/users/ceolin/orgs","repos_url":"https://api.github.com/users/ceolin/repos","events_url":"https://api.github.com/users/ceolin/events{/privacy}","received_events_url":"https://api.github.com/users/ceolin/received_events","type":"User","site_admin":false},"body":"http and mqtt are","created_at":"2016-03-30T19:49:40Z","updated_at":"2016-03-30T19:49:40Z","html_url":"https://github.com/solettaproject/soletta/pull/1773#discussion_r57951763","pull_request_url":"https://api.github.com/repos/solettaproject/soletta/pulls/1773","_links":{"self":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/comments/57951763"},"html":{"href":"https://github.com/solettaproject/soletta/pull/1773#discussion_r57951763"},"pull_request":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1773"}}},"pull_request":{"url":"https://api.github.com/repos/solettaproject/soletta/pulls/1773","id":64640984,"html_url":"https://github.com/solettaproject/soletta/pull/1773","diff_url":"https://github.com/solettaproject/soletta/pull/1773.diff","patch_url":"https://github.com/solettaproject/soletta/pull/1773.patch","issue_url":"https://api.github.com/repos/solettaproject/soletta/issues/1773","number":1773,"state":"open","locked":false,"title":"Export socket","user":{"login":"ceolin","id":882919,"avatar_url":"https://avatars.githubusercontent.com/u/882919?v=3","gravatar_id":"","url":"https://api.github.com/users/ceolin","html_url":"https://github.com/ceolin","followers_url":"https://api.github.com/users/ceolin/followers","following_url":"https://api.github.com/users/ceolin/following{/other_user}","gists_url":"https://api.github.com/users/ceolin/gists{/gist_id}","starred_url":"https://api.github.com/users/ceolin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceolin/subscriptions","organizations_url":"https://api.github.com/users/ceolin/orgs","repos_url":"https://api.github.com/users/ceolin/repos","events_url":"https://api.github.com/users/ceolin/events{/privacy}","received_events_url":"https://api.github.com/users/ceolin/received_events","type":"User","site_admin":false},"body":"This the first step for separate the coap transport. This will make able one create you own socket type.","created_at":"2016-03-30T14:53:37Z","updated_at":"2016-03-30T19:49:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47de8a86898a37bf2839b3aecb497c72e0773be7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/solettaproject/soletta/pulls/1773/commits","review_comments_url":"https://api.github.com/repos/solettaproject/soletta/pulls/1773/comments","review_comment_url":"https://api.github.com/repos/solettaproject/soletta/pulls/comments{/number}","comments_url":"https://api.github.com/repos/solettaproject/soletta/issues/1773/comments","statuses_url":"https://api.github.com/repos/solettaproject/soletta/statuses/366ecc698cd627a8bee13d626e6d32156a994be5","head":{"label":"ceolin:socket","ref":"socket","sha":"366ecc698cd627a8bee13d626e6d32156a994be5","user":{"login":"ceolin","id":882919,"avatar_url":"https://avatars.githubusercontent.com/u/882919?v=3","gravatar_id":"","url":"https://api.github.com/users/ceolin","html_url":"https://github.com/ceolin","followers_url":"https://api.github.com/users/ceolin/followers","following_url":"https://api.github.com/users/ceolin/following{/other_user}","gists_url":"https://api.github.com/users/ceolin/gists{/gist_id}","starred_url":"https://api.github.com/users/ceolin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceolin/subscriptions","organizations_url":"https://api.github.com/users/ceolin/orgs","repos_url":"https://api.github.com/users/ceolin/repos","events_url":"https://api.github.com/users/ceolin/events{/privacy}","received_events_url":"https://api.github.com/users/ceolin/received_events","type":"User","site_admin":false},"repo":{"id":37607073,"name":"soletta","full_name":"ceolin/soletta","owner":{"login":"ceolin","id":882919,"avatar_url":"https://avatars.githubusercontent.com/u/882919?v=3","gravatar_id":"","url":"https://api.github.com/users/ceolin","html_url":"https://github.com/ceolin","followers_url":"https://api.github.com/users/ceolin/followers","following_url":"https://api.github.com/users/ceolin/following{/other_user}","gists_url":"https://api.github.com/users/ceolin/gists{/gist_id}","starred_url":"https://api.github.com/users/ceolin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ceolin/subscriptions","organizations_url":"https://api.github.com/users/ceolin/orgs","repos_url":"https://api.github.com/users/ceolin/repos","events_url":"https://api.github.com/users/ceolin/events{/privacy}","received_events_url":"https://api.github.com/users/ceolin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ceolin/soletta","description":"Soletta Project is a framework for making IoT devices.  With Soletta Project's libraries developers can easily write software for devices that control actuators/sensors and communicate using standard technologies. It enables adding smartness even on the smallest edge devices.  Portable and scalable, it abstracts details of hardware and OS, enabling developers to reuse their code and knowledge on different targets.","fork":true,"url":"https://api.github.com/repos/ceolin/soletta","forks_url":"https://api.github.com/repos/ceolin/soletta/forks","keys_url":"https://api.github.com/repos/ceolin/soletta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ceolin/soletta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ceolin/soletta/teams","hooks_url":"https://api.github.com/repos/ceolin/soletta/hooks","issue_events_url":"https://api.github.com/repos/ceolin/soletta/issues/events{/number}","events_url":"https://api.github.com/repos/ceolin/soletta/events","assignees_url":"https://api.github.com/repos/ceolin/soletta/assignees{/user}","branches_url":"https://api.github.com/repos/ceolin/soletta/branches{/branch}","tags_url":"https://api.github.com/repos/ceolin/soletta/tags","blobs_url":"https://api.github.com/repos/ceolin/soletta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ceolin/soletta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ceolin/soletta/git/refs{/sha}","trees_url":"https://api.github.com/repos/ceolin/soletta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ceolin/soletta/statuses/{sha}","languages_url":"https://api.github.com/repos/ceolin/soletta/languages","stargazers_url":"https://api.github.com/repos/ceolin/soletta/stargazers","contributors_url":"https://api.github.com/repos/ceolin/soletta/contributors","subscribers_url":"https://api.github.com/repos/ceolin/soletta/subscribers","subscription_url":"https://api.github.com/repos/ceolin/soletta/subscription","commits_url":"https://api.github.com/repos/ceolin/soletta/commits{/sha}","git_commits_url":"https://api.github.com/repos/ceolin/soletta/git/commits{/sha}","comments_url":"https://api.github.com/repos/ceolin/soletta/comments{/number}","issue_comment_url":"https://api.github.com/repos/ceolin/soletta/issues/comments{/number}","contents_url":"https://api.github.com/repos/ceolin/soletta/contents/{+path}","compare_url":"https://api.github.com/repos/ceolin/soletta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ceolin/soletta/merges","archive_url":"https://api.github.com/repos/ceolin/soletta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ceolin/soletta/downloads","issues_url":"https://api.github.com/repos/ceolin/soletta/issues{/number}","pulls_url":"https://api.github.com/repos/ceolin/soletta/pulls{/number}","milestones_url":"https://api.github.com/repos/ceolin/soletta/milestones{/number}","notifications_url":"https://api.github.com/repos/ceolin/soletta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ceolin/soletta/labels{/name}","releases_url":"https://api.github.com/repos/ceolin/soletta/releases{/id}","deployments_url":"https://api.github.com/repos/ceolin/soletta/deployments","created_at":"2015-06-17T16:33:08Z","updated_at":"2015-06-17T16:33:10Z","pushed_at":"2016-03-30T18:52:00Z","git_url":"git://github.com/ceolin/soletta.git","ssh_url":"git@github.com:ceolin/soletta.git","clone_url":"https://github.com/ceolin/soletta.git","svn_url":"https://github.com/ceolin/soletta","homepage":"","size":17766,"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":"solettaproject:master","ref":"master","sha":"d8ba48b1e27d2a1fe97a65d32125b87f1a0bf44b","user":{"login":"solettaproject","id":12736897,"avatar_url":"https://avatars.githubusercontent.com/u/12736897?v=3","gravatar_id":"","url":"https://api.github.com/users/solettaproject","html_url":"https://github.com/solettaproject","followers_url":"https://api.github.com/users/solettaproject/followers","following_url":"https://api.github.com/users/solettaproject/following{/other_user}","gists_url":"https://api.github.com/users/solettaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/solettaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solettaproject/subscriptions","organizations_url":"https://api.github.com/users/solettaproject/orgs","repos_url":"https://api.github.com/users/solettaproject/repos","events_url":"https://api.github.com/users/solettaproject/events{/privacy}","received_events_url":"https://api.github.com/users/solettaproject/received_events","type":"Organization","site_admin":false},"repo":{"id":37087063,"name":"soletta","full_name":"solettaproject/soletta","owner":{"login":"solettaproject","id":12736897,"avatar_url":"https://avatars.githubusercontent.com/u/12736897?v=3","gravatar_id":"","url":"https://api.github.com/users/solettaproject","html_url":"https://github.com/solettaproject","followers_url":"https://api.github.com/users/solettaproject/followers","following_url":"https://api.github.com/users/solettaproject/following{/other_user}","gists_url":"https://api.github.com/users/solettaproject/gists{/gist_id}","starred_url":"https://api.github.com/users/solettaproject/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/solettaproject/subscriptions","organizations_url":"https://api.github.com/users/solettaproject/orgs","repos_url":"https://api.github.com/users/solettaproject/repos","events_url":"https://api.github.com/users/solettaproject/events{/privacy}","received_events_url":"https://api.github.com/users/solettaproject/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/solettaproject/soletta","description":"Soletta Project is a framework for making IoT devices.  With Soletta Project's libraries developers can easily write software for devices that control actuators/sensors and communicate using standard technologies. It enables adding smartness even on the smallest edge devices.  ","fork":false,"url":"https://api.github.com/repos/solettaproject/soletta","forks_url":"https://api.github.com/repos/solettaproject/soletta/forks","keys_url":"https://api.github.com/repos/solettaproject/soletta/keys{/key_id}","collaborators_url":"https://api.github.com/repos/solettaproject/soletta/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/solettaproject/soletta/teams","hooks_url":"https://api.github.com/repos/solettaproject/soletta/hooks","issue_events_url":"https://api.github.com/repos/solettaproject/soletta/issues/events{/number}","events_url":"https://api.github.com/repos/solettaproject/soletta/events","assignees_url":"https://api.github.com/repos/solettaproject/soletta/assignees{/user}","branches_url":"https://api.github.com/repos/solettaproject/soletta/branches{/branch}","tags_url":"https://api.github.com/repos/solettaproject/soletta/tags","blobs_url":"https://api.github.com/repos/solettaproject/soletta/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/solettaproject/soletta/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/solettaproject/soletta/git/refs{/sha}","trees_url":"https://api.github.com/repos/solettaproject/soletta/git/trees{/sha}","statuses_url":"https://api.github.com/repos/solettaproject/soletta/statuses/{sha}","languages_url":"https://api.github.com/repos/solettaproject/soletta/languages","stargazers_url":"https://api.github.com/repos/solettaproject/soletta/stargazers","contributors_url":"https://api.github.com/repos/solettaproject/soletta/contributors","subscribers_url":"https://api.github.com/repos/solettaproject/soletta/subscribers","subscription_url":"https://api.github.com/repos/solettaproject/soletta/subscription","commits_url":"https://api.github.com/repos/solettaproject/soletta/commits{/sha}","git_commits_url":"https://api.github.com/repos/solettaproject/soletta/git/commits{/sha}","comments_url":"https://api.github.com/repos/solettaproject/soletta/comments{/number}","issue_comment_url":"https://api.github.com/repos/solettaproject/soletta/issues/comments{/number}","contents_url":"https://api.github.com/repos/solettaproject/soletta/contents/{+path}","compare_url":"https://api.github.com/repos/solettaproject/soletta/compare/{base}...{head}","merges_url":"https://api.github.com/repos/solettaproject/soletta/merges","archive_url":"https://api.github.com/repos/solettaproject/soletta/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/solettaproject/soletta/downloads","issues_url":"https://api.github.com/repos/solettaproject/soletta/issues{/number}","pulls_url":"https://api.github.com/repos/solettaproject/soletta/pulls{/number}","milestones_url":"https://api.github.com/repos/solettaproject/soletta/milestones{/number}","notifications_url":"https://api.github.com/repos/solettaproject/soletta/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/solettaproject/soletta/labels{/name}","releases_url":"https://api.github.com/repos/solettaproject/soletta/releases{/id}","deployments_url":"https://api.github.com/repos/solettaproject/soletta/deployments","created_at":"2015-06-08T19:13:18Z","updated_at":"2016-03-28T01:06:55Z","pushed_at":"2016-03-30T19:34:49Z","git_url":"git://github.com/solettaproject/soletta.git","ssh_url":"git@github.com:solettaproject/soletta.git","clone_url":"https://github.com/solettaproject/soletta.git","svn_url":"https://github.com/solettaproject/soletta","homepage":"http://solettaproject.org","size":24633,"stargazers_count":79,"watchers_count":79,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":63,"mirror_url":null,"open_issues_count":192,"forks":63,"open_issues":192,"watchers":79,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1773"},"html":{"href":"https://github.com/solettaproject/soletta/pull/1773"},"issue":{"href":"https://api.github.com/repos/solettaproject/soletta/issues/1773"},"comments":{"href":"https://api.github.com/repos/solettaproject/soletta/issues/1773/comments"},"review_comments":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1773/comments"},"review_comment":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/solettaproject/soletta/pulls/1773/commits"},"statuses":{"href":"https://api.github.com/repos/solettaproject/soletta/statuses/366ecc698cd627a8bee13d626e6d32156a994be5"}}}}