forked from sony/nmos-cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmdns_api.h
32 lines (26 loc) · 1.48 KB
/
mdns_api.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef NMOS_MDNS_API_H
#define NMOS_MDNS_API_H
#include "nmos/api_utils.h" // for web::http::experimental::listener::api_router and nmos::route_pattern
#include "nmos/slog.h" // for slog::base_gate and slog::severity, etc.
// This is an experimental extension to expose mDNS Service Discovery via a REST API
namespace nmos
{
struct base_model;
namespace experimental
{
web::http::experimental::listener::api_router make_mdns_api(nmos::base_model& model, slog::base_gate& gate);
namespace patterns
{
// A service type combines a registered service identifier (name) and the protocol, each prepended by an underscore ('_') and separated by a dot ('.')
// For example, the IS-04 service types are "_nmos-query._tcp", "_nmos-registration._tcp" and "_nmos-node._tcp".
// SRVNAME = *(1*DIGIT [HYPHEN]) ALPHA *([HYPHEN] ALNUM)
// See https://tools.ietf.org/html/rfc6335#section-5.1
// "The transport protocol(s) [...] is currently limited to one or more of TCP, UDP, SCTP, and DCCP."
// See https://tools.ietf.org/html/rfc6335#section-8.1.1
const nmos::route_pattern mdnsServiceType = make_route_pattern(U("mdnsServiceType"), U("_([0-9]{1,}-?)*[A-Za-z](-?[A-Za-z0-9])*\\._(tcp|udp|sctp|dccp)"));
// A service (instance) name (regex could be better!)
const nmos::route_pattern mdnsServiceName = make_route_pattern(U("mdnsServiceName"), U(".{1,63}"));
}
}
}
#endif