Skip to content
Open
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
145 changes: 145 additions & 0 deletions pandora/sdp.proto
Original file line number Diff line number Diff line change
@@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the RemoveService API and I'm not even sure we need to AddService as well 🤔

// List all registered SDP services
rpc ListAttributes(ListAttributesRequest) returns (ListAttributesResponse);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any use case for this one ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An usage is to avoid handle collision

// Client methods
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to remove the Connect and Disconnect APIs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would them be a problem: if there are multiple SDP connections on the same ACL connection, which one it should go?

// 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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use an enum instead

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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
repeated ServiceAttribute attributes = 1;
map<uint32, 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;
}