Difference between revisions of "Binary protocol"

From collectd Wiki
Jump to: navigation, search
(Implementations: my implementashun)
(Added some very basic initial information.)
Line 1: Line 1:
 
Until the network plugin has been factorized out into a library, it is useful to have some documentation to reimplement it.
 
Until the network plugin has been factorized out into a library, it is useful to have some documentation to reimplement it.
 
==Implementations==
 
* [http://people.igalia.com/aperez/files/collectd.py Small Python script] by Adrian Perez
 
* [http://github.com/hyperic/jcollectd/blob/master/src/main/java/org/collectd/protocol/PacketWriter.java PacketWriter.java] of jcollectd
 
* Of course the [http://git.verplant.org/?p=collectd.git;a=blob;f=src/network.c;hb=HEAD network plugin] of collectd itself
 
* [http://github.com/astro/ruby-collectd/blob/master/lib/collectd/pkt.rb pkt.rb]
 
  
 
==Well-known numbers==
 
==Well-known numbers==
Line 14: Line 8:
 
;Default IPv6 multicast group
 
;Default IPv6 multicast group
 
:ff18::efc0:4a42
 
:ff18::efc0:4a42
 +
 +
== Protocol structure ==
 +
 +
[[Image:Binary protocol part header.png|thumb|Beginning of each “part”: Type and length.]]
 +
Each packet consists of one or more so called “parts”. Each part starts with the same four bytes: Two bytes that specify the “part type” (what kind of information is enclosed in the part) and two bytes which specify the length of the part, including the four header bytes itself. The maximum length of payload in any part is therefore 65531 bytes.
 +
 +
Using this layout, clients can determine the length of a part they don't know and lets them skip unknown data. This makes the protocol forward compatible so that new features can be added easily.
 +
 +
==Implementations==
 +
* [http://people.igalia.com/aperez/files/collectd.py Small Python script] by Adrian Perez
 +
* [http://github.com/hyperic/jcollectd/blob/master/src/main/java/org/collectd/protocol/PacketWriter.java PacketWriter.java] of jcollectd
 +
* Of course the [http://git.verplant.org/?p=collectd.git;a=blob;f=src/network.c;hb=HEAD network plugin] of collectd itself
 +
* [http://github.com/astro/ruby-collectd/blob/master/lib/collectd/pkt.rb pkt.rb]
 +
 +
== See also ==
 +
 +
* [[Plugin:Network|Network]] plugin
 +
 +
[[Category:Development]]

Revision as of 21:18, 27 April 2009

Until the network plugin has been factorized out into a library, it is useful to have some documentation to reimplement it.

Well-known numbers

Default UDP port
25826
Default IPv4 Multicast group
239.192.74.66
Default IPv6 multicast group
ff18::efc0:4a42

Protocol structure

Beginning of each “part”: Type and length.

Each packet consists of one or more so called “parts”. Each part starts with the same four bytes: Two bytes that specify the “part type” (what kind of information is enclosed in the part) and two bytes which specify the length of the part, including the four header bytes itself. The maximum length of payload in any part is therefore 65531 bytes.

Using this layout, clients can determine the length of a part they don't know and lets them skip unknown data. This makes the protocol forward compatible so that new features can be added easily.

Implementations

See also