~ubuntu-branches/ubuntu/saucy/nut/saucy

« back to all changes in this revision

Viewing changes to docs/protocol.txt

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2005-07-20 19:48:50 UTC
  • mto: (16.1.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20050720194850-oo61wjr33rrx2mre
Tags: upstream-2.0.2
ImportĀ upstreamĀ versionĀ 2.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Desc: Network protocol info
2
2
File: protocol.txt
3
 
Date: 14 July 2003
 
3
Date: 18 February 2004
4
4
Auth: Russell Kroll <rkroll@exploits.org>
5
5
 
6
 
This protocol primarily runs over TCP, but there is some lingering
7
 
support for UDP.  UDP support may be removed completely if there is no
8
 
interest.  All clients shipped with the package use upsclient and
9
 
therefore TCP exclusively.
10
 
 
11
6
As of May 2002, this protocol now has an official port number from IANA,
12
7
which is 3493.  The old number (3305) was a relic of the original code's
13
8
ancestry, and conflicted with other services.  Version 0.50.0 and up
14
9
use 3493 by default.
15
10
 
16
 
============================================================================
17
 
New commands (April 2003)
18
 
============================================================================
19
 
 
20
 
These commands were added to support the new long variable names.  They
21
 
do not recognize the older names, and will not perform any sort of
22
 
"mapping".  If you need to do something with an old variable name, use
23
 
the older commands below.
24
 
 
25
 
The big difference to note here is that the notion of "@upsname" is
26
 
gone.  The upsname is now a required part of many commands, and there is
27
 
no "default" UPS for any of these new commands.  This was done to remove
28
 
ambiguity and to clean up a lot of ugly code in the server.
 
11
This protocol runs over TCP.  UDP support was dropped in July 2003.  It
 
12
had been deprecated for some time and was only capable of the simplest
 
13
query commands as authentication is impossible over a UDP socket.
 
14
 
 
15
Old command removal notice
 
16
==========================
 
17
 
 
18
Before version 1.5.0, a number of old commands were supported.  These
 
19
have been removed from the specification.  For more information, consult
 
20
an older version of the software.
 
21
 
 
22
Command reference
 
23
=================
29
24
 
30
25
Multi-word elements are contained within "quotes" for easier parsing.  
31
26
Embedded quotes are escaped with backslashes.  Embedded backslashes are
35
30
GET
36
31
===
37
32
 
38
 
Retrieve a single response from the server.  This is the only new
39
 
command which will work over UDP.
 
33
Retrieve a single response from the server.
40
34
 
41
35
Possible sub-commands:
42
36
 
247
241
Note: this does not support the old "SELECTED" notation.  You must
248
242
request the current value separately.
249
243
 
250
 
============================================================================
251
 
Reworked commands
252
 
============================================================================
253
 
 
254
 
These commands have new argument sets that work with the new variable
255
 
names.  Their older counterparts still exist, and will be used when
256
 
necessary for compatibility.
257
 
 
258
244
SET
259
245
---
260
246
 
267
253
   Form: INSTCMD <upsname> <cmdname>
268
254
         INSTCMD su700 test.panel.start
269
255
 
270
 
============================================================================
271
 
Older commands
272
 
============================================================================
273
 
 
274
 
These commands continue to be supported for backwards compatibility.
275
 
While the drivers are actually using the newer variable names
276
 
("ups.status" instead of STATUS), upsd will internally convert when
277
 
necessary.
278
 
 
279
 
The commands which use the old variable names will be going away after
280
 
the 1.x series, so you should upgrade any clients that are using them.
281
 
 
282
 
LISTVARS
283
 
========
284
 
 
285
 
Form: LISTVARS [<upsname>]
286
 
 
287
 
upsname is an identifier given to a UPS on a host.  These are specified
288
 
in the ups.conf.  If it is not specified, the server will refer to the
289
 
first entry from that file.
290
 
 
291
 
Returns: VARS <varlist>
292
 
Returns: VARS @<upsname> <varlist>      (when upsname specified)
293
 
 
294
 
<varlist> is a space delimited list of all possible variables that
295
 
the server process knows about for this UPS.
296
 
 
297
 
Requires: MONITOR access
298
 
 
299
 
* Obsolete: switch to "LIST VAR".
300
 
 
301
 
REQ
302
 
===
303
 
 
304
 
Form: REQ <varname>[@<upsname>]
305
 
 
306
 
<varname> is a variable name returned by LISTVARS or a reserved word:
307
 
 
308
 
 - Reserved words:
309
 
 
310
 
   NUMLOGINS - Number of systems currently monitoring this UPS
311
 
               (incremented by LOGIN commands from authorized clients)
312
 
 
313
 
<upsname> is an identifier as seen above with LISTVARS.
314
 
 
315
 
Returns: ANS <varname> <value>
316
 
Returns: ANS <varname>@<upsname> <value>        (when upsname specified)
317
 
 
318
 
<varname> is the variable you requested, repeated just to be sure
319
 
 
320
 
<value> is the current value as the server knows it
321
 
 
322
 
*** Old versions of upsd also have a few special responses for <value>:
323
 
 
324
 
 UNKNOWN
325
 
  - upsd doesn't recognize this variable.  
326
 
    Replaced with "ERR VAR-UNKNOWN".
327
 
 
328
 
 NOT-SUPPORTED
329
 
  - this UPS driver doesn't gather data for this variable
330
 
    Replaced with "ERR VAR-NOT-SUPPORTED".
331
 
   
332
 
 DATA-STALE
333
 
  - the server hasn't gotten an update for this data recently
334
 
    Replaced with "ERR DATA-STALE".
335
 
 
336
 
Requires: MONITOR access
337
 
 
338
 
* Obsolete: switch to "GET VAR".
339
 
 
340
 
LISTRW
341
 
======
342
 
 
343
 
Form: LISTRW [<upsname>]
344
 
 
345
 
Returns: RW <read-write variable list>
346
 
         RW @<upsname> <read-write variable list> (when upsname specified)
347
 
 
348
 
Requires: MONITOR access
349
 
 
350
 
Lists all variables that allow modification of their values within the
351
 
driver.
352
 
 
353
 
* Obsolete - switch to "LIST RW".
354
 
 
355
 
VARTYPE
356
 
=======
357
 
 
358
 
Form: VARTYPE <varname>[@<upsname>]
359
 
 
360
 
Returns: TYPE <vartype> <extravalue>
361
 
 
362
 
Requires: MONITOR access
363
 
 
364
 
<vartype> is one of ENUM or STRING.
365
 
 
366
 
ENUM: Enumerated type, <extravalue> is how many possibilities exist
367
 
STRING: Character string, <extravalue> is how long it may be
368
 
 
369
 
Lists the type of a read-write variable.
370
 
 
371
 
* Obsolete - switch to "GET TYPE".
372
 
 
373
 
VARDESC
374
 
=======
375
 
 
376
 
Form: VARDESC <varname>
377
 
 
378
 
Returns: DESC "<variable description>"
379
 
 
380
 
Requires: MONITOR access
381
 
 
382
 
<variable description> is a short explanation of what a variable means.
383
 
 
384
 
* Obsolete - switch to "GET DESC".
385
 
 
386
 
ENUM
387
 
====
388
 
 
389
 
Form: ENUM <varname>[@<upsname>]
390
 
 
391
 
Returns: multi-line return:
392
 
 
393
 
ENUM <varname>
394
 
OPTION "<optval>" [SELECTED]            may repeat multiple times
395
 
END
396
 
 
397
 
Requires: MONITOR access
398
 
 
399
 
<optval> is a valid option for <varname>.  SELECTED will be included if
400
 
<varname> is currently set to <optval> in the hardware.
401
 
 
402
 
Shows the possible values for an enumerated type R/W variable.
403
 
 
404
 
* Obsolete - switch to "LIST ENUM".
405
 
 
406
 
INSTCMD
407
 
=======
408
 
 
409
 
Form: INSTCMD <command>[@<upsname>]
410
 
 
411
 
Requires: "INSTCMD" action granted in upsd.users
412
 
          "<command>" instcmd granted in upsd.users
413
 
 
414
 
<command> is an instant command name.  See LISTINSTCMD and shared.h.
415
 
 
416
 
* Obsolete - switch to new form: "INSTCMD <upsname> <cmdname>"
417
 
 
418
 
LISTINSTCMD
419
 
===========
420
 
 
421
 
Form: LISTINSTCMD [<upsname>]
422
 
 
423
 
Returns: INSTCMDS [@<upsname>] <cmd1> <cmd2> ... <cmdn>
424
 
 
425
 
Requires: MONITOR access
426
 
 
427
 
Shows all the instant commands available on a given UPS.
428
 
 
429
 
* Obsolete - switch to "LIST CMD"
430
 
 
431
 
INSTCMDDESC
432
 
===========
433
 
 
434
 
Form: INSTCMDDESC <cmdname>
435
 
 
436
 
Requires: MONITOR access
437
 
 
438
 
Returns: DESC "<description>"
439
 
 
440
 
Shows the description for a given instant command suitable for showing
441
 
to users.
442
 
 
443
 
* Obsolete - switch to "LIST CMDDESC"
444
 
 
445
 
SET
446
 
===
447
 
 
448
 
Form: SET <varname>[@upsname] <value>
449
 
 
450
 
<value> is an acceptable sequence for the variable <varname>.
451
 
 
452
 
Requires: "SET" action granted in upsd.users
453
 
 
454
 
Sets the R/W variable <varname> to <value>, assuming it is allowed.
455
 
 
456
 
* Obsolete - switch to new form: "SET VAR <upsname> <varname> <value>".
457
 
 
458
 
============================================================================
459
 
Unchanged commands
460
 
============================================================================
461
 
 
462
 
These commands are not affected by the variable name change.
463
 
 
464
256
LOGOUT
465
257
======
466
258
 
468
260
 
469
261
Returns: OK Goodbye     (recent versions)
470
262
 
471
 
TCP mode only.  Used to disconnect gracefully from the server.
 
263
Used to disconnect gracefully from the server.
472
264
 
473
265
Older versions just said "Goodbye...".
474
266
 
534
326
Returns: OK     (upon success)
535
327
         or various errors
536
328
 
537
 
Requires: BASE or higher access
538
 
 
539
329
Sets the password associated with a connection.  Used for later
540
330
authentication for commands that require it.
541
331
 
547
337
Returns: OK     (upon success)
548
338
         or various errors
549
339
 
550
 
Requires: BASE or higher access
551
 
 
552
340
Sets the username associated with a connection.  This is also used for
553
341
authentication, specifically in conjunction with the upsd.users file.
554
342
 
557
345
 
558
346
Form: STARTTLS
559
347
 
560
 
Requires: TCP connection (impossible over UDP)
561
 
 
562
348
Returns: OK STARTTLS
563
349
         or various errors
564
350
 
573
359
VER  - shows the version of the server currently in use
574
360
 
575
361
These two are not intended to be used directly by programs.  Humans can
576
 
make use of this program by using telnet for TCP or netcat for UDP.  Try
577
 
either "telnet localhost 3493" for TCP or "nc -u localhost 3493" for UDP
578
 
and it should talk to you.
 
362
make use of this program by using telnet or netcat.  If you use
 
363
telnet, make sure you don't have it set to negotiate extra options.
 
364
upsd doesn't speak telnet and will probably misunderstand your first
 
365
request due to the extra junk in the buffer.
579
366
 
580
367
Error responses
581
368
===============
582
369
 
583
 
This list is not yet in sync with the changes that appeared in 1.3.
584
 
 
585
370
ERR <message> [<extra>...]
586
371
 
587
372
<message> is always one element; it never contains spaces.  This may
713
498
   applies to a SET of an ENUM type which is using a value which is
714
499
   not in the list of allowed values.
715
500
 
716
 
Old error messages
717
 
==================
718
 
 
719
 
These are only used by the compatibility functions in upsd for the old
720
 
variable/command names and (naturally) by older versions of upsd.
721
 
 
722
 
VAR-UNKNOWN
723
 
 
724
 
 - The client requested an unrecognized variable.  This only applies
725
 
   to old variable names, as there is a finite list of them.
726
 
 
727
 
UNKNOWN-TYPE
728
 
 
729
 
 - The client requested VARTYPE of something that is not recognized
730
 
   by upsd.  This should never happen.
731
 
 
732
 
UNKNOWN-INSTCMD
733
 
 
734
 
 - The client tried to start an unrecognized command.  This is also
735
 
   only for old command names, as they also have a finite list.
736
 
 
737
 
MISSING-ARGUMENT
738
 
 
739
 
 - The client's request is missing at least one argument.  This is
740
 
   used for compatibility with older clients.
741
 
 
742
501
Future ideas
743
502
============
744
503