Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  1. <!-- Copyright 2009, ARM Research Labs, LLC -->
  2. <html>
  3. <body>
  4. <font face="sans-serif">
  5. <h1>Message Sniffer SDK for Win* V3.0</h1>
  6. <h2>Contents</h2>
  7. </font><h3><ol>
  8. <p><font face="sans-serif">Introduction</font></p>
  9. <li><font face="sans-serif"><a href="#Begin">Before you begin!</a></font></li>
  10. <li><font face="sans-serif"><a href="#Description">SNFMulti DLL Description</a></font></li>
  11. <li><font face="sans-serif"><a href="ChangeLog.txt">Change Log</a></font></li>
  12. <p><font face="sans-serif">Setup notes and important instructions</font></p>
  13. <li><font face="sans-serif"><a href="SNFServer_readme.txt">SNFServer Setup Readme</a></font></li>
  14. <li><font face="sans-serif"><a href="SNFClient_readme.txt">SNFClient Setup Readme</a></font></li>
  15. <p><font face="sans-serif">Code Samples</font></p>
  16. <li><font face="sans-serif"><a href="32bitDll/snfmultidll.h">C Header File (snfmultidll.h></a></font></li>
  17. <li><font face="sans-serif"><a href="32bitDll/libsnfmulti.def">Module Definition File (libsnfmulti.def)</a></font></li>
  18. <li><font face="sans-serif"><a href="C++/main.cpp">C++ Sample Code</a></font></li>
  19. <li><font face="sans-serif"><a href="VB/SNFMulti_in_VB.Net.txt">VB.Net Sample Code</a></font></li>
  20. <p><font face="sans-serif">API Reference - Functions listed in the order they should be used</font></p>
  21. <li><font face="sans-serif"><a href="#startupSNF">startupSNF()</a> - Initializes the SNF engine and loads the rule base</font></li>
  22. <li><font face="sans-serif"><a href="#startupSNFAuthenticated">startupSNFAuthenticated()</a> - Initializes SNF with license info</font></li>
  23. <li><font face="sans-serif"><a href="#setThrottle">setThrottle()</a> - Sets a concurrent thread limit (if desired)</font></li>
  24. <li><font face="sans-serif"><a href="#testIP">testIP()</a> - Returns the GBUdb reputation range for an IP</font></li>
  25. <li><font face="sans-serif"><a href="#getIPReputation">getIPReputation()</a> - Returns IP Reputation Figure for an IP</font></li>
  26. <li><font face="sans-serif"><a href="#scanBuffer">scanBuffer()</a> - Scans a message buffer</font></li>
  27. <li><font face="sans-serif"><a href="#scanFile">scanFile()</a> - Scans a message file</font></li>
  28. <li><font face="sans-serif"><a href="#getScanXHeaders">getScanXHeaders()</a> - Returns the scan result and XHeaders</font></li>
  29. <li><font face="sans-serif"><a href="#getScanXMLLog">getScanXMLLog()</a> - Returns the scan result and XML Log data</font></li>
  30. <li><font face="sans-serif"><a href="#getScanClassicLog">getScanClassicLog()</a> - Returns the scan result and Classic Log Data</font></li>
  31. <li><font face="sans-serif"><a href="#getScanResult">getScanResult()</a> - Returns the scan result (nothing else)</font></li>
  32. <li><font face="sans-serif"><a href="#closeScan">closeScan()</a> - Closes the scan and releases resources</font></li>
  33. <li><font face="sans-serif"><a href="#shutdownSNF">shutdownSNF()</a> - Shuts down the SNF engine</font></li>
  34. <p><font face="sans-serif">Miscellaneous</font></p>
  35. <li><font face="sans-serif"><a href="#ResultCodes">Result Codes</a> - Error and Scan Result Mnemonics</font></li>
  36. </ol></h3><font face="sans-serif">
  37. <hr/>
  38. <a name="Begin"><h3>Before you begin!</h3></a>
  39. <p>This SDK contains a complete Message Sniffer engine. You MUST be familiar with that engine
  40. before you can effectively use this SDK. If you do not already have an OEM license or trial
  41. SNF rule base license then please <a href="http://www.armresearch.com/">visit our web site first
  42. and get one!</a> The engine won't run without it.</p>
  43. <p>We highly recommend that you have some experience with our SNFServer and SNFClient applications
  44. before you begin writing your own or begin integrating the SNF engine into your own software.</p>
  45. <p>We're not saying it's hard to do -- quite the opposite actually, BUT SNF is a sophisticated
  46. piece of software with a lot of capabilities and options. You will have much better results
  47. if you are familiar with these before you begin ;-)</p>
  48. <hr/>
  49. <a name="Description"><h3>SNFMulti DLL Description</h3></a>
  50. <p>The SNF SDK for Win* is based on a DLL. The DLL is provided in both 32 bit and 64 bit versions.
  51. The 32 bit version is included here. The 64 bit version is available upon request as it is
  52. still considered a late-beta product (It has no apparent bugs, but we're still testing it).</p>
  53. <p>The DLL contains the entire SNFServer engine and provides a simple API for starting the
  54. engine, scanning messages, and retrieving the results. Since the entire SNFServer engine is
  55. included you also have the option of using the SNFClient utility once your application has
  56. started the SNF engine. You can also make calls to the engine using the XCI protocol (which
  57. is how SNFClient does it's work)</p>
  58. <p>Of course the best way to use the DLL is to perform scans directly through the API. The
  59. best performance can be achieved by scanning a message in memory via the scanBuffer() function
  60. since this can be done at the full speed of the processor without waiting for IO operations.</p>
  61. <p>The DLL is fully thread-safe so you can perform as many concurrent scans as you wish. Also,
  62. just in case it will make things easier for you, the DLL provides a throttling function which
  63. can limit the number of concurrent scans. (It won't unless you ask it to.)</p>
  64. <p>The general form of an application using the DLL will first start the engine, then
  65. optionally set the throttle, then perform scans (perform a scan, get results, close the scan, repeat),
  66. and finally it will shutdown the engine.</p>
  67. <p>Since the DLL contains the entire SNFServer engine, it can (and must) be configured in
  68. exactly the same way as SNFServer. <a href="http://www.armresearch.com/support/articles/software/snfServer/config/index.jsp">
  69. Documentation for configuring SNFServer can be found on our web site.</a></p>
  70. <p>New in snfmulti.dll V3.0!</p>
  71. <p>OEM developers can now protect their licenseID and Authentication string by providing it directly to the SNF engine at run-time. When combined with an internal mechanism for downloading rule base files this makes it practical to control SNF license information entirely within the OEM's application. <a href="#startupSNFAuthenticated">See startupSNFAuthenticated() for details.</a></p>
  72. <hr/>
  73. <a name="startupSNF"><h3>int startupSNF(char* path);</h3></a>
  74. <p>This function initializes the SNF scanning engine using the configuration file provided.
  75. The configuration file identifies all of the operational parameters for the SNF engine including
  76. the location of the working directories and rule base file, SNF license information, and
  77. much more. <a href="http://www.armresearch.com/support/articles/software/snfServer/config/index.jsp">
  78. See our web site for details on configuring the SNF engine.</a></p>
  79. <dl>
  80. <dd><b>path</b> = The full path to the snf_engine.xml file as a null terminated string.</dd>
  81. <dd><b>returns</b> snf_SUCCESS when successful, otherwise see <a href="#ResultCodes">Error Codes</a>.</dd>
  82. </dl>
  83. <hr/>
  84. <a name="startupSNFAuthenticated"><h3>int startupSNFAuthenticated(char* path, char* lic, char* auth);</h3></a>
  85. <p>This function initializes the SNF scanning engine using the configuration file and authentication
  86. information provided. When SNF is started with this function the identity.xml file can be omitted and
  87. the identity= attribute of the &lt;node/&gt; element in snf_engine.xml can be omitted. This allows OEM
  88. developers to protect their authentication string by retrieving it from an encrypted source at run-time
  89. and providing it directly to the SNF engine.</p>
  90. <p>In all other ways the SNF engine is configured in the same as when using <a href="#startupSNF">startupSNF() (see above)</a></p>
  91. <p>Note that if you intend to use this mechanism to protect your SNF license information you will also need to
  92. address the mechanism you use to download and verify rule base files. Either build a mechanism to download and
  93. authenticate your rule base file without exposing your authentication string or you might modify the existing
  94. getRulebase script to remove the snf2check operation and the associated authentication string. The SNF engine will
  95. check all rule base files before they are loaded for scanning and will refuse to load a rule base file that does
  96. not authenticate properly.</p>
  97. <dl>
  98. <dd><b>path</b> = The full path to the snf_engine.xml file as a null terminated string.</dd>
  99. <dd><b>lic</b> = The 8 character license id as a null terminated string.</dd>
  100. <dd><b>auth</b> = The 16 character authentication string as a null terminated string.</dd>
  101. <dd><b>returns</b> snf_SUCCESS when successful, otherwise see <a href="#ResultCodes">Error Codes</a>.</dd>
  102. </dl>
  103. <hr/>
  104. <a name="setThrottle"><h3>int setThrottle(int Threads);</h3></a>
  105. <p>This function establishes a limit on the number of concurrent scans that can run. Any additional
  106. threads will block until at least one of the active scans is completed.</p>
  107. <p>The default value for the throttle setting is zero. When the throttle is set to zero then no limits
  108. are placed on the number of concurrent scans. In this mode the application must limit the number of
  109. concurrent scans.</p>
  110. <dl>
  111. <dd><b>Threads</b> = The number of concurrent scans allowed.</dd>
  112. <dd><b>returns</b> the number of Threads if successful otherwise snf_ERROR_EXCEPTION.</dd>
  113. </dl>
  114. <hr/>
  115. <a name="testIP"><h3>int testIP(unsigned long int IPToCheck);</h3></a>
  116. <p>This function tests an IP against the GBUdb. This function returns very quickly and can be called
  117. as often as required without any follow-up actions as long as the SNF Engine is active (between startupSNF()
  118. and shutdownSNF()). This function is thread-safe and does not interfere with other scanning functions.</p>
  119. <p>GBUdb gathers it's statistics based on the message scans that are performed. Information about those
  120. scans is also shared with other SNF nodes approximately once every minute. No external queries are
  121. performed to gather GBUdb data. As a result GBUdb can only provide an IP reputation for IPs that sourced
  122. messages scanned by this SNF node.</p>
  123. <p>Put another way - GBUdb does not work like a conventional real-time black list. Message scans must
  124. be performed in order for GBUdb to provide IP reputation information.</p>
  125. <p>For more information on how GBUdb works visit the
  126. <a href="http://www.armresearch.com/support/articles/technology/GBUdb/index.jsp">
  127. GBUdb Technology section of our web site.</a></p>
  128. <dl>
  129. <dd><b>IPToCheck</b> = The IP to test.</dd>
  130. <dd><b>returns</b> an integer representing the GBUdb Range associated with the IP if successful
  131. otherwise snf_ERROR_EXCEPTION.</dd>
  132. </dl>
  133. <h4>GBUdb Range MNemonics from enum snfIPRange</h4>
  134. <dl>
  135. <dd>Unknown, snf_IP_Unknown = 0</dd>
  136. <dd>White, snf_IP_White = 1</dd>
  137. <dd>Normal, snf_IP_Normal = 2</dd>
  138. <dd>New, snf_IP_New = 3</dd>
  139. <dd>Caution, snf_IP_Caution = 4</dd>
  140. <dd>Black, snf_IP_Black = 5</dd>
  141. <dd>Truncate, snf_IP_Truncate = 6</dd>
  142. </dl>
  143. <hr/>
  144. <a name="getIPReputation"><h3>double getIPReputation(unsigned long int IPToCheck);</h3></a>
  145. <p>This function returns a number representing the overall reputation of the IP based on local GBUdb statistics.
  146. This number (Reputation Figure) can be easily manipulated to provide additional weight values in systems that combine
  147. multiple tests using a weight based scoring system. The Reputation Figure is calculated by combining the Probability figure and the Confidence figure using the formula:</p>
  148. <pre>R = sign(P) * sqrt(abs(P * C))</pre>
  149. <p>This function returns very quickly and can be called as often as required without any follow-up actions as long
  150. as the SNF Engine is active (between startupSNF...() and shutdownSNF()). This function is thread-safe and does not interfere with other scanning functions.</p>
  151. <dl>
  152. <dd><b>IPToCheck</b> = The IP to test.</dd>
  153. <dd><b>returns</b> a number between -1.0 and +1.0 representing the combined probability that the IP will produce spam.</dd>
  154. </dl>
  155. <h4>Converting IP Reputation Figures To Weights</h4>
  156. <p>There are a number of ways to convert a Reputation figure to a weight value. The simplest is to simply multiply
  157. the Reputation figure by the maximum weight you wish to give to this test.</p>
  158. <pre>SimpleWeight = R * MaxReputationWeight</pre>
  159. <p>Since many legitimate ISPs also produce a lot of spam it might be useful to apply a bias to this weight so that
  160. these systems appear closer to zero. For example if you applied a maximum weight of 10 and found that many ISPs
  161. regularly scored 5 or more then you might add a Bias of -5 to bring those systems toward zero.</p>
  162. <pre>BiasedWeight = (R * MaxReputationWeight) + Bias</pre>
  163. <p>A more sophisticated system might allow for different weights on the positive and negative going Reputation
  164. figures so that the amount of negative or positive weight that can be applied can be adjusted independently. Such
  165. a system might also wish to apply a bias directly to the reputation figure before doing that calculation so that
  166. the zero point can be adjusted to compensate for averages.</p>
  167. <p>In a system like this if legitimate ISPs tended to get a Reputation Figure of 0.5 then the bias might be -0.5
  168. so that this would become the zero point. Then the positive and negative weight factors could be adjusted so that
  169. the desired maximum and minimum weights can be achieved... Note that in this scenario the positive and negative
  170. weight settings are not maximum values.
  171. <pre>SplitWeight = (0 > (R + Bias)) ? ((R + Bias) * NegativeWeightFactor) : ((R + Bias) * PositiveWeightFactor)
  172. MaximumNegativeWeight is given by (-1.0 + Bias) * NegativeWeightFactor
  173. MaximumPositiveWeight is given by (+1.0 + Bias) * PositiveWeightFactor
  174. When R + Bias == 0.0, the weight will be 0.</pre>
  175. <p>The most sophisticated system might provide a graphic interface that maps the reputation figure directly
  176. to a desired weight. This would allow the user to shape the effect of the Reputation figure any way they wish in
  177. order to gain very tight control over their systems accuracy.</p>
  178. <hr/>
  179. <a name="scanBuffer"><h3>int scanBuffer(unsigned char* Bfr, int Length, char* Name, int Setup);</h3></a>
  180. <p>This function scans an SMTP message from a buffer. A scan result block is allocated for the scan
  181. and a handle representing the scan result block is returned. The application can then use this handle to retrieve
  182. the scan results using the get...() functions. When the application is finished it MUST release the
  183. scan result block with a call to closeScan().</p>
  184. <p>The message buffer is expected to contain the raw SMTP data for the message with the local Received:
  185. header at the top. The message should not be broken into MIME segments before it is scanned by SNFMulti.
  186. This is important because Message Sniffer examines the entire message as well as how the message was
  187. assembled by the originating system. Any additional processing is both unnecessary and may remove subtle
  188. defects and artifacts that will help Message Sniffer classify the message.</p>
  189. <p>If the message is particularly large it is acceptable to scan only the first 32K bytes of the message.
  190. This means that if the calling application wants to scan a large incoming message before it has received
  191. all of the DATA during the SMTP connection then it can scan the first 32K of the message and potentially
  192. reject the remainder based on the scan result.</p>
  193. <p>When the application is finished with the results from this scan it must release the scan result block
  194. with a call to closeScan(). Scan result blocks are allocated as needed and then recycled in order to improve
  195. performance. If the application fails to close the scan result blocks then the DLL will continue to
  196. allocate additional blocks until there is no more RAM.</p>
  197. <p>The entire scan is performed before this function returns. After that the scanning thread is no longer
  198. considered to be active. The resulting scan result buffer may be accessed as often as needed to gather
  199. results data from this scan without impacting any other scan operations.</p>
  200. <p>Any number of scan...() operations may be active concurrently up to the limits of the platform.</p>
  201. <p>The scanBuffer() function accepts two additional parameters that are passed on to the logging system
  202. to aid in debugging.</p>
  203. <p>The Name parameter is a null terminated string containing an identifier for the
  204. message being scanned. This can be any name that can be used later to identify this particular message
  205. in the log files such as a serial number, unique hash, or the message-id. For example, when the
  206. scanFile() function is called this parameter is filled in with the path to the file that was scanned.</p>
  207. <p>The Setup parameter is an integer representing the number of milliseconds spent so far setting up
  208. the message to be scanned. This can be any useful metric - but generally it should represent how much
  209. time the system has spent working on preparing and evaluating the message so far. For example, when the
  210. scanFile() function is called this value is automatically established with the amount of time spent
  211. opening and reading the message file.</p>
  212. <p><b>IMPORTANT:</b> SNF expects to identify the source IP for the message by searching Received: headers
  213. in the message. The application must ensure that the local Received: header is present as the first
  214. Received: header in the message in order for this search to be accurate. If necessary the calling application can
  215. simulate the local received header using the following minimal form:</p>
  216. <p><pre>Received: from connecting.mta.example.com [12.34.56.78] by this.scanning.system</pre></p>
  217. <p>where <b><i>connecting.mta.example.com</i></b> is the optional reverse DNS resolved for the connecting MTA;
  218. <b><i>12.34.56.78</i></b> is the IP of the connecting MTA; and <b><i>by this.scanning.system</i></b> is an optional
  219. reference to the calling application.</p>
  220. </font><dl>
  221. <dd><font face="sans-serif"><b>Bfr</b> = a pointer to the buffer that is to be scanned.</font></dd>
  222. <dd><font face="sans-serif"><b>Length</b> = the length of the message buffer in bytes.</font></dd>
  223. <dd><font face="sans-serif"><b>Name</b> = a message identifier as a null terminated string.</font></dd>
  224. <dd><font face="sans-serif"><b>Setup</b> = the time in milliseconds already spent setting up this message for scanning.</font></dd>
  225. <dd><font face="sans-serif"><b>returns</b> a handle to the scan result block upon success otherwise an error code:
  226. </font><dl>
  227. <dd><font face="sans-serif">snf_ERROR_NO_HANDLE - There was a problem allocating a scan result block.</font></dd>
  228. <dd><font face="sans-serif">snf_ERROR_SCAN_FAILED - There was a problem performing the scan.</font></dd>
  229. </dl>
  230. <p><font face="sans-serif">In general a result > 0 indicates a valid scan handle and a result <= 0 indicates an error.
  231. NOTE that the scan may have failed even if you get a valid handle. The scan result code you retrieve
  232. from get...() may indicate an error. <a href="#ResultCodes">See Result Codes</a> for details.</font></p>
  233. </dd>
  234. </dl><font face="sans-serif">
  235. <hr/>
  236. <a name="scanFile"><h3>int scanFile(char* FilePath, int Setup);</h3></a>
  237. <p>This function scans an SMTP message from a file. A scan result block is allocated for the scan
  238. and a handle representing the results is returned. The application can then use this handle to retrieve
  239. the scan results using the get...() functions. When the application is finished it MUST release the
  240. scan result block with a call to closeScan().</p>
  241. <p>The scanFile() function is nearly identical to the <a href="#scanBuffer">scanBuffer() function (see above)</a>
  242. except that this function accepts the path to a file (null terminated string) instead of a pointer to a message
  243. buffer.</p>
  244. <p>One other key difference with between scanBuffer() and scanFile() is that the SNF engine can be configured
  245. to inject it's X- headers when scanFile() is used. These same X- headers are available to the calling application
  246. when using scanBuffer(), however if the application wishes to pass the message file on to other additional
  247. scanners and external processes then scanFile() might be more convenient.</p>
  248. <p>NOTE: There are significant performance implications to scanning files and injecting headers. Each time
  249. headers are injected into a message the message file must be rewritten. For optimal performance it is best
  250. to collect headers from scanning tools before writing the message to disk so that the message only needs to
  251. be written once. Extra file IO is the cost of the convenience of passing a message file to external processes.</p>
  252. <p>The Setup time passed to scanFile() will be added to the time required to open and read the message file
  253. prior to scanning. This value will be passed on to the logging system. For example, the calling application
  254. might include the number of milliseconds required to perform any previous message testing and the time it
  255. has taken to create a temporary message file for scanning. The log will then reflect the complete setup time
  256. separately from the time required to perform the SNF message scan.</p>
  257. <p>The FilePath will be passed on to the logging system to identify this message scan in the logs.</p>
  258. </font><dl>
  259. <dd><font face="sans-serif"><b>FilePath</b> = The full path (a null terminated string) to the message file to be scanned.</font></dd>
  260. <dd><font face="sans-serif"><b>Setup</b> = The time in milliseconds spent so far preparing this message to be scanned.</font></dd>
  261. <dd><font face="sans-serif"><b>returns</b> a handle to the scan result block upon success otherwise an error code:
  262. </font><dl>
  263. <dd><font face="sans-serif">snf_ERROR_NO_HANDLE - There was a problem allocating a scan result block.</font></dd>
  264. <dd><font face="sans-serif">snf_ERROR_SCAN_FAILED - There was a problem performing the scan.</font></dd>
  265. </dl>
  266. <p><font face="sans-serif">In general a result > 0 indicates a valid scan handle and a result <= 0 indicates an error.
  267. NOTE that the scan may have failed even if you get a valid handle. The scan result code you retrieve
  268. from get...() may indicate an error. <a href="#ResultCodes">See Result Codes</a> for details.</font></p>
  269. </dd>
  270. </dl><font face="sans-serif">
  271. <hr/>
  272. <a name="getScanXHeaders"><h3>int getScanXHeaders(int ScanHandle, char** Bfr, int* Length);</h3></a>
  273. <p>This function returns the scan result code <a href="#ResultCodes">(see Result Codes)</a> and a pointer
  274. to a buffer containing any X- headers that were produced for the scan associated with the ScanHandle.</p>
  275. <p>The function is passed a valid ScanHandle which identifies the scan result block to query; the address of
  276. a char* which will be changed to point to a buffer containing any X- headers that
  277. were produced; and the address of an integer which will be changed to the length of the
  278. X- headers buffer.</p>
  279. <p>If no X- headers were produced for the scan then the pointer Bfr will point to a safe empty string
  280. and Length will be set to zero. Put another way, Bfr and Length will be consistent with an empty null terminated
  281. string.</p>
  282. <p>The char* Bfr and the int Length will remain valid until closeScan() is called for this ScanHandle.</p>
  283. <p>In order for X- headers to be produced the engine must be configured properly. For details visit the
  284. <a href="http://www.armresearch.com/support/articles/software/snfServer/config/node/logs/scan/xheaders/index.jsp">
  285. XHeader configuration documentation</a> on our web site.</p>
  286. <dl>
  287. <dd><b>ScanHandle</b> = a valid scan handle from scanBuffer() or scanFile().</dd>
  288. <dd><b>Bfr</b> = a pointer to a char* where the char* will be changed to point to the XHeaders.</dd>
  289. <dd><b>Length</b> = a pointer to an int where the int will be changed to the length of the XHeaders.</dd>
  290. <dd><b>returns</b> the scan result code upon success otherwise an error code:
  291. <dl>
  292. <dd>snf_ERROR_NO_HANDLE - The ScanHandle is not valid.</dd>
  293. <dd>snf_ERROR_EXCEPTION - There was a problem retrieving the data.</dd>
  294. <dd><a href="#ResultCodes">See Result Codes</a> for other possible return values.</dd>
  295. </dl>
  296. </dd>
  297. </dl>
  298. <hr/>
  299. <a name="getScanXMLLog"><h3>int getScanXMLLog(int ScanHandle, char** Bfr, int* Length);</h3></a>
  300. <p>This function returns the scan result code <a href="#ResultCodes">(see Result Codes)</a> and a pointer
  301. to a buffer containing any XML Log Data that was produced for the scan associated with the ScanHandle.</p>
  302. <p>The function is passed a valid ScanHandle which identifies the scan result block to query; the address of
  303. a char* which will be changed to point to a buffer containing any XML Log Data that
  304. was produced; and the address of an integer which will be changed to the length of the
  305. XML Log Data buffer.</p>
  306. <p>If no XML Log Data was produced for the scan then the pointer Bfr will point to a safe empty string
  307. and Length will be set to zero. Put another way, Bfr and Length will be consistent with an empty null terminated
  308. string.</p>
  309. <p>The char* Bfr and the int Length will remain valid until closeScan() is called for this ScanHandle.</p>
  310. <p>In order for XML Log Data to be produced the engine must be configured properly. For details visit the
  311. <a href="http://www.armresearch.com/support/articles/software/snfServer/config/node/logs/scan/xml.jsp">
  312. XML Log configuration documentation</a> on our web site.</p>
  313. <dl>
  314. <dd><b>ScanHandle</b> = a valid scan handle from scanBuffer() or scanFile().</dd>
  315. <dd><b>Bfr</b> = a pointer to a char* where the char* will be changed to point to the XML Log Data.</dd>
  316. <dd><b>Length</b> = a pointer to an int where the int will be changed to the length of the XML Log Data.</dd>
  317. <dd><b>returns</b> the scan result code upon success otherwise an error code:
  318. <dl>
  319. <dd>snf_ERROR_NO_HANDLE - The ScanHandle is not valid.</dd>
  320. <dd>snf_ERROR_EXCEPTION - There was a problem retrieving the data.</dd>
  321. <dd><a href="#ResultCodes">See Result Codes</a> for other possible return values.</dd>
  322. </dl>
  323. </dd>
  324. </dl>
  325. <hr/>
  326. <a name="getScanClassicLog"><h3>int getScanClassicLog(int ScanHandle, char** Bfr, int* Length);</h3></a>
  327. <p>This function returns the scan result code <a href="#ResultCodes">(see Result Codes)</a> and a pointer
  328. to a buffer containing any Classic Log Data that was produced for the scan associated with the ScanHandle.</p>
  329. <p>The function is passed a valid ScanHandle which identifies the scan result block to query; the address of
  330. a char* which will be changed to point to a buffer containing any Classic Log Data that
  331. was produced; and the address of an integer which will be changed to the length of the
  332. Classic Log Data buffer.</p>
  333. <p>If no Classic Log Data was produced for the scan then the pointer Bfr will point to a safe empty string
  334. and Length will be set to zero. Put another way, Bfr and Length will be consistent with an empty null terminated
  335. string.</p>
  336. <p>The char* Bfr and the int Length will remain valid until closeScan() is called for this ScanHandle.</p>
  337. <p>In order for XML Log Data to be produced the engine must be configured properly. For details visit the
  338. <a href="http://www.armresearch.com/support/articles/software/snfServer/config/node/logs/scan/classic.jsp">
  339. Classic Log configuration documentation</a> on our web site.</p>
  340. <dl>
  341. <dd><b>ScanHandle</b> = a valid scan handle from scanBuffer() or scanFile().</dd>
  342. <dd><b>Bfr</b> = a pointer to a char* where the char* will be changed to point to the Classic Log Data.</dd>
  343. <dd><b>Length</b> = a pointer to an int where the int will be changed to the length of the Classic Log Data.</dd>
  344. <dd><b>returns</b> the scan result code upon success otherwise an error code:
  345. <dl>
  346. <dd>snf_ERROR_NO_HANDLE - The ScanHandle is not valid.</dd>
  347. <dd>snf_ERROR_EXCEPTION - There was a problem retrieving the data.</dd>
  348. <dd><a href="#ResultCodes">See Result Codes</a> for other possible return values.</dd>
  349. </dl>
  350. </dd>
  351. </dl>
  352. <hr/>
  353. <a name="getScanResult"><h3>int getScanResult(int ScanHandle);</h3></a>
  354. <p>This function returns the scan result code <a href="#ResultCodes">(see Result Codes)</a>
  355. for the scan associated with the ScanHandle.</p>
  356. <dl>
  357. <dd><b>ScanHandle</b> = a valid scan handle from scanBuffer() or scanFile().</dd>
  358. <dd><b>returns</b> the scan result code upon success otherwise an error code:
  359. <dl>
  360. <dd>snf_ERROR_NO_HANDLE - The ScanHandle is not valid.</dd>
  361. <dd><a href="#ResultCodes">See Result Codes</a> for other possible return values.</dd>
  362. </dl>
  363. </dd>
  364. </dl>
  365. <hr/>
  366. <a name="closeScan"><h3>int closeScan(int ScanHandle);</h3></a>
  367. <p>This function closes a ScanHandle and releases the associated Scan Result Block to the pool. This
  368. function MUST be called once for each ScanHandle produced in a scan...() function. Once this function
  369. is called the ScanHandle is no longer valid and any pointers returned by previous
  370. calls to get...() functions should be discarded (forgotten, not freed!)</p>
  371. <dl>
  372. <dd><b>ScanHandle</b> = a valid scan handle from scanBuffer() or scanFile().</dd>
  373. <dd><b>returns:</b>
  374. <dl>
  375. <dd>snf_SUCCESS - The ScanHandle was closed successfully.</dd>
  376. <dd>snf_ERROR_NO_HANDLE - The ScanHandle is not valid.</dd>
  377. <dd>snf_ERROR_EXCEPTION - There was a problem closing the ScanHandle.</dd>
  378. </dl>
  379. </dd>
  380. </dl>
  381. <hr/>
  382. <a name="shutdownSNF"><h3>int shutdownSNF();</h3></a>
  383. <p>This function shuts down the SNFMulti engine. All previously allocated ScanHandles MUST be closed
  384. before this function is called. This should be the last function in the DLL that is called by your
  385. application (call no other SNFMultiDLL functions after this).</p>
  386. <dl>
  387. <dd><b>returns:</b>
  388. <dl>
  389. <dd>snf_SUCCESS - The shutdown was successful.</dd>
  390. <dd>snf_ERROR_EXCEPTION - An error occurred during shutdown.</dd>
  391. </dl>
  392. </dd>
  393. </dl>
  394. <hr/>
  395. <a name="ResultCodes"><h3>Result Codes</h3></a>
  396. <h4>Error Codes</h4>
  397. </font><dl>
  398. <dd><font face="sans-serif">snf_SUCCESS = 0</font></dd>
  399. <dd><font face="sans-serif">snf_ERROR_CMD_LINE = 65</font></dd>
  400. <dd><font face="sans-serif">snf_ERROR_LOG_FILE = 66</font></dd>
  401. <dd><font face="sans-serif">snf_ERROR_RULE_FILE = 67</font></dd>
  402. <dd><font face="sans-serif">snf_ERROR_RULE_DATA = 68</font></dd>
  403. <dd><font face="sans-serif">snf_ERROR_RULE_AUTH = 73</font></dd>
  404. <dd><font face="sans-serif">snf_ERROR_MSG_FILE = 69</font></dd>
  405. <dd><font face="sans-serif">snf_ERROR_ALLOCATION = 70</font></dd>
  406. <dd><font face="sans-serif">snf_ERROR_BAD_MATRIX = 71</font></dd>
  407. <dd><font face="sans-serif">snf_ERROR_MAX_EVALS = 72</font></dd>
  408. <dd><font face="sans-serif">snf_ERROR_UNKNOWN = 99</font></dd>
  409. <font face="sans-serif"><br/>
  410. <dd>snf_ERROR_NO_HANDLE = -1, Invalid scan handle used or created.</dd></font>
  411. <dd><font face="sans-serif">snf_ERROR_SCAN_FAILED = -2, An unexpected exception during a scan. </font></dd>
  412. <dd><font face="sans-serif">snf_ERROR_EXCEPTION = -3, An unexpected exception occurred.</font></dd>
  413. </dl><font face="sans-serif">
  414. <p>
  415. <a href="http://www.armresearch.com/support/articles/software/snfServer/errors.jsp">
  416. See our web site for more detailed descriptions of these error codes.</a></p>
  417. <h4>Scan Result Codes</h4>
  418. <p>Scan results codes 0 through 63 represent normal scan results. By convention a result of
  419. 0 indicates ham (not spam); a result of 1 indicates a white-ruled message; and other non-zero
  420. result values that are less than 64 indicate some kind of spam or malware was detected.
  421. <a href="http://www.armresearch.com/support/articles/software/snfServer/core.jsp">
  422. For more details on message scan result codes please see our web site.</a></p>
  423. <hr/>
  424. <div align="right"><font size="-3">Copyright (C) 2009 ARM Research Labs, LLC</font></div>
  425. </font>
  426. </body>
  427. </html>