{"id":23943976,"url":"https://github.com/gecko-robotics/socket_defs","last_synced_at":"2025-07-26T11:15:58.458Z","repository":{"id":184088244,"uuid":"671290566","full_name":"gecko-robotics/socket_defs","owner":"gecko-robotics","description":null,"archived":false,"fork":false,"pushed_at":"2023-09-20T21:10:55.000Z","size":82,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-06T06:16:12.413Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gecko-robotics.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-27T01:50:58.000Z","updated_at":"2023-08-26T01:06:44.000Z","dependencies_parsed_at":"2023-08-26T05:16:28.970Z","dependency_job_id":null,"html_url":"https://github.com/gecko-robotics/socket_defs","commit_stats":null,"previous_names":["gecko-robotics/socket","gecko-robotics/socket_defs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gecko-robotics%2Fsocket_defs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gecko-robotics%2Fsocket_defs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gecko-robotics%2Fsocket_defs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gecko-robotics%2Fsocket_defs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gecko-robotics","download_url":"https://codeload.github.com/gecko-robotics/socket_defs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240427193,"owners_count":19799466,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-06T06:16:14.353Z","updated_at":"2025-02-24T05:44:42.346Z","avatar_url":"https://github.com/gecko-robotics.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src=\"docs/socket.svg\" width=\"300px\"\u003e\n\n# Socket Definitions\n\nSome common code that a couple of my repos use. This is a header\nonly library.\n\n- Transport with `pack`/`unpack` or `encode`/`decode` methods to convert to/from\n  source/`message_t`\n  - JSON: super simple string only, ex: `{\"hi\": \"23\",\"something\":\"something longer\"}`\n  - ASCII: human readable text with separators, ex: `\"one two three` --\u003e `one,two,three`\n  - RAW: similar to ASCII but no separators, it only changes `char` --\u003e `uint8_t`\n- Socket info:\n  - `inetaddr_t`: takes `udp://\u003cx.x.x.x|*|bc\u003e:\u003cxxxx|*\u003e` (e.g., `udp://1.2.3.4:56789`)\n    and converts into socket descriptor info\n    - Doesn't support TCP right now\n    - Address `*` sets it to `INADDR_ANY` which defaults to `0.0.0.0`\n    - Address `bc` set it to `INADDR_BROADCAST` which is for broadcasting\n    - Port `*` sets it to 0 which tells the kernel to use the first port number available\n  - `unixaddr_t`: takes `unix://./my/cool/path/file.uds`\n- Messages which are transmitted between sockets.\n  - pack: templated function that does `pack\u003cstruct\u003e(struct)` --\u003e `message_t`\n  - unpack: templated function that does `unpack\u003cstruct\u003e(message_t)` --\u003e `struct`\n  - debugging to convert `message_t` --\u003e `std::string` and support `std::ostream` with `\u003c\u003c`\n\n\n## Usage\n\n```cpp\n\n```\n\n## cmake\n\nYou can use `cmake`'s `FetchContent` to download the library and\nadd it to your program like this:\n\n```cmake\ninclude(FetchContent)\n\n# socket_defs -----------------\nFetchContent_Declare(\n  socket_defs\n  GIT_REPOSITORY \"https://github.com/gecko-robotics/socket_defs.git\"\n)\n\nFetchContent_MakeAvailable( socket_defs )\n\nadd_executable(${PROJECT_NAME} main.cpp)\ntarget_link_libraries(${PROJECT_NAME} INTERFACE socket_defs)\n```\n\n# MIT License\n\n**Copyright (c) 2003 Kevin J. Walchko**\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgecko-robotics%2Fsocket_defs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgecko-robotics%2Fsocket_defs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgecko-robotics%2Fsocket_defs/lists"}