Skip to content

Commit

Permalink
Add stub implementations of RegisterServer and RegisterServer2
Browse files Browse the repository at this point in the history
  • Loading branch information
locka99 committed Jun 11, 2020
1 parent cfc398a commit 9f074b3
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 0 deletions.
12 changes: 12 additions & 0 deletions core/src/supported_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ impl SupportedMessage {
SupportedMessage::GetEndpointsRequest(_) => true,
SupportedMessage::FindServersRequest(_) => true,
SupportedMessage::RegisterServerRequest(_) => true,
SupportedMessage::RegisterServer2Request(_) => true,
SupportedMessage::CreateSessionRequest(_) => true,
SupportedMessage::CloseSessionRequest(_) => true,
SupportedMessage::CancelRequest(_) => true,
Expand Down Expand Up @@ -146,6 +147,7 @@ impl SupportedMessage {
SupportedMessage::GetEndpointsRequest(r) => &r.request_header,
SupportedMessage::FindServersRequest(r) => &r.request_header,
SupportedMessage::RegisterServerRequest(r) => &r.request_header,
SupportedMessage::RegisterServer2Request(r) => &r.request_header,
SupportedMessage::CreateSessionRequest(r) => &r.request_header,
SupportedMessage::CloseSessionRequest(r) => &r.request_header,
SupportedMessage::CancelRequest(r) => &r.request_header,
Expand Down Expand Up @@ -187,6 +189,7 @@ impl SupportedMessage {
SupportedMessage::GetEndpointsResponse(_) => true,
SupportedMessage::FindServersResponse(_) => true,
SupportedMessage::RegisterServerResponse(_) => true,
SupportedMessage::RegisterServer2Response(_) => true,
SupportedMessage::CreateSessionResponse(_) => true,
SupportedMessage::CloseSessionResponse(_) => true,
SupportedMessage::CancelResponse(_) => true,
Expand Down Expand Up @@ -228,6 +231,7 @@ impl SupportedMessage {
SupportedMessage::GetEndpointsResponse(r) => &r.response_header,
SupportedMessage::FindServersResponse(r) => &r.response_header,
SupportedMessage::RegisterServerResponse(r) => &r.response_header,
SupportedMessage::RegisterServer2Response(r) => &r.response_header,
SupportedMessage::CreateSessionResponse(r) => &r.response_header,
SupportedMessage::CloseSessionResponse(r) => &r.response_header,
SupportedMessage::CancelResponse(r) => &r.response_header,
Expand Down Expand Up @@ -298,6 +302,12 @@ impl SupportedMessage {
ObjectId::RegisterServerResponse_Encoding_DefaultBinary => {
RegisterServerResponse::decode(stream, decoding_limits)?.into()
}
ObjectId::RegisterServer2Request_Encoding_DefaultBinary => {
RegisterServer2Request::decode(stream, decoding_limits)?.into()
}
ObjectId::RegisterServer2Response_Encoding_DefaultBinary => {
RegisterServer2Response::decode(stream, decoding_limits)?.into()
}
ObjectId::CreateSessionRequest_Encoding_DefaultBinary => {
CreateSessionRequest::decode(stream, decoding_limits)?.into()
}
Expand Down Expand Up @@ -500,6 +510,8 @@ supported_messages_enum![
FindServersResponse,
RegisterServerRequest,
RegisterServerResponse,
RegisterServer2Request,
RegisterServer2Response,
CreateSessionRequest,
CreateSessionResponse,
CloseSessionRequest,
Expand Down
3 changes: 3 additions & 0 deletions docs/compatibility.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The following services are supported in the server:

* Discovery service set
* GetEndpoints
* FindServers - stub that returns BadNotSupported
* RegisterServer - stub that returns BadNotSupported
* RegisterServer2 - stub that returns BadNotSupported

* Attribute service set
* Read
Expand Down
8 changes: 8 additions & 0 deletions server/src/services/discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ impl DiscoveryService {
}.into()
}

pub fn register_server(&self, _server_state: Arc<RwLock<ServerState>>, request: &RegisterServerRequest) -> SupportedMessage {
self.service_fault(&request.request_header, StatusCode::BadNotSupported)
}

pub fn register_server2(&self, _server_state: Arc<RwLock<ServerState>>, request: &RegisterServer2Request) -> SupportedMessage {
self.service_fault(&request.request_header, StatusCode::BadNotSupported)
}

pub fn find_servers(&self, _server_state: Arc<RwLock<ServerState>>, request: &FindServersRequest) -> SupportedMessage {
self.service_fault(&request.request_header, StatusCode::BadNotSupported)
}
Expand Down
9 changes: 9 additions & 0 deletions server/src/services/message_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ impl MessageHandler {
SupportedMessage::GetEndpointsRequest(request) => {
Some(self.discovery_service.get_endpoints(server_state, request))
}

SupportedMessage::RegisterServerRequest(request) => {
Some(self.discovery_service.register_server(server_state, request))
}

SupportedMessage::RegisterServer2Request(request) => {
Some(self.discovery_service.register_server2(server_state, request))
}

SupportedMessage::FindServersRequest(request) => {
Some(self.discovery_service.find_servers(server_state, request))
}
Expand Down
1 change: 1 addition & 0 deletions tools/schema/gen_supported_message.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ generate_supported_message([
"GetEndpointsRequest", "GetEndpointsResponse",
"FindServersRequest", "FindServersResponse",
"RegisterServerRequest", "RegisterServerResponse",
"RegisterServer2Request", "RegisterServer2Response",
// Session service
"CreateSessionRequest", "CreateSessionResponse",
"CloseSessionRequest", "CloseSessionResponse",
Expand Down

0 comments on commit 9f074b3

Please sign in to comment.