b957a699037be3cdbb1a411aa70ef46fc92c4e47
[project/luci.git] / libs / luci-lib-nixio / docsrc / README.lua
1 --- General Information.
2 module "README"
3
4 --- General error handling information.
5 -- <ul>
6 -- <li> Most of the functions available in this library may fail. If any error
7 -- occurs the function returns <strong>nil or false</strong>, an error code
8 -- (usually errno) and an additional error message text (if avaialable).</li>
9 -- <li>At the moment false is only returned when a non-blocking I/O function
10 -- fails with EAGAIN, EWOULDBLOCK or WSAEWOULDBLOCK for any others nil is
11 -- returned as first parameter. Therefore you can use false to write portable
12 -- non-blocking I/O applications.</li>
13 -- <li>Note that the function documentation does only mention the return values
14 -- in case of a successful operation.</li> 
15 -- <li>You can find a table of common error numbers and other useful constants
16 -- like signal numbers in <strong>nixio.const</strong> e.g. nixio.const.EINVAL,
17 -- nixio.const.SIGTERM, etc. For portability there is a second error constant
18 -- table <strong>nixio.const_sock</strong> for socket error codes. This might
19 -- be important if you are dealing with Windows applications, on POSIX however
20 -- const_sock is just an alias for const.</li>
21 -- <li>With some exceptions - which are explicitely stated in the function
22 -- documentation - all blocking functions are signal-protected and will not fail
23 -- with EINTR.</li>
24 -- <li>On POSIX the SIGPIPE signal will be set to ignore upon initialization.
25 -- You should restore the default behaviour or set a custom signal handler
26 -- in your program after loading nixio if you need this behaviour.</li>
27 -- </ul>
28 -- @class table
29 -- @name Errorhandling
30 -- @return !
31
32 --- Function conventions.
33 -- <br />In general all functions are namend and behave like their POSIX API
34 -- counterparts - where applicable - applying the following rules:
35 -- <ul>
36 -- <li>Functions should be named like the underlying POSIX API function ommiting
37 -- prefixes or suffixes - especially when placed in an object-context (
38 -- lockf -> File:lock, fsync -> File:sync, dup2 -> dup, ...)</li>
39 -- <li>If you are unclear about the behaviour of a function you should consult
40 -- your OS API documentation (e.g. the manpages).</li>
41 -- <li>If the name is significantly different from the POSIX-function, the
42 -- underlying function(s) are stated in the documentation.</li>
43 -- <li>Parameters should reflect those of the C-API, buffer length arguments and 
44 -- by-reference parameters should be ommitted for pratical purposes.</li>
45 -- <li>If a C function accepts a bitfield as parameter, it should be translated
46 -- into lower case string flags representing the flags if the bitfield is the 
47 -- last parameter and also ommiting prefixes or suffixes. (e.g.  waitpid
48 -- (pid, &s, WNOHANG | WUNTRACED) -> waitpid(pid, "nohang", "untraced"), 
49 -- getsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) ->
50 -- Socket:getopt("socket", "reuseaddr"), etc.) </li>
51 -- <li>If it is not applicable to provide a string representation of the
52 -- bitfield a bitfield generator helper is provided. It is named FUNCTION_flags.
53 -- (open("/tmp/test", O_RDONLY | O_NONBLOCK) -> open("/tmp/test", open_flags(
54 -- "rdonly", "nonblock")))</li>  
55 -- </ul>
56 -- @class table
57 -- @name Functions
58 -- @return !
59
60 --- Platform information.
61 -- <ul>
62 -- <li>The minimum platform requirements are a decent POSIX 2001 support.
63 -- Builds are more or less tested on Linux, Solaris and FreeBSD. Builds for
64 -- Windows XP SP1 and later can be compiled with MinGW either from Windows
65 -- itself or using the MinGW cross-compiler. Earlier versions of Windows are not
66 -- supported.</li>
67 -- <li>In general all functions which don't have any remarks 
68 -- in their documentation are available on all platforms.</li>
69 -- <li>Functions with a (POSIX), (Linux) or similar prefix are only available
70 -- on these specific platforms. Same appplies to parameters of functions
71 -- with a similar suffix.</li>
72 -- <li>Some functions might have limitations on some platforms. This should
73 -- be stated in the documentation. Please also consult your OS API 
74 -- documentation.</li>   
75 -- </ul>
76 -- @usage Tes
77 -- @class table
78 -- @name Platforms
79 -- @return !
80
81 --- Cryptography and TLS libraries.
82 -- <ul>
83 -- <li>Currently 3 underlying cryptography libraries are supported: openssl,
84 -- cyassl and axTLS. The name of the library in use is written to 
85 -- <strong>nixio.tls_provider</strong></li>
86 -- <li>You should whenever possible use openssl or cyassl as axTLS has only 
87 -- limited support. It does not provide support for non-blocking sockets and
88 -- is probably less audited than the other ones.</li>
89 -- <li>As the supported Windows versions are not suitable for embedded devices
90 -- axTLS is at the moment not supported on Windows.</li>  
91 -- </ul>
92 -- @usage Tes
93 -- @class table
94 -- @name TLS-Crypto
95 -- @return !