]> git.vpit.fr Git - perl/modules/Bit-MorseSignals.git/blob - README
Importing Bit-MorseSignals-0.01.tar.gz
[perl/modules/Bit-MorseSignals.git] / README
1 NAME
2     Bit::MorseSignals - The MorseSignals protocol.
3
4 VERSION
5     Version 0.01
6
7 DESCRIPTION
8     In unidirectionnal communication channels (such as networking or IPC),
9     the main issue is often to know the length of the message. Some possible
10     solutions are fixed-length messages (which is quite cumbersome) or a
11     special ending sequence (but it no longer can appear in the data). This
12     module proposes another solution, by using a begin/end signature
13     specialized for each message.
14
15     An actual implementation is also provided :
16
17     Bit::MorseSignals::Emitter is a base class for emitters ;
18     Bit::MorseSignals::Receiver is a base class for receivers ;
19
20     Go to those pages if you just want the stuff done and don't care about
21     how it gets there.
22
23 PROTOCOL
24     Each byte of the data string is converted into its bits sequence, with
25     bits of lowest weight coming first. All those bits sequences are put
26     into the same order as the characters occur in the string.
27
28     The header is composed of three bits (lowest weight coming first) :
29
30     - The 2 first ones denotes the data type : a value of 0 is used for a
31     plain string, 1 for an UTF-8 encoded string, and 2 for a Storable
32     object. See also the "CONSTANTS" sections ;
33     - The third one is reserved. For compatibility reasons, the receiver
34     should for now enforce the message data type to plain when this bit is
35     lit.
36
37     The emitter computes then the longuest sequence of successives 0 (say,
38     m) and 1 (n) in the concatenation of the header and the data. A
39     signature is then chosen :
40
41     - If m > n, we take n+1 times 1 followed by one 0 ;
42     - Otherwise, we take m+1 times 0 followed by one 1.
43
44     The signal is then formed by concatenating the signature, the header,
45     the data bits and the reversed signature (i.e. the bits of the signature
46     in the reverse order).
47
48         a ... a b | t0 t1 r | ... data ... | b a ... a
49         signature | header  |     data     | reversed signature
50
51     The receiver knows that the signature has been sent when it has catched
52     at least one 0 and one 1. The signal is completely transferred when it
53     has received for the first time the whole reversed signature.
54
55 CONSTANTS
56   "BM_DATA_AUTO"
57     Default for non-references messages. Try to guess if the given scalar is
58     an UTF-8 string with "Encode::is_utf8".
59
60   "BM_DATA_PLAIN"
61     Treats the data as a plain string. No extra mangling in done.
62
63   "BM_DATA_UTF8"
64     Treats the data as an UTF-8 string. The string is
65     "Encode::encode_utf8"'d in a binary string before sending, and
66     "Encode::decode_utf8"'d by the receiver.
67
68   "BM_DATA_STORABLE"
69     The scalar, array or hash reference given is "Storable::freeze"'d by the
70     sender and "Storable::thaw"'d by the receiver.
71
72 EXPORT
73     The constants "BM_DATA_AUTO", "BM_DATA_PLAIN", "BM_DATA_UTF8" and
74     "BM_DATA_STORABLE" are only exported on request, either by specifying
75     their names or the ':consts' tag.
76
77 DEPENDENCIES
78     Carp (standard since perl 5), Encode (since perl 5.007003), Storable
79     (idem).
80
81 SEE ALSO
82     Bit::MorseSignals::Emitter, Bit::MorseSignals::Receiver.
83
84 AUTHOR
85     Vincent Pit, "<perl at profvince.com>"
86
87     You can contact me by mail or on #perl @ FreeNode (vincent or
88     Prof_Vince).
89
90 BUGS
91     Please report any bugs or feature requests to "bug-bit-morsesignals at
92     rt.cpan.org", or through the web interface at
93     <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Bit-MorseSignals>. I
94     will be notified, and then you'll automatically be notified of progress
95     on your bug as I make changes.
96
97 SUPPORT
98     You can find documentation for this module with the perldoc command.
99
100         perldoc Bit::MorseSignals
101
102 COPYRIGHT & LICENSE
103     Copyright 2008 Vincent Pit, all rights reserved.
104
105     This program is free software; you can redistribute it and/or modify it
106     under the same terms as Perl itself.
107