{"id":19492802,"url":"https://github.com/oatpp/oatpp-ssdp","last_synced_at":"2025-04-25T20:30:41.592Z","repository":{"id":43831357,"uuid":"271403110","full_name":"oatpp/oatpp-ssdp","owner":"oatpp","description":"Oat++ extension module to work with SSDP protocol.","archived":false,"fork":false,"pushed_at":"2024-04-21T20:09:08.000Z","size":95,"stargazers_count":2,"open_issues_count":2,"forks_count":2,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-29T22:51:45.479Z","etag":null,"topics":["cpp","oatpp","ssdp"],"latest_commit_sha":null,"homepage":"https://oatpp.io/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oatpp.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-10T23:02:11.000Z","updated_at":"2023-08-05T19:40:40.000Z","dependencies_parsed_at":"2024-11-10T15:15:12.156Z","dependency_job_id":null,"html_url":"https://github.com/oatpp/oatpp-ssdp","commit_stats":{"total_commits":23,"total_committers":6,"mean_commits":"3.8333333333333335","dds":"0.34782608695652173","last_synced_commit":"21aa8995797625d8b93bb86f8e68fd0e49eac4ac"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-ssdp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-ssdp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-ssdp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oatpp%2Foatpp-ssdp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oatpp","download_url":"https://codeload.github.com/oatpp/oatpp-ssdp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224015660,"owners_count":17241535,"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":["cpp","oatpp","ssdp"],"created_at":"2024-11-10T21:23:05.292Z","updated_at":"2024-11-10T21:23:05.749Z","avatar_url":"https://github.com/oatpp.png","language":"C++","readme":"# oatpp-ssdp [![Build Status](https://dev.azure.com/lganzzzo/lganzzzo/_apis/build/status/oatpp.oatpp-ssdp?branchName=master)](https://dev.azure.com/lganzzzo/lganzzzo/_build/latest?definitionId=28\u0026branchName=master)\n\nOat++ extension module to work with SSDP (Simple Service Discovery Protocol) protocol.\n\n👉Find the complete example project using **oatpp-ssdp** module - [Example IoT Hue](https://github.com/oatpp/example-iot-hue-ssdp)👈\n\nMore about Oat++:\n\n- [Oat++ Website](https://oatpp.io/)\n- [Oat++ Github Repository](https://github.com/oatpp/oatpp)\n\n## Build And Install\n\n*Note: you need to install the main [oatpp](https://github.com/oatpp/oatpp) module first.*\n\n\n- Clone this repository.\n- In the root of the repository run:\n   ```bash\n   mkdir build \u0026\u0026 cd build\n   cmake ..\n   make install\n   ```\n   \n## API\n\n### Declare Necessary Components\n\nIn the `AppComponent.hpp` file:\n\n```cpp\n#include \"oatpp-ssdp/SimpleSsdpUdpStreamProvider.hpp\"\n#include \"oatpp-ssdp/SsdpStreamHandler.hpp\"\n\n...\n\n/**\n * Create provider of SSDP-UDP packets stream.\n */\nOATPP_CREATE_COMPONENT(std::shared_ptr\u003coatpp::ssdp::UdpStreamProvider\u003e, ssdpStreamProvider)(\"ssdp\", [] {\n  return oatpp::ssdp::SimpleSsdpUdpStreamProvider::createShared();\n}());\n\n/**\n * We can reuse the HttpRouter for SSDP since SSDP message is complient to HTTP1.1.\n */\nOATPP_CREATE_COMPONENT(std::shared_ptr\u003coatpp::web::server::HttpRouter\u003e, ssdpRouter)(\"ssdp\", [] {\n  return oatpp::web::server::HttpRouter::createShared();\n}());\n\n/**\n * Create SsdpStreamHandler component which uses Router component to route requests.\n * It looks like a normal ConnectionHandler but is specialized on SsdpStreams and returns something conceptually very different\n */\nOATPP_CREATE_COMPONENT(std::shared_ptr\u003coatpp::ssdp::SsdpStreamHandler\u003e, ssdpStreamHandler)(\"ssdp\", [] {\n  OATPP_COMPONENT(std::shared_ptr\u003coatpp::web::server::HttpRouter\u003e, router, \"ssdp\"); // get Router component\n  return oatpp::ssdp::SsdpStreamHandler::createShared(router);\n}());  \n```\n\n### Run SSDP Server\n\nIn the `App.cpp` file:\n\n```cpp\n/* Get stream provider component */\nOATPP_COMPONENT(std::shared_ptr\u003coatpp::ssdp::UdpStreamProvider\u003e, ssdpStreamProvider, \"ssdp\");\n\n/* Get stream handler component */\nOATPP_COMPONENT(std::shared_ptr\u003coatpp::ssdp::SsdpStreamHandler\u003e, ssdpStreamHandler, \"ssdp\");\n\n/* Create server which takes provided streams and passes them to stream handler */\noatpp::network::server::Server server(ssdpStreamProvider, ssdpStreamHandler);\n\n/* Priny info about server port */\nOATPP_LOGD(\"Server\", \"Running SSDP on port %s...\", ssdpStreamProvider-\u003egetProperty(\"port\").getData());\n\n/* Run server */\nserver.run();\n```\n\n### Handle SSDP Messages\n\nIn the `Controller.hpp` file:\n\n```cpp\n/**\n * Other devices that want to discover you send 'M-SEARCH *' SSDP packages.\n * You have to answer with a corresponding packet on this discovery.\n */\nENDPOINT(\"M-SEARCH\", \"*\", star) {\n  auto response = createResponse(Status::CODE_200, \"\" /* empty body */);\n  // TODO - add correct response headers.\n  return response;\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Foatpp-ssdp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foatpp%2Foatpp-ssdp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foatpp%2Foatpp-ssdp/lists"}