Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add is10 support #1

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Development/nmos/node_resources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ namespace nmos
{
web::json::push_back(data[U("controls")], value_of({
{ U("href"), streamcompatibility_uri.set_host(host).to_uri().to_string() },
{ U("type"), type }
{ U("type"), type },
{ U("authorization"), nmos::experimental::fields::server_authorization(settings) }
}));
}
}
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/node_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace nmos
node_server.api_routers[{ {}, nmos::fields::channelmapping_port(node_model.settings) }].mount({}, nmos::make_channelmapping_api(node_model, node_implementation.validate_map, validate_authorization ? validate_authorization(nmos::experimental::scopes::channelmapping) : nullptr, gate));

// Configure the Stream Compatibility API
node_server.api_routers[{ {}, nmos::fields::streamcompatibility_port(node_model.settings) }].mount({}, nmos::experimental::make_streamcompatibility_api(node_model, node_implementation.base_edid_changed, node_implementation.set_effective_edid, node_implementation.active_constraints_changed, gate));
node_server.api_routers[{ {}, nmos::fields::streamcompatibility_port(node_model.settings) }].mount({}, nmos::experimental::make_streamcompatibility_api(node_model, node_implementation.base_edid_changed, node_implementation.set_effective_edid, node_implementation.active_constraints_changed, validate_authorization ? validate_authorization(nmos::experimental::scopes::streamcompatibility) : nullptr, gate));

const auto& events_ws_port = nmos::fields::events_ws_port(node_model.settings);
auto& events_ws_api = node_server.ws_handlers[{ {}, nmos::fields::events_ws_port(node_model.settings) }];
Expand Down
3 changes: 3 additions & 0 deletions Development/nmos/scope.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ namespace nmos
const scope events{ U("events") };
// IS-08
const scope channelmapping{ U("channelmapping") };
// IS-11
const scope streamcompatibility{ U("streamcompatibility") };
// IS-12
const scope ncp{ U("ncp") };
}
Expand All @@ -42,6 +44,7 @@ namespace nmos
if (scopes::netctrl.name == scope) { return scopes::netctrl; }
if (scopes::events.name == scope) { return scopes::events; }
if (scopes::channelmapping.name == scope) { return scopes::channelmapping; }
if (scopes::streamcompatibility.name == scope) { return scopes::streamcompatibility; }
if (scopes::ncp.name == scope) { return scopes::ncp; }
return{};
}
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ namespace nmos

// is11_versions [node]: used to specify the enabled API versions for a version-locked configuration
const web::json::field_as_array is11_versions{ U("is11_versions") }; // when omitted, nmos::is11_versions::all is used

// is12_versions [node]: used to specify the enabled API versions for a version-locked configuration
const web::json::field_as_array is12_versions{ U("is12_versions") }; // when omitted, nmos::is12_versions::all is used

Expand Down
8 changes: 7 additions & 1 deletion Development/nmos/streamcompatibility_api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ namespace nmos

web::http::experimental::listener::api_router make_unmounted_streamcompatibility_api(nmos::node_model& model, details::streamcompatibility_base_edid_handler base_edid_handler, details::streamcompatibility_effective_edid_setter effective_edid_setter, details::streamcompatibility_active_constraints_handler active_constraints_handler, slog::base_gate& gate);

web::http::experimental::listener::api_router make_streamcompatibility_api(nmos::node_model& model, details::streamcompatibility_base_edid_handler base_edid_handler, details::streamcompatibility_effective_edid_setter effective_edid_setter, details::streamcompatibility_active_constraints_handler active_constraints_handler, slog::base_gate& gate)
web::http::experimental::listener::api_router make_streamcompatibility_api(nmos::node_model& model, details::streamcompatibility_base_edid_handler base_edid_handler, details::streamcompatibility_effective_edid_setter effective_edid_setter, details::streamcompatibility_active_constraints_handler active_constraints_handler, web::http::experimental::listener::route_handler validate_authorization, slog::base_gate& gate)
{
using namespace web::http::experimental::listener::api_router_using_declarations;

Expand All @@ -192,6 +192,12 @@ namespace nmos
return pplx::task_from_result(true);
});

if (validate_authorization)
{
streamcompatibility_api.support(U("/x-nmos/") + nmos::patterns::streamcompatibility_api.pattern + U("/?"), validate_authorization);
streamcompatibility_api.support(U("/x-nmos/") + nmos::patterns::streamcompatibility_api.pattern + U("/.*"), validate_authorization);
}

const auto versions = with_read_lock(model.mutex, [&model] { return nmos::is11_versions::from_settings(model.settings); });
streamcompatibility_api.support(U("/x-nmos/") + nmos::patterns::streamcompatibility_api.pattern + U("/?"), methods::GET, [versions](http_request req, http_response res, const string_t&, const route_parameters&)
{
Expand Down
2 changes: 1 addition & 1 deletion Development/nmos/streamcompatibility_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace nmos
typedef std::function<void(const nmos::id& input_id, boost::variant<utility::string_t, web::uri>& effective_edid)> streamcompatibility_effective_edid_setter;
}

web::http::experimental::listener::api_router make_streamcompatibility_api(nmos::node_model& model, details::streamcompatibility_base_edid_handler base_edid_handler, details::streamcompatibility_effective_edid_setter effective_edid_setter, details::streamcompatibility_active_constraints_handler active_constraints_handler, slog::base_gate& gate);
web::http::experimental::listener::api_router make_streamcompatibility_api(nmos::node_model& model, details::streamcompatibility_base_edid_handler base_edid_handler, details::streamcompatibility_effective_edid_setter effective_edid_setter, details::streamcompatibility_active_constraints_handler active_constraints_handler, web::http::experimental::listener::route_handler validate_authorization, slog::base_gate& gate);
}
}

Expand Down
Loading