aboutsummaryrefslogtreecommitdiff
path: root/proto/l2cap.proto
blob: 4aa4422be74392fed032f1bfc0a77833a09822aa (plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
syntax = "proto3";

package bluetooth.l2cap.classic;

import "proto/common.proto";

service L2capClassicModuleFacade {
  rpc FetchConnectionComplete(facade.Empty) returns (stream ConnectionCompleteEvent) {
    // Testing Android Bluetooth stack only. Optional for other stack.
  }
  rpc FetchConnectionClose(facade.Empty) returns (stream ConnectionCloseEvent) {
    // Testing Android Bluetooth stack only. Optional for other stack.
  }
  rpc OpenChannel(OpenChannelRequest) returns (facade.Empty) {}
  rpc CloseChannel(CloseChannelRequest) returns (facade.Empty) {}
  rpc FetchL2capData(facade.Empty) returns (stream L2capPacket) {}
  rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (facade.Empty) {}
  rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (facade.Empty) {}
  rpc SetTrafficPaused(SetTrafficPausedRequest) returns (facade.Empty) {}
  rpc GetChannelQueueDepth(facade.Empty) returns (GetChannelQueueDepthResponse) {
    // Get the buffer size of channel queue end for L2CAP user (how many packets we can buffer
    // before L2CAP user dequeues.
  }
  rpc InitiateConnectionForSecurity(facade.BluetoothAddress) returns (facade.Empty) {}
  rpc FetchSecurityConnectionEvents(facade.Empty) returns (stream LinkSecurityInterfaceCallbackEvent) {}
  rpc SecurityLinkEnsureAuthenticated(facade.BluetoothAddress) returns (facade.Empty) {}
  rpc SecurityLinkHold(facade.BluetoothAddress) returns (facade.Empty) {}
  rpc SecurityLinkDisconnect(facade.BluetoothAddress) returns (facade.Empty) {}
  rpc SecurityLinkRelease(facade.BluetoothAddress) returns (facade.Empty) {}
}

enum LinkSecurityInterfaceCallbackEventType {
  ON_CONNECTED = 0;
  ON_DISCONNECTED = 1;
  ON_AUTHENTICATION_COMPLETE = 2;
  ON_ENCRYPTION_CHANGE = 3;
  ON_READ_REMOTE_VERSION_INFO = 4;
  ON_READ_REMOTE_EXTENDED_FEATURES = 5;
}

message LinkSecurityInterfaceCallbackEvent {
  facade.BluetoothAddress address = 1;
  LinkSecurityInterfaceCallbackEventType event_type = 2;
}

message RegisterChannelRequest {
  uint32 channel = 1;
}

message ConnectionCompleteEvent {
  facade.BluetoothAddress remote = 1;
}

message ConnectionCloseEvent {
  facade.BluetoothAddress remote = 1;
  uint32 reason = 2;
}

enum RetransmissionFlowControlMode {
  BASIC = 0;
  ERTM = 1;
  ERTM_OPTIONAL = 2;
}

message OpenChannelRequest {
  facade.BluetoothAddress remote = 1;
  uint32 psm = 2;
  RetransmissionFlowControlMode mode = 3;
}

message CloseChannelRequest {
  uint32 psm = 1;
}

enum ChannelSignalEventType {
  OPEN = 0;
  CLOSE = 1;
  CONFIGURE = 2;
}

message ChannelSignalEvent {
  uint32 cid = 1;
  ChannelSignalEventType type = 2;
}

enum SendL2capPacketResultType {
  OK = 0;
  BAD_CID = 1;
}

message SendL2capPacketResult {
  SendL2capPacketResultType result_type = 1;
}

message L2capPacket {
  oneof channel_type {
    uint32 psm = 1;
    uint32 fixed_cid = 2;
  }
  bytes payload = 3;
}

message SetEnableDynamicChannelRequest {
  uint32 psm = 1;
  bool enable = 2;
  RetransmissionFlowControlMode retransmission_mode = 3;
}

message DynamicChannelPacket {
  facade.BluetoothAddress remote = 1;
  uint32 psm = 2;
  bytes payload = 3;
}

message SetTrafficPausedRequest {
  bool paused = 1;
  uint32 psm = 2;
}

message GetChannelQueueDepthResponse {
  uint32 size = 1;
}

enum ClassicSecurityPolicy {
  ENCRYPTED_TRANSPORT = 0;
  AUTHENTICATED_ENCRYPTED_TRANSPORT = 1;
  BEST = 2;
  _SDP_ONLY_NO_SECURITY_WHATSOEVER_PLAINTEXT_TRANSPORT_OK = 3;
}