xref: /aosp_15_r20/external/openthread/src/cli/README_SRP_CLIENT.md (revision cfb92d1480a9e65faed56933e9c12405f45898b4)
1*cfb92d14SAndroid Build Coastguard Worker# OpenThread CLI - SRP Client
2*cfb92d14SAndroid Build Coastguard Worker
3*cfb92d14SAndroid Build Coastguard Worker## Command List
4*cfb92d14SAndroid Build Coastguard Worker
5*cfb92d14SAndroid Build Coastguard WorkerUsage : `srp client [command] ...`
6*cfb92d14SAndroid Build Coastguard Worker
7*cfb92d14SAndroid Build Coastguard Worker- [help](#help)
8*cfb92d14SAndroid Build Coastguard Worker- [autostart](#autostart)
9*cfb92d14SAndroid Build Coastguard Worker- [callback](#callback)
10*cfb92d14SAndroid Build Coastguard Worker- [host](#host)
11*cfb92d14SAndroid Build Coastguard Worker- [keyleaseinterval](#keyleaseinterval)
12*cfb92d14SAndroid Build Coastguard Worker- [leaseinterval](#leaseinterval)
13*cfb92d14SAndroid Build Coastguard Worker- [server](#server)
14*cfb92d14SAndroid Build Coastguard Worker- [service](#service)
15*cfb92d14SAndroid Build Coastguard Worker- [start](#start)
16*cfb92d14SAndroid Build Coastguard Worker- [state](#state)
17*cfb92d14SAndroid Build Coastguard Worker- [stop](#stop)
18*cfb92d14SAndroid Build Coastguard Worker- [ttl](#ttl)
19*cfb92d14SAndroid Build Coastguard Worker
20*cfb92d14SAndroid Build Coastguard Worker## Command Details
21*cfb92d14SAndroid Build Coastguard Worker
22*cfb92d14SAndroid Build Coastguard Worker### help
23*cfb92d14SAndroid Build Coastguard Worker
24*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client help`
25*cfb92d14SAndroid Build Coastguard Worker
26*cfb92d14SAndroid Build Coastguard WorkerPrint SRP client help menu.
27*cfb92d14SAndroid Build Coastguard Worker
28*cfb92d14SAndroid Build Coastguard Worker```bash
29*cfb92d14SAndroid Build Coastguard Worker> srp client help
30*cfb92d14SAndroid Build Coastguard Workerautostart
31*cfb92d14SAndroid Build Coastguard Workercallback
32*cfb92d14SAndroid Build Coastguard Workerhelp
33*cfb92d14SAndroid Build Coastguard Workerhost
34*cfb92d14SAndroid Build Coastguard Workerkeyleaseinterval
35*cfb92d14SAndroid Build Coastguard Workerleaseinterval
36*cfb92d14SAndroid Build Coastguard Workerservice
37*cfb92d14SAndroid Build Coastguard Workerstart
38*cfb92d14SAndroid Build Coastguard Workerstate
39*cfb92d14SAndroid Build Coastguard Workerstop
40*cfb92d14SAndroid Build Coastguard Workerttl
41*cfb92d14SAndroid Build Coastguard WorkerDone
42*cfb92d14SAndroid Build Coastguard Worker```
43*cfb92d14SAndroid Build Coastguard Worker
44*cfb92d14SAndroid Build Coastguard Worker### autostart
45*cfb92d14SAndroid Build Coastguard Worker
46*cfb92d14SAndroid Build Coastguard WorkerUsage `srp client autostart [enable|disable]`
47*cfb92d14SAndroid Build Coastguard Worker
48*cfb92d14SAndroid Build Coastguard WorkerEnable/Disable auto start mode in SRP client. This command requires `OPENTHREAD_CONFIG_SRP_CLIENT_AUTO_START_API_ENABLE` feature to be enabled.
49*cfb92d14SAndroid Build Coastguard Worker
50*cfb92d14SAndroid Build Coastguard WorkerGet the current autostart mode.
51*cfb92d14SAndroid Build Coastguard Worker
52*cfb92d14SAndroid Build Coastguard Worker```bash
53*cfb92d14SAndroid Build Coastguard Worker> srp client autostart
54*cfb92d14SAndroid Build Coastguard WorkerDisabled
55*cfb92d14SAndroid Build Coastguard WorkerDone
56*cfb92d14SAndroid Build Coastguard Worker```
57*cfb92d14SAndroid Build Coastguard Worker
58*cfb92d14SAndroid Build Coastguard WorkerSet the autostart mode.
59*cfb92d14SAndroid Build Coastguard Worker
60*cfb92d14SAndroid Build Coastguard Worker```bash
61*cfb92d14SAndroid Build Coastguard Worker> srp client autostart enable
62*cfb92d14SAndroid Build Coastguard WorkerDone
63*cfb92d14SAndroid Build Coastguard Worker
64*cfb92d14SAndroid Build Coastguard Worker> srp client autostart
65*cfb92d14SAndroid Build Coastguard WorkerEnabled
66*cfb92d14SAndroid Build Coastguard WorkerDone
67*cfb92d14SAndroid Build Coastguard Worker```
68*cfb92d14SAndroid Build Coastguard Worker
69*cfb92d14SAndroid Build Coastguard Worker### callback
70*cfb92d14SAndroid Build Coastguard Worker
71*cfb92d14SAndroid Build Coastguard WorkerUsage `srp client callback [enable|disable]`
72*cfb92d14SAndroid Build Coastguard Worker
73*cfb92d14SAndroid Build Coastguard WorkerEnable/Disable printing callback events from SRP client.
74*cfb92d14SAndroid Build Coastguard Worker
75*cfb92d14SAndroid Build Coastguard WorkerGet current callback mode
76*cfb92d14SAndroid Build Coastguard Worker
77*cfb92d14SAndroid Build Coastguard Worker```bash
78*cfb92d14SAndroid Build Coastguard Worker> srp client callback
79*cfb92d14SAndroid Build Coastguard WorkerDisabled
80*cfb92d14SAndroid Build Coastguard WorkerDone
81*cfb92d14SAndroid Build Coastguard Worker```
82*cfb92d14SAndroid Build Coastguard Worker
83*cfb92d14SAndroid Build Coastguard WorkerSet callback mode
84*cfb92d14SAndroid Build Coastguard Worker
85*cfb92d14SAndroid Build Coastguard Worker```bash
86*cfb92d14SAndroid Build Coastguard Worker> srp client callback enable
87*cfb92d14SAndroid Build Coastguard WorkerDone
88*cfb92d14SAndroid Build Coastguard Worker
89*cfb92d14SAndroid Build Coastguard Worker> srp client callback
90*cfb92d14SAndroid Build Coastguard WorkerEnabled
91*cfb92d14SAndroid Build Coastguard WorkerDone
92*cfb92d14SAndroid Build Coastguard Worker```
93*cfb92d14SAndroid Build Coastguard Worker
94*cfb92d14SAndroid Build Coastguard Worker#### Example
95*cfb92d14SAndroid Build Coastguard Worker
96*cfb92d14SAndroid Build Coastguard WorkerWhen two services are successfully registered:
97*cfb92d14SAndroid Build Coastguard Worker
98*cfb92d14SAndroid Build Coastguard Worker```bash
99*cfb92d14SAndroid Build Coastguard WorkerSRP client callback - error:OK
100*cfb92d14SAndroid Build Coastguard WorkerHost info:
101*cfb92d14SAndroid Build Coastguard Worker    name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
102*cfb92d14SAndroid Build Coastguard WorkerService list:
103*cfb92d14SAndroid Build Coastguard Worker    instance:"ins2", name:"_test2._udp", state:Registered, port:111, priority:1, weight:1
104*cfb92d14SAndroid Build Coastguard Worker    instance:"ins1", name:"_test1._udp,_sub1,_sub2", state:Registered, port:777, priority:0, weight:0
105*cfb92d14SAndroid Build Coastguard Worker```
106*cfb92d14SAndroid Build Coastguard Worker
107*cfb92d14SAndroid Build Coastguard WorkerWhen service `ins2` is removed:
108*cfb92d14SAndroid Build Coastguard Worker
109*cfb92d14SAndroid Build Coastguard Worker```bash
110*cfb92d14SAndroid Build Coastguard WorkerSRP client callback - error:OK
111*cfb92d14SAndroid Build Coastguard WorkerHost info:
112*cfb92d14SAndroid Build Coastguard Worker    name:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1]
113*cfb92d14SAndroid Build Coastguard WorkerService list:
114*cfb92d14SAndroid Build Coastguard Worker    instance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
115*cfb92d14SAndroid Build Coastguard WorkerRemoved service list:
116*cfb92d14SAndroid Build Coastguard Worker    instance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Removed, port:111, priority:1, weight:1
117*cfb92d14SAndroid Build Coastguard Worker```
118*cfb92d14SAndroid Build Coastguard Worker
119*cfb92d14SAndroid Build Coastguard WorkerWhen host info (and all services) is removed:
120*cfb92d14SAndroid Build Coastguard Worker
121*cfb92d14SAndroid Build Coastguard Worker```bash
122*cfb92d14SAndroid Build Coastguard WorkerSRP client callback - error:OK
123*cfb92d14SAndroid Build Coastguard WorkerHost info:
124*cfb92d14SAndroid Build Coastguard Worker    name:"dev4312", state:Removed, addrs:[fd00:0:0:0:0:0:0:1]
125*cfb92d14SAndroid Build Coastguard WorkerService list:
126*cfb92d14SAndroid Build Coastguard WorkerRemoved service list:
127*cfb92d14SAndroid Build Coastguard Worker    instance:"ins1", name:"_test1._udp", state:Removed, port:777, priority:0, weight:0
128*cfb92d14SAndroid Build Coastguard Worker```
129*cfb92d14SAndroid Build Coastguard Worker
130*cfb92d14SAndroid Build Coastguard Worker### host
131*cfb92d14SAndroid Build Coastguard Worker
132*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client host`
133*cfb92d14SAndroid Build Coastguard Worker
134*cfb92d14SAndroid Build Coastguard WorkerPrint the full host info (host name, state, list of host addresses).
135*cfb92d14SAndroid Build Coastguard Worker
136*cfb92d14SAndroid Build Coastguard Worker```bash
137*cfb92d14SAndroid Build Coastguard Worker> srp client host
138*cfb92d14SAndroid Build Coastguard Workername:"dev4312", state:Registered, addrs:[fd00:0:0:0:0:0:0:1234, fd00:0:0:0:0:0:0:beef]
139*cfb92d14SAndroid Build Coastguard WorkerDone
140*cfb92d14SAndroid Build Coastguard Worker```
141*cfb92d14SAndroid Build Coastguard Worker
142*cfb92d14SAndroid Build Coastguard WorkerWhen auto host address mode is enabled.
143*cfb92d14SAndroid Build Coastguard Worker
144*cfb92d14SAndroid Build Coastguard Worker```bash
145*cfb92d14SAndroid Build Coastguard Workersrp client host
146*cfb92d14SAndroid Build Coastguard Workername:"dev1234", state:Registered, addrs:auto
147*cfb92d14SAndroid Build Coastguard WorkerDone
148*cfb92d14SAndroid Build Coastguard Worker```
149*cfb92d14SAndroid Build Coastguard Worker
150*cfb92d14SAndroid Build Coastguard Worker### host name
151*cfb92d14SAndroid Build Coastguard Worker
152*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client host name [name]`
153*cfb92d14SAndroid Build Coastguard Worker
154*cfb92d14SAndroid Build Coastguard WorkerGet the host name.
155*cfb92d14SAndroid Build Coastguard Worker
156*cfb92d14SAndroid Build Coastguard Worker```bash
157*cfb92d14SAndroid Build Coastguard Worker> srp client host name
158*cfb92d14SAndroid Build Coastguard Workerdev4312
159*cfb92d14SAndroid Build Coastguard WorkerDone
160*cfb92d14SAndroid Build Coastguard Worker```
161*cfb92d14SAndroid Build Coastguard Worker
162*cfb92d14SAndroid Build Coastguard WorkerSet host name (can be set when the host is removed or not yet registered with server).
163*cfb92d14SAndroid Build Coastguard Worker
164*cfb92d14SAndroid Build Coastguard Worker```bash
165*cfb92d14SAndroid Build Coastguard Workersrp client host name dev4312
166*cfb92d14SAndroid Build Coastguard WorkerDone
167*cfb92d14SAndroid Build Coastguard Worker```
168*cfb92d14SAndroid Build Coastguard Worker
169*cfb92d14SAndroid Build Coastguard Worker### host address
170*cfb92d14SAndroid Build Coastguard Worker
171*cfb92d14SAndroid Build Coastguard WorkerUsage : `srp client host address [auto | <address> ...]`
172*cfb92d14SAndroid Build Coastguard Worker
173*cfb92d14SAndroid Build Coastguard WorkerIndicate auto address mode is enabled.
174*cfb92d14SAndroid Build Coastguard Worker
175*cfb92d14SAndroid Build Coastguard Worker```bash
176*cfb92d14SAndroid Build Coastguard Worker> srp client host address
177*cfb92d14SAndroid Build Coastguard Workerauto
178*cfb92d14SAndroid Build Coastguard WorkerDone
179*cfb92d14SAndroid Build Coastguard Worker```
180*cfb92d14SAndroid Build Coastguard Worker
181*cfb92d14SAndroid Build Coastguard WorkerGet the list of host addresses (when auto host address is not enabled).
182*cfb92d14SAndroid Build Coastguard Worker
183*cfb92d14SAndroid Build Coastguard Worker```bash
184*cfb92d14SAndroid Build Coastguard Worker> srp client host address
185*cfb92d14SAndroid Build Coastguard Workerfd00:0:0:0:0:0:0:1234
186*cfb92d14SAndroid Build Coastguard Workerfd00:0:0:0:0:0:0:beef
187*cfb92d14SAndroid Build Coastguard WorkerDone
188*cfb92d14SAndroid Build Coastguard Worker```
189*cfb92d14SAndroid Build Coastguard Worker
190*cfb92d14SAndroid Build Coastguard WorkerEnable auto host address mode. When enabled client will automatically use all preferred Thread netif unicast addresses excluding all link-local and mesh-local addresses. If there is no preferred address, then Mesh Local EID address is added. SRP client will automatically re-register if/when addresses on Thread netif get changed (e.g., new address is added or existing address is removed or marked as non-preferred).
191*cfb92d14SAndroid Build Coastguard Worker
192*cfb92d14SAndroid Build Coastguard Worker```bash
193*cfb92d14SAndroid Build Coastguard Worker> srp client host address auto
194*cfb92d14SAndroid Build Coastguard WorkerDone
195*cfb92d14SAndroid Build Coastguard Worker```
196*cfb92d14SAndroid Build Coastguard Worker
197*cfb92d14SAndroid Build Coastguard WorkerExplicitly set the list of host addresses (can be set while client is running to update the host addresses), also disabled auto host address mode.
198*cfb92d14SAndroid Build Coastguard Worker
199*cfb92d14SAndroid Build Coastguard Worker```bash
200*cfb92d14SAndroid Build Coastguard Worker> srp client host address fd00::cafe
201*cfb92d14SAndroid Build Coastguard WorkerDone
202*cfb92d14SAndroid Build Coastguard Worker```
203*cfb92d14SAndroid Build Coastguard Worker
204*cfb92d14SAndroid Build Coastguard Worker### host state
205*cfb92d14SAndroid Build Coastguard Worker
206*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client host state`
207*cfb92d14SAndroid Build Coastguard Worker
208*cfb92d14SAndroid Build Coastguard WorkerGet the host state.
209*cfb92d14SAndroid Build Coastguard Worker
210*cfb92d14SAndroid Build Coastguard Worker```bash
211*cfb92d14SAndroid Build Coastguard Worker> srp client host state
212*cfb92d14SAndroid Build Coastguard WorkerRegistered
213*cfb92d14SAndroid Build Coastguard WorkerDone
214*cfb92d14SAndroid Build Coastguard Worker```
215*cfb92d14SAndroid Build Coastguard Worker
216*cfb92d14SAndroid Build Coastguard WorkerThe possible states are (same value for service state):
217*cfb92d14SAndroid Build Coastguard Worker
218*cfb92d14SAndroid Build Coastguard Worker- `ToAdd`: item to be added/registered.
219*cfb92d14SAndroid Build Coastguard Worker- `Adding`: item is being added/registered.
220*cfb92d14SAndroid Build Coastguard Worker- `ToRefresh`: item to be refreshed (renew lease).
221*cfb92d14SAndroid Build Coastguard Worker- `Refreshing`: item is being refreshed.
222*cfb92d14SAndroid Build Coastguard Worker- `ToRemove`: item to be removed.
223*cfb92d14SAndroid Build Coastguard Worker- `Removing`: item is being removed.
224*cfb92d14SAndroid Build Coastguard Worker- `Registered`: item is registered with server.
225*cfb92d14SAndroid Build Coastguard Worker- `Removed`: item is removed.
226*cfb92d14SAndroid Build Coastguard Worker
227*cfb92d14SAndroid Build Coastguard Worker### host remove
228*cfb92d14SAndroid Build Coastguard Worker
229*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client host remove [removekeylease] [sendunregtoserver]`
230*cfb92d14SAndroid Build Coastguard Worker
231*cfb92d14SAndroid Build Coastguard WorkerRemove host info and all services from server.
232*cfb92d14SAndroid Build Coastguard Worker
233*cfb92d14SAndroid Build Coastguard Worker- `removekeylease` is an optional boolean value indicating whether or not the host key lease should also be removed (default is false).
234*cfb92d14SAndroid Build Coastguard Worker- `sendunregtoserver` is a another optional boolean value indicating whether or not to send an update message to the server when host info is not yet registered (default is false).
235*cfb92d14SAndroid Build Coastguard Worker
236*cfb92d14SAndroid Build Coastguard Worker```bash
237*cfb92d14SAndroid Build Coastguard Worker> srp client host remove 1
238*cfb92d14SAndroid Build Coastguard WorkerDone
239*cfb92d14SAndroid Build Coastguard Worker```
240*cfb92d14SAndroid Build Coastguard Worker
241*cfb92d14SAndroid Build Coastguard Worker### host clear
242*cfb92d14SAndroid Build Coastguard Worker
243*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client host clear`
244*cfb92d14SAndroid Build Coastguard Worker
245*cfb92d14SAndroid Build Coastguard WorkerClear host info and all services on client (unlike `host remove`, with `host clear` no update is sent to server).
246*cfb92d14SAndroid Build Coastguard Worker
247*cfb92d14SAndroid Build Coastguard Worker```bash
248*cfb92d14SAndroid Build Coastguard Worker> srp client host clear
249*cfb92d14SAndroid Build Coastguard WorkerDone
250*cfb92d14SAndroid Build Coastguard Worker```
251*cfb92d14SAndroid Build Coastguard Worker
252*cfb92d14SAndroid Build Coastguard Worker### keyleaseinterval
253*cfb92d14SAndroid Build Coastguard Worker
254*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client keyleaseinterval [interval]`
255*cfb92d14SAndroid Build Coastguard Worker
256*cfb92d14SAndroid Build Coastguard WorkerGet the key lease interval (in seconds).
257*cfb92d14SAndroid Build Coastguard Worker
258*cfb92d14SAndroid Build Coastguard Worker```bash
259*cfb92d14SAndroid Build Coastguard Worker> srp client keyleaseinterval
260*cfb92d14SAndroid Build Coastguard Worker1209600
261*cfb92d14SAndroid Build Coastguard WorkerDone
262*cfb92d14SAndroid Build Coastguard Worker>
263*cfb92d14SAndroid Build Coastguard Worker```
264*cfb92d14SAndroid Build Coastguard Worker
265*cfb92d14SAndroid Build Coastguard WorkerSet the key lease interval.
266*cfb92d14SAndroid Build Coastguard Worker
267*cfb92d14SAndroid Build Coastguard Worker```bash
268*cfb92d14SAndroid Build Coastguard Worker> srp client keyleaseinterval 864000
269*cfb92d14SAndroid Build Coastguard WorkerDone
270*cfb92d14SAndroid Build Coastguard Worker```
271*cfb92d14SAndroid Build Coastguard Worker
272*cfb92d14SAndroid Build Coastguard Worker### leaseinterval
273*cfb92d14SAndroid Build Coastguard Worker
274*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client leaseinterval [interval]`
275*cfb92d14SAndroid Build Coastguard Worker
276*cfb92d14SAndroid Build Coastguard WorkerGet the lease interval (in seconds).
277*cfb92d14SAndroid Build Coastguard Worker
278*cfb92d14SAndroid Build Coastguard Worker```bash
279*cfb92d14SAndroid Build Coastguard Worker> srp client leaseinterval
280*cfb92d14SAndroid Build Coastguard Worker7200
281*cfb92d14SAndroid Build Coastguard WorkerDone
282*cfb92d14SAndroid Build Coastguard Worker>
283*cfb92d14SAndroid Build Coastguard Worker```
284*cfb92d14SAndroid Build Coastguard Worker
285*cfb92d14SAndroid Build Coastguard WorkerSet the lease interval.
286*cfb92d14SAndroid Build Coastguard Worker
287*cfb92d14SAndroid Build Coastguard Worker```bash
288*cfb92d14SAndroid Build Coastguard Worker> srp client leaseinterval 3600
289*cfb92d14SAndroid Build Coastguard WorkerDone
290*cfb92d14SAndroid Build Coastguard Worker```
291*cfb92d14SAndroid Build Coastguard Worker
292*cfb92d14SAndroid Build Coastguard Worker### server
293*cfb92d14SAndroid Build Coastguard Worker
294*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client server`
295*cfb92d14SAndroid Build Coastguard Worker
296*cfb92d14SAndroid Build Coastguard WorkerPrint the server socket address (IPv6 address and port number).
297*cfb92d14SAndroid Build Coastguard Worker
298*cfb92d14SAndroid Build Coastguard Worker```bash
299*cfb92d14SAndroid Build Coastguard Worker> srp client server
300*cfb92d14SAndroid Build Coastguard Worker[fd00:0:0:0:d88a:618b:384d:e760]:4724
301*cfb92d14SAndroid Build Coastguard WorkerDone
302*cfb92d14SAndroid Build Coastguard Worker```
303*cfb92d14SAndroid Build Coastguard Worker
304*cfb92d14SAndroid Build Coastguard Worker### server address
305*cfb92d14SAndroid Build Coastguard Worker
306*cfb92d14SAndroid Build Coastguard WorkerPrint the server IPv6 address.
307*cfb92d14SAndroid Build Coastguard Worker
308*cfb92d14SAndroid Build Coastguard Worker```bash
309*cfb92d14SAndroid Build Coastguard Worker> srp client server address
310*cfb92d14SAndroid Build Coastguard Workerfd00:0:0:0:d88a:618b:384d:e760
311*cfb92d14SAndroid Build Coastguard WorkerDone
312*cfb92d14SAndroid Build Coastguard Worker```
313*cfb92d14SAndroid Build Coastguard Worker
314*cfb92d14SAndroid Build Coastguard Worker### server port
315*cfb92d14SAndroid Build Coastguard Worker
316*cfb92d14SAndroid Build Coastguard WorkerPrint the server port number
317*cfb92d14SAndroid Build Coastguard Worker
318*cfb92d14SAndroid Build Coastguard Worker```bash
319*cfb92d14SAndroid Build Coastguard Worker> srp client server port
320*cfb92d14SAndroid Build Coastguard Worker4724
321*cfb92d14SAndroid Build Coastguard WorkerDone
322*cfb92d14SAndroid Build Coastguard Worker```
323*cfb92d14SAndroid Build Coastguard Worker
324*cfb92d14SAndroid Build Coastguard Worker### service
325*cfb92d14SAndroid Build Coastguard Worker
326*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client service`
327*cfb92d14SAndroid Build Coastguard Worker
328*cfb92d14SAndroid Build Coastguard WorkerPrint the list of services.
329*cfb92d14SAndroid Build Coastguard Worker
330*cfb92d14SAndroid Build Coastguard Worker```bash
331*cfb92d14SAndroid Build Coastguard Worker> srp client service
332*cfb92d14SAndroid Build Coastguard Workerinstance:"ins2", name:"_test2._udp,_sub1,_sub2", state:Registered, port:111, priority:1, weight:1
333*cfb92d14SAndroid Build Coastguard Workerinstance:"ins1", name:"_test1._udp", state:Registered, port:777, priority:0, weight:0
334*cfb92d14SAndroid Build Coastguard WorkerDone
335*cfb92d14SAndroid Build Coastguard Worker```
336*cfb92d14SAndroid Build Coastguard Worker
337*cfb92d14SAndroid Build Coastguard Worker### service add
338*cfb92d14SAndroid Build Coastguard Worker
339*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client service add <instancename> <servicename> <port> [priority] [weight] [txt]`
340*cfb92d14SAndroid Build Coastguard Worker
341*cfb92d14SAndroid Build Coastguard WorkerAdd a service with a given instance name, service name, port number, priority, weight and txt values.
342*cfb92d14SAndroid Build Coastguard Worker
343*cfb92d14SAndroid Build Coastguard WorkerThe `<servicename>` can optionally include a list of service subtype labels separated by comma.
344*cfb92d14SAndroid Build Coastguard Worker
345*cfb92d14SAndroid Build Coastguard WorkerThe priority and weight are optional and if not provided zero will be used. The txt should follow hex-string format and is treated as an already encoded TXT data byte sequence. It is also optional and if not provided it is considered empty.
346*cfb92d14SAndroid Build Coastguard Worker
347*cfb92d14SAndroid Build Coastguard Worker```bash
348*cfb92d14SAndroid Build Coastguard Worker> srp client service add ins1 _test1._udp 777
349*cfb92d14SAndroid Build Coastguard WorkerDone
350*cfb92d14SAndroid Build Coastguard Worker
351*cfb92d14SAndroid Build Coastguard Worker> srp client service add ins2 _test2._udp,_sub1,_sub2 111 1 1
352*cfb92d14SAndroid Build Coastguard WorkerDone
353*cfb92d14SAndroid Build Coastguard Worker```
354*cfb92d14SAndroid Build Coastguard Worker
355*cfb92d14SAndroid Build Coastguard Worker### service remove
356*cfb92d14SAndroid Build Coastguard Worker
357*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client service remove <instancename> <servicename>`
358*cfb92d14SAndroid Build Coastguard Worker
359*cfb92d14SAndroid Build Coastguard WorkerRemove a service with a give instance name and service name.
360*cfb92d14SAndroid Build Coastguard Worker
361*cfb92d14SAndroid Build Coastguard Worker```bash
362*cfb92d14SAndroid Build Coastguard Worker> srp client service remove ins2 _test2._udp
363*cfb92d14SAndroid Build Coastguard WorkerDone
364*cfb92d14SAndroid Build Coastguard Worker```
365*cfb92d14SAndroid Build Coastguard Worker
366*cfb92d14SAndroid Build Coastguard Worker### service clear
367*cfb92d14SAndroid Build Coastguard Worker
368*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client service clear <instancename> <servicename>`
369*cfb92d14SAndroid Build Coastguard Worker
370*cfb92d14SAndroid Build Coastguard WorkerClear a service with a give instance name and service name (unlike `service remove`, with `service clear` no update is sent to server and the entry is immediately removed from client list).
371*cfb92d14SAndroid Build Coastguard Worker
372*cfb92d14SAndroid Build Coastguard Worker```bash
373*cfb92d14SAndroid Build Coastguard Worker> srp client service clear ins2 _test2._udp
374*cfb92d14SAndroid Build Coastguard WorkerDone
375*cfb92d14SAndroid Build Coastguard Worker```
376*cfb92d14SAndroid Build Coastguard Worker
377*cfb92d14SAndroid Build Coastguard Worker### service key
378*cfb92d14SAndroid Build Coastguard Worker
379*cfb92d14SAndroid Build Coastguard WorkerUsage `srp client service key [enable|disable]`
380*cfb92d14SAndroid Build Coastguard Worker
381*cfb92d14SAndroid Build Coastguard WorkerEnable/Disable "service key record inclusion" mode in SRP client. This command requires `OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE` feature to be enabled.
382*cfb92d14SAndroid Build Coastguard Worker
383*cfb92d14SAndroid Build Coastguard WorkerKEY record is optional in Service Description Instruction (it is required and always included in the Host Description Instruction). The default behavior of SRP client is to not include it. This command is intended to override the default behavior for testing only (in a `REFERENCE_DEVICE` build).
384*cfb92d14SAndroid Build Coastguard Worker
385*cfb92d14SAndroid Build Coastguard WorkerGet the current "service key record inclusion" mode.
386*cfb92d14SAndroid Build Coastguard Worker
387*cfb92d14SAndroid Build Coastguard Worker```bash
388*cfb92d14SAndroid Build Coastguard Worker> srp client service key
389*cfb92d14SAndroid Build Coastguard WorkerDisabled
390*cfb92d14SAndroid Build Coastguard WorkerDone
391*cfb92d14SAndroid Build Coastguard Worker```
392*cfb92d14SAndroid Build Coastguard Worker
393*cfb92d14SAndroid Build Coastguard WorkerSet the "service key record inclusion" mode.
394*cfb92d14SAndroid Build Coastguard Worker
395*cfb92d14SAndroid Build Coastguard Worker```bash
396*cfb92d14SAndroid Build Coastguard Worker> srp client service key enable
397*cfb92d14SAndroid Build Coastguard WorkerDone
398*cfb92d14SAndroid Build Coastguard Worker
399*cfb92d14SAndroid Build Coastguard Worker> srp client service key
400*cfb92d14SAndroid Build Coastguard WorkerEnabled
401*cfb92d14SAndroid Build Coastguard WorkerDone
402*cfb92d14SAndroid Build Coastguard Worker```
403*cfb92d14SAndroid Build Coastguard Worker
404*cfb92d14SAndroid Build Coastguard Worker### start
405*cfb92d14SAndroid Build Coastguard Worker
406*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client start <serveraddr> <serverport>`
407*cfb92d14SAndroid Build Coastguard Worker
408*cfb92d14SAndroid Build Coastguard WorkerStart the SRP client with a given server IPv6 address and port number.
409*cfb92d14SAndroid Build Coastguard Worker
410*cfb92d14SAndroid Build Coastguard Worker```bash
411*cfb92d14SAndroid Build Coastguard Worker> srp client start fd00::d88a:618b:384d:e760 4724
412*cfb92d14SAndroid Build Coastguard WorkerDone
413*cfb92d14SAndroid Build Coastguard Worker```
414*cfb92d14SAndroid Build Coastguard Worker
415*cfb92d14SAndroid Build Coastguard Worker### state
416*cfb92d14SAndroid Build Coastguard Worker
417*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client state`
418*cfb92d14SAndroid Build Coastguard Worker
419*cfb92d14SAndroid Build Coastguard WorkerIndicates the state of SRP client, i.e., whether it is enabled or disabled.
420*cfb92d14SAndroid Build Coastguard Worker
421*cfb92d14SAndroid Build Coastguard Worker```bash
422*cfb92d14SAndroid Build Coastguard Worker> srp client state
423*cfb92d14SAndroid Build Coastguard WorkerEnabled
424*cfb92d14SAndroid Build Coastguard WorkerDone
425*cfb92d14SAndroid Build Coastguard Worker```
426*cfb92d14SAndroid Build Coastguard Worker
427*cfb92d14SAndroid Build Coastguard Worker### stop
428*cfb92d14SAndroid Build Coastguard Worker
429*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client stop`
430*cfb92d14SAndroid Build Coastguard Worker
431*cfb92d14SAndroid Build Coastguard WorkerStop the SRP client.
432*cfb92d14SAndroid Build Coastguard Worker
433*cfb92d14SAndroid Build Coastguard Worker```bash
434*cfb92d14SAndroid Build Coastguard Worker> srp client stop
435*cfb92d14SAndroid Build Coastguard WorkerDone
436*cfb92d14SAndroid Build Coastguard Worker```
437*cfb92d14SAndroid Build Coastguard Worker
438*cfb92d14SAndroid Build Coastguard Worker### ttl
439*cfb92d14SAndroid Build Coastguard Worker
440*cfb92d14SAndroid Build Coastguard WorkerUsage: `srp client ttl [value]`
441*cfb92d14SAndroid Build Coastguard Worker
442*cfb92d14SAndroid Build Coastguard WorkerGet the TTL (in seconds).
443*cfb92d14SAndroid Build Coastguard Worker
444*cfb92d14SAndroid Build Coastguard Worker```bash
445*cfb92d14SAndroid Build Coastguard Worker> srp client ttl
446*cfb92d14SAndroid Build Coastguard Worker7200
447*cfb92d14SAndroid Build Coastguard WorkerDone
448*cfb92d14SAndroid Build Coastguard Worker>
449*cfb92d14SAndroid Build Coastguard Worker```
450*cfb92d14SAndroid Build Coastguard Worker
451*cfb92d14SAndroid Build Coastguard WorkerSet the TTL.
452*cfb92d14SAndroid Build Coastguard Worker
453*cfb92d14SAndroid Build Coastguard Worker```bash
454*cfb92d14SAndroid Build Coastguard Worker> srp client ttl 3600
455*cfb92d14SAndroid Build Coastguard WorkerDone
456*cfb92d14SAndroid Build Coastguard Worker```
457