4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-a" />
5 <meta http-equiv="Content-Language" content="en" />
6 <meta name="description" content="SILC Secure Internet Live Conferencing" />
7 <meta name="keywords" content="SILC, secure, chat, protocol, cipher, encrypt, SKE" />
8 <meta content="INDEX, FOLLOW" name="ROBOTS" />
9 <style type="text/css">
11 body { color: #000000; background: #f0f0f0; font-family: Helvetica, Arial, Sans-serif; }
12 a:link { text-decoration: none; color: #2f488f; }
13 a:visited { text-decoration: none;color: #2f488f; }
14 a:active { text-decoration: none; color: #2f488f; }
19 <body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0">
21 <table border="0" cellspacing="0" cellpadding="6" width="100%">
22 <tr valign="top" bgcolor="#dddddd">
23 <td><small>Copyright © 2001 - 2007 SILC Project<br />
24 <a href="http://silcnet.org">SILC Project Website</a></small></td>
25 <td align="right"><small>
26 <a href="index.html">SILC Toolkit Reference Manual</a><br />
27 <a href="toolkit_index.html">Index</a></small></td>
31 <table border="0" cellspacing="0" cellpadding="0" width="100%">
32 <tr bgcolor="#444444"><td><img src="space.gif" width="1" height="1"border="0" alt="" ></td></tr>
35 <table cellpadding="0" cellspacing="0" border="0">
38 <td width="200" bgcolor="#f0f0f0">
39 <img src="space.gif" width="1" height="1" border="0" alt="">
40 <table width="100%" cellpadding="2" cellspacing="2" border="0">
44 <!-- Template file for the big index that appears in the Toolkit reference
45 manual on the left side. With this file it is possible to add other than
46 automatically generated links to that list. -->
48 <a href="index.html"><img src="box.gif" border="0" alt="">SILC Toolkit Reference Manual</a><br />
51 <a href=silccryptlib.html><img src=box.gif border=0 alt=>SILC Crypto Library</a><br />
52 <a href=silcrng_intro.html><img src=box2.gif border=0 alt=>Introduction to SILC RNG</a><br />
53 <a href=silcrng.html><img src=box2.gif border=0 alt=>SILC RNG Interface</a><br />
54 <a href=silccipher.html><img src=box2.gif border=0 alt=>SILC Cipher API</a><br />
55 <a href=silcpkcs.html><img src=box2.gif border=0 alt=>SILC PKCS API</a><br />
56 <a href=silcpk.html><img src=box2.gif border=0 alt=>SILC Public Key API</a><br />
57 <a href=silcpkcs1.html><img src=box2.gif border=0 alt=>SILC PKCS #1 API</a><br />
58 <a href=silchash.html><img src=box2.gif border=0 alt=>SILC Hash Interface</a><br />
59 <a href=silchmac.html><img src=box2.gif border=0 alt=>SILC HMAC Interface</a><br />
60 <a href=silccorelib.html><img src=box.gif border=0 alt=>SILC Core Library</a><br />
61 <a href=silcauth.html><img src=box2.gif border=0 alt=>SILC Authentication Interface</a><br />
62 <a href=silcmessage.html><img src=box2.gif border=0 alt=>SILC Message Interface</a><br />
63 <a href=silcchannel.html><img src=box2.gif border=0 alt=>SILC Channel Interface</a><br />
64 <a href=silccommand.html><img src=box2.gif border=0 alt=>SILC Command Interface</a><br />
65 <a href=silcnotify.html><img src=box2.gif border=0 alt=>SILC Notify Interface</a><br />
66 <a href=silcstatus.html><img src=box2.gif border=0 alt=>SILC Status Types</a><br />
67 <a href=silcmode.html><img src=box2.gif border=0 alt=>SILC Modes</a><br />
68 <a href=silcid.html><img src=box2.gif border=0 alt=>SILC ID Interface</a><br />
69 <a href=silcargument.html><img src=box2.gif border=0 alt=>SILC Argument Interface</a><br />
70 <a href=silcattrs.html><img src=box2.gif border=0 alt=>SILC Attributes Interface</a><br />
71 <a href=silcpacket.html><img src=box2.gif border=0 alt=>Packet Engine Interface</a><br />
72 <a href=silcpubkey.html><img src=box2.gif border=0 alt=>SILC Public Key Payload Interface</a><br />
73 <a href=silcskelib.html><img src=box.gif border=0 alt=>SILC Key Exchange Library</a><br />
74 <a href=silcske.html><img src=box2.gif border=0 alt=>SILC SKE Interface</a><br />
75 <a href=silcconnauth.html><img src=box2.gif border=0 alt=>SILC Connection Authentication Interface</a><br />
76 <a href=silcvcardlib.html><img src=box.gif border=0 alt=>SILC VCard Library</a><br />
77 <a href=silcvcard.html><img src=box2.gif border=0 alt=>SILC VCard Interface</a><br />
78 <a href=silcmathlib.html><img src=box.gif border=0 alt=>SILC Math Library</a><br />
79 <a href=silcmp.html><img src=box2.gif border=0 alt=>SILC MP Interface</a><br />
80 <a href=silcmath.html><img src=box2.gif border=0 alt=>SILC Math Interface</a><br />
81 <a href=silcclientlib.html><img src=box.gif border=0 alt=>SILC Client Library</a><br />
82 <a href=silcclient_using.html><img src=box2.gif border=0 alt=>Using SILC Client Library Tutorial</a><br />
83 <a href=command_reply_args.html><img src=box2.gif border=0 alt=>Arguments for <b>command_reply</b> Client Operation</a><br />
84 <a href=silcstatus_args.html><img src=box2.gif border=0 alt=>SilcStatus Error Arguments in <b>command_reply</b> Client Operation</a><br />
85 <a href=notifyargs.html><img src=box2.gif border=0 alt=>Arguments for <b>notify</b> Client Operation</a><br />
86 <a href=silcclient_unicode.html><img src=box2.gif border=0 alt=>Unicode and UTF-8 Strings in Client Library</a><br />
87 <a href=silcclient.html><img src=box2.gif border=0 alt=>Client Library Interface Reference</a><br />
88 <a href=silcclient_entry.html><img src=box2.gif border=0 alt=>Client Entry Interface Reference</a><br />
89 <a href=silcasn1lib.html><img src=box.gif border=0 alt=>SILC ASN.1 Library</a><br />
90 <a href=silcasn1.html><img src=box2.gif border=0 alt=>SILC ASN.1 Interface</a><br />
91 <a href=silcber.html><img src=box2.gif border=0 alt=>SILC BER interface</a><br />
92 <a href=silchttplib.html><img src=box.gif border=0 alt=>SILC HTTP Library</a><br />
93 <a href=silchttpserver.html><img src=box2.gif border=0 alt=>SILC HTTP Server Interface</a><br />
94 <a href=silchttpphp.html><img src=box2.gif border=0 alt=>SILC HTTP PHP Translator</a><br />
95 <a href=silcutillib.html><img src=box.gif border=0 alt=>SILC Utility Library</a><br />
96 <a href=silctypes.html><img src=box2.gif border=0 alt=>Basic Types and Definitions</a><br />
97 <a href=silcbuffer.html><img src=box2.gif border=0 alt=>Data Buffer Interface</a><br />
98 <a href=silcbuffmt.html><img src=box2.gif border=0 alt=>Data Buffer Format Interface</a><br />
99 <a href=silchashtable.html><img src=box2.gif border=0 alt=>Hash Table Interface</a><br />
100 <a href=silcmemory.html><img src=box2.gif border=0 alt=>Memory Allocation Interface</a><br />
101 <a href=silcstack.html><img src=box2.gif border=0 alt=>Data Stack (memory pool) Interface</a><br />
102 <a href=silcfsm.html><img src=box2.gif border=0 alt=>Finite State Machine Interface</a><br />
103 <a href=silcthread.html><img src=box2.gif border=0 alt=>Thread Interface</a><br />
104 <a href=silcmutex.html><img src=box2.gif border=0 alt=>Mutual Exclusion Lock Interface</a><br />
105 <a href=silccond.html><img src=box2.gif border=0 alt=>Condition Variable Interface</a><br />
106 <a href=silcatomic.html><img src=box2.gif border=0 alt=>Atomic Operations Interface</a><br />
107 <a href=silcnet.html><img src=box2.gif border=0 alt=>Network (TCP and UDP) Interface</a><br />
108 <a href=silcschedule.html><img src=box2.gif border=0 alt=>Scheduler Interface</a><br />
109 <a href=silcasync.html><img src=box2.gif border=0 alt=>Asynchronous Operation Interface</a><br />
110 <a href=silcstream.html><img src=box2.gif border=0 alt=>Abstract Stream Interface</a><br />
111 <a href=silcsocketstream.html><img src=box2.gif border=0 alt=>Socket Stream Interface</a><br />
112 <a href=silcfdstream.html><img src=box2.gif border=0 alt=>File Descriptor Stream Interface</a><br />
113 <a href=silcfileutil.html><img src=box2.gif border=0 alt=>File Utility Functions</a><br />
114 <a href=silcstrutil.html><img src=box2.gif border=0 alt=>String Utility Interface</a><br />
115 <a href=silcsnprintf.html><img src=box2.gif border=0 alt=>Snprintf Interface</a><br />
116 <a href=silcutf8.html><img src=box2.gif border=0 alt=>UTF-8 String Interface</a><br />
117 <a href=silcstringprep.html><img src=box2.gif border=0 alt=>Stringprep Interface</a><br />
118 <a href=silcutil.html><img src=box2.gif border=0 alt=>Utility Functions</a><br />
119 <a href=silclist.html><img src=box2.gif border=0 alt=>List Interface</a><br />
120 <a href=silcdlist.html><img src=box2.gif border=0 alt=>Dynamic List Interface</a><br />
121 <a href=silcmime.html><img src=box2.gif border=0 alt=>MIME Interface</a><br />
122 <a href=silctime.html><img src=box2.gif border=0 alt=>Time Utility Functions</a><br />
123 <a href=silclog.html><img src=box2.gif border=0 alt=>Logging Interface</a><br />
124 <a href=silcconfig.html><img src=box2.gif border=0 alt=>Config File Interface</a><br />
125 <a href=silcskrlib.html><img src=box.gif border=0 alt=>SILC Key Repository Library</a><br />
126 <a href=silcskr.html><img src=box2.gif border=0 alt=>SILC SKR Interface</a><br />
127 <a href=silcaputillib.html><img src=box.gif border=0 alt=>SILC Application Utility Library</a><br />
128 <a href=silcapputil.html><img src=box2.gif border=0 alt=>SILC Application Utilities</a><br />
129 <a href=silcidcache.html><img src=box2.gif border=0 alt=>SILC ID Cache Interface</a><br />
130 <a href=silcsftplib.html><img src=box.gif border=0 alt=>SILC SFTP Library</a><br />
131 <a href=silcsftp.html><img src=box2.gif border=0 alt=>SILC SFTP Interface</a><br />
132 <a href=silcsftp_fs.html><img src=box2.gif border=0 alt=>SFTP Filesystems Interface</a><br />
135 <b>Resource Links</b>
137 <a href="http://silcnet.org"><img src="box.gif" border="0" alt="">SILC Project Website</a><br />
138 <a href="http://silcnet.org/support/documentation/"><img src="box.gif" border="0" alt="">SILC Protocol Documentation</a><br />
139 <a href="http://silcnet.org/support/documentation/wp/"><img src="box.gif" border="0" alt="">SILC White Paper</a><br />
140 <a href="http://silcnet.org/support/faq/"><img src="box.gif" border="0" alt="">SILC FAQs</a><br />
143 <br /><br /><br /><br />
148 <td bgcolor="#cccccc" background="dot.gif">
149 <img src="space.gif" width="1" height="1" border="0" alt=""></td>
151 <td width="720" bgcolor="#ffffff">
152 <img src="space.gif" width="1" height="1" border="0" alt="">
153 <table cellpadding="2" cellspacing="6" width="100%">
154 <tr><td valign="top">
156 <big><b>Programming Conventions</b></big>
159 The SILC Toolkit has been programmed with a specific programming style that
160 is consistent across all libraries and interfaces. The programming style
161 defines for example naming conventions for functions, structures, macros,
162 enumerations, and other constants.
165 <br /> <br /> <br />
166 <b>Naming Conventions</b>
169 <b>Macros and Defines</b>
172 Macros are always capitalised and include underscores to separate words
173 in the name. All macros start with the "SILC_" prefix. Example:
177 #define SILC_PACKET_PADLEN(__packetlen, __blocklen) \<br />
178 SILC_PACKET_DEFAULT_PADLEN - (__packetlen) % \<br />
179 ((__blocklen) ? (__blocklen) : SILC_PACKET_DEFAULT_PADLEN)
183 Also other defines (#define) are always capitalised and include
184 underscores to separate words in the name. Also all defines start with
191 All structure names begin with "Silc" prefix, and the name is mixed-case,
192 for example: SilcClientConnection, SilcCommandPayload. Many of the
193 structures used in SILC are actually private structures, and application
194 cannot access them directly. In these cases the structures are forward
195 declared in the public header, and the implementation of the structure
196 is in the source file. In these case application does not need to know
197 the contents of the structure, and is usually provided with a helper API
198 to access the structure when needed.
201 In the most of the cases the forward declaration for a structure is pointer,
205 <tt>typedef struct SilcClientStruct *SilcClient;</tt>
208 Application should always use the type defined pointer instead of the
215 Function naming uses the common naming convention used in Toolkit. All
216 functions are always lowercase and they use underscores. The name of
217 the function always starts with prefix "silc_". The name tells what
218 the function do. The name of a function is constructed from following parts:
221 <tt>silc_(module)_(function)</tt>
224 The (module) is the library, or interface this functions is part of. For
225 example: "cipher", "config", "command", "packet", etc.
228 The (function) is the description of the functionality of the function.
229 For example: "read", "new_id", "register", "find_by_name", etc. Examples:
233 silc_server_packet_send<br />
234 silc_server_packet_send_to_channel<br />
235 silc_idcache_del_by_id<br />
236 silc_schedule_init<br />
237 silc_protocol_excute_final<br />
242 When function registers something the name of the function generally is
243 "silc_function_register" and unregistering is done with
244 "silc_function_unregister". When function allocates something it
245 is "silc_function_alloc" and when freeing it is
246 "silc_function_free". Respectively, with init/uninit functions.
252 Enumerations are always capitalised and include underscores to separate
253 words in the name. All enumerations start with the "SILC_" prefix. Also,
254 usually all enumerations are type defined to a specific name which can
255 be used as type for the enumeration. Example:
260 SILC_EXAMPLE_ENUM_NONE,<br />
261 SILC_EXAMPLE_ENUM_LIST,<br />
262 SILC_EXAMPLE_ENUM_STATUS,<br />
267 The naming for the type definition for the enumerations follow the
268 normal naming convention; the name starts with "Silc" prefix and the
272 <br /> <br /> <br />
279 The indendation in the source code is 2 characters, and tabulators are
280 not used. Example piece of code:
284 void silc_client_free(SilcClient client)<br />
286 if (client) {<br />
287 if (client->rng)<br />
288 silc_rng_free(client->rng);<br />
289 silc_free(client);<br />
295 <b>Placing Braces</b>
298 Generally the braces placing the SILC code follows the K&R style; the
299 opening of the brace is put to the last on the line, and the closing brace
300 is on first on its own line, except for functions. Examples:
304 if (condition) {<br />
305 silc_something();<br />
306 silc_something_more();<br />
312 int silc_client_function()<br />
314 return 0;<br />
320 if (condition) {<br />
321 something;<br />
322 silc_something_more();<br />
324 something_else;<br />
330 if (condition) {<br />
331 something;<br />
332 silc_something_more();<br />
333 } else if (other_condition) {<br />
334 something;<br />
335 silc_something_more();<br />
337 something_else;<br />
345 Standard anti-nesting method is used in the header files to avoid
346 multiple inclusion of the header file. Example:
350 #ifndef SILCHEADER_H<br />
351 #define SILCHEADER_H<br />
353 #endif /* SILCHEADER_H */
357 All public header files have the "silc" prefix in the filename, for example:
358 silcclient.h, silcprivate.h, silcutil.h. There are other header files in
359 the Toolkit as well. Application should not directly include these headers,
360 however if needed it may access them.
363 Every header file also includes a copyright notice.
364 <br /><br /><br /><br />
369 <td bgcolor="#cccccc" background="dot.gif">
370 <img src="space.gif" width="1" height="1" border="0" alt=""></td>
372 <td width="180" bgcolor="#f0f0f0">
373 <img src="space.gif" width="1" height="1" border="0" alt="">
374 <table width="100%" cellpadding="4" cellspacing="0">
375 <tr valign="top"><td>
377 <font face="Helvetica,Arial,Sans-serif" size="1">
380 <br /><br /><br /><br />
387 <table border="0" cellspacing="0" cellpadding="0" width="100%">
388 <tr bgcolor="#444444"><td><img src="space.gif" width="1" height="1"border="0" alt="" ></td></tr>
390 <table border="0" cellspacing="0" cellpadding="6" width="100%">
391 <tr valign="top" bgcolor="#dddddd">
392 <td><small>Copyright © 2001 - 2007 SILC Project<br />
393 <a href="http://silcnet.org">SILC Project Website</a></small></td>
394 <td align="right"><small>
395 <a href="index.html">SILC Toolkit Reference Manual</a><br />
396 <a href="toolkit_index.html">Index</a></small></td>