diff --git a/pandora/sdp.proto b/pandora/sdp.proto new file mode 100644 index 0000000..11706aa --- /dev/null +++ b/pandora/sdp.proto @@ -0,0 +1,145 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +option java_outer_classname = "SDPProto"; + +package pandora.sdp; + +import "google/protobuf/empty.proto"; +import "google/protobuf/any.proto"; +import "pandora/host.proto"; + +service SDP { + // Server methods + // Register an SDP service + rpc AddService(AddServiceRequest) returns (google.protobuf.Empty); + // Remove an SDP service + rpc RemoveService(RemoveServiceRequest) returns (google.protobuf.Empty); + // List all registered SDP services + rpc ListAttributes(ListAttributesRequest) returns (ListAttributesResponse); + // Client methods + // Connect an SDP protocol channel + rpc Connect(ConnectionRequest) returns (ConnectionResponse); + // Disconnect an SDP protocol channel + rpc Disconnect(DisconnectionRequest) returns (google.protobuf.Empty); + // Core Specification v5.2 Vol. 3 Part B Section 4.5 + rpc ServiceSearch(ServiceSearchRequest) returns (ServiceSearchResponse); + // Core Specification v5.2 Vol. 3 Part B Section 4.6 + rpc ServiceAttribute(ServiceAttributeRequest) + returns (ServiceAttributeResponse); + // Core Specification v5.2 Vol. 3 Part B Section 4.7 + rpc ServiceSearchAttribute(ServiceSearchAttributeRequest) + returns (ServiceSearchAttributeResponse); +} + +message Channel { + google.protobuf.Any cookie = 1; +} + +message DataElementSequence { + repeated DataElement elements = 1; +} + +message DataElement { + uint32 size = 1; + oneof type { + google.protobuf.Empty nil = 2; + uint32 unsigned_integer = 3; + int32 signed_integer = 4; + string uuid = 5; + string text_string = 6; + bool boolean = 7; + DataElementSequence sequence = 8; + DataElementSequence alternative = 9; + } +} + +message ServiceAttribute { + uint32 id = 1; + DataElement value = 2; +} + +message ConnectionRequest { + Connection connection = 1; +} + +message ConnectionResponse { + oneof result { + Channel channel = 1; + google.protobuf.Empty connection_failed = 2; + } +} + +message DisconnectionRequest { + Channel channel = 1; +} + +message AddServiceRequest { + uint32 service_record_handle = 1; + repeated ServiceAttribute attributes_in_service = 2; +} + +message RemoveServiceRequest { + uint32 service_record_handle = 1; +} + +message ListAttributesRequest {} + +message ListAttributesResponse { + repeated ServiceAttribute attributes = 1; +} + +message ServiceSearchRequest { + Channel channel = 1; + // A list of UUID to search for + repeated string service_search_pattern = 2; +} + +message ServiceSearchResponse { + repeated uint32 service_record_handles = 1; +} + +message ServiceAttributeRequest { + Channel channel = 1; + uint32 service_record_handle = 2; + // Must set either attribute_ids or attribute_id_ranges + // Each element represents an attribute ID (Only 16-bit meaningful) + repeated uint32 attribute_ids = 3; + // Must have even size. + // Each pair represents (range_begin(16-bit), range_end(16-bit)) + repeated uint32 attribute_id_ranges = 4; +} + +message ServiceAttributeResponse { + repeated ServiceAttribute attributes = 1; +} + +message ServiceSearchAttributeRequest { + Channel channel = 1; + uint32 service_record_handle = 2; + // A list of UUID to search for + repeated string service_search_pattern = 3; + // Must set either + // Each element represents an attribute ID (16-bit meaningful) + repeated uint32 attribute_ids = 4; + // Each item represents (range_begin(16-bit), range_end(16-bit)) + // (32-bit meaningful) + repeated uint32 attribute_id_ranges = 5; +} + +message ServiceSearchAttributeResponse { + repeated ServiceAttribute attributes = 1; +}