Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

snfCFGmgr.cpp 56KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009
  1. // snfCFGmgr.cpp
  2. // Copyright (C) 2006 - 2009 Arm Research Labs, LLC
  3. // See www.armresearch.com for the copyright terms.
  4. //
  5. // See snfCFGmgr.hpp for details.
  6. #include "snfCFGmgr.hpp"
  7. #include <iostream>
  8. //// RangeHandler //////////////////////////////////////////////////////////////
  9. bool RangeHandler::isInBlack(RangePoint& x) { // Find if x is on the black side.
  10. if(EdgeMap.empty()) { // If there are no points then
  11. return false; // there is no map so there is
  12. } // no side to be on.
  13. // If there are points we will need
  14. set<RangePoint>::iterator iRangePoint; // to examine them.
  15. iRangePoint = EdgeMap.begin(); // What is the first point.
  16. if(x < (*iRangePoint)) { // If x is below that then
  17. return false; // x is out of range -- false.
  18. }
  19. iRangePoint = EdgeMap.end();--iRangePoint; // What is the last range point.
  20. if(x > (*iRangePoint)) { // If x is beyond that then
  21. return false; // x is out of range -- false.
  22. }
  23. // At this point we know our point is in the range of the edge map.
  24. // So our next task is to find the two points between which we will
  25. // interpolate our comparative result.
  26. iRangePoint = EdgeMap.lower_bound(x); // Find the lower point.
  27. if(x < (*iRangePoint)) --iRangePoint; // If we've overshot, then move back.
  28. RangePoint LowerBound = (*iRangePoint); // Grab the value at that point.
  29. iRangePoint = EdgeMap.upper_bound(x); // Find the upper point.
  30. if(iRangePoint == EdgeMap.end()) --iRangePoint; // If we've overshot, then move back.
  31. RangePoint UpperBound = (*iRangePoint); // Grab the value at that point.
  32. // So then, where is x in [Lower, Upper]
  33. // First we check the obvious matching values. Then if those fail we will
  34. // interpolate between the two points.
  35. double ComparativeProbability; // This value will map the edge.
  36. if(x == LowerBound) { // If we match the lower bound then
  37. ComparativeProbability = LowerBound.Probability; // that is the Probability we compare.
  38. } else
  39. if(x == UpperBound) { // If we match the upper bound then
  40. ComparativeProbability = UpperBound.Probability; // that is the Probability we compare.
  41. } else { // For in-between we interpolate.
  42. double ULDifference = UpperBound.Confidence - LowerBound.Confidence; // First, find the difference.
  43. double Incursion = x.Confidence - LowerBound.Confidence; // How far does x go past L to U?
  44. double Ratio = Incursion / ULDifference; // Express that as a ratio.
  45. ComparativeProbability = // Interpolate the Probability using
  46. (((1-Ratio) * LowerBound.Probability) + // a weighted average of the lower and
  47. (Ratio * UpperBound.Probability)); // upper bound values using the Ratio
  48. }
  49. // Now compare x to the interpolated edge.
  50. return (x.Probability >= ComparativeProbability); // True if on or right of the edge.
  51. }
  52. bool RangeHandler::isInWhite(RangePoint& x) {
  53. if(EdgeMap.empty()) { // If there are no points then
  54. return false; // there is no map so there is
  55. } // no side to be on.
  56. // If ther are points then we
  57. set<RangePoint>::iterator iRangePoint; // need to examine them.
  58. iRangePoint = EdgeMap.begin(); // What is the first point.
  59. if(x < (*iRangePoint)) { // If x is below that then
  60. return false; // x is out of range -- false.
  61. }
  62. iRangePoint = EdgeMap.end();--iRangePoint; // What is the last range point.
  63. if(x > (*iRangePoint)) { // If x is beyond that then
  64. return false; // x is out of range -- false.
  65. }
  66. // At this point we know our point is in the range of the edge map.
  67. // So our next task is to find the two points between which we will
  68. // interpolate our comparative result.
  69. iRangePoint = EdgeMap.lower_bound(x); // Find the lower point.
  70. if(x < (*iRangePoint)) --iRangePoint; // If we've overshot, then move back.
  71. RangePoint LowerBound = (*iRangePoint); // Grab the value at that point.
  72. iRangePoint = EdgeMap.upper_bound(x); // Find the upper point.
  73. if(iRangePoint == EdgeMap.end()) --iRangePoint; // If we've overshot, then move back.
  74. RangePoint UpperBound = (*iRangePoint); // Grab the value at that point.
  75. // So then, where is x in [Lower, Upper]
  76. // First we check the obvious matching values. Then if those fail we will
  77. // interpolate between the two points.
  78. double ComparativeProbability; // This value will map the edge.
  79. if(x == LowerBound) { // If we match the lower bound then
  80. ComparativeProbability = LowerBound.Probability; // that is the Probability we compare.
  81. } else
  82. if(x == UpperBound) { // If we match the upper bound then
  83. ComparativeProbability = UpperBound.Probability; // that is the Probability we compare.
  84. } else { // For in-between we interpolate.
  85. double ULDifference = UpperBound.Confidence - LowerBound.Confidence; // First, find the difference.
  86. double Incursion = x.Confidence - LowerBound.Confidence; // How far does x go past L to U?
  87. double Ratio = Incursion / ULDifference; // Express that as a ratio.
  88. ComparativeProbability = // Interpolate the Probability using
  89. (((1-Ratio) * LowerBound.Probability) + // a weighted average of the lower and
  90. (Ratio * UpperBound.Probability)); // upper bound values using the Ratio
  91. }
  92. // Now compare x to the interpolated edge.
  93. return (x.Probability <= ComparativeProbability); // True if on or left of the edge.
  94. }
  95. //// snfCFGData ////////////////////////////////////////////////////////////////
  96. snfCFGData::snfCFGData() : // Constructor. No init list because the
  97. MyCFGReader("snf") { // interpreter will set the defaults.
  98. WhiteRangeInitializer.setTarget(WhiteRangeHandler); // However, we do need to link up our
  99. BlackRangeInitializer.setTarget(BlackRangeHandler); // Initialization configurators with our
  100. CautionRangeInitializer.setTarget(CautionRangeHandler); // Handlers.
  101. RulePanicInitializer.setTarget(RulePanicHandler);
  102. XHDRSymbolHeadersInitializer.setTarget(XHDRSymbolHeaders);
  103. HeaderDirectivesInitializer.setTarget(HeaderDirectivesHandler);
  104. HDSourceHeaderInitializer.setTarget(HeaderDirectivesHandler);
  105. HDDrilldownInitializer.setTarget(HeaderDirectivesHandler);
  106. HDBypassHeaderInitializer.setTarget(HeaderDirectivesHandler);
  107. HDWhiteHeaderInitializer.setTarget(HeaderDirectivesHandler);
  108. TrainingBypassRuleInitializer.setTarget(TrainingBypassRuleHandler);
  109. TrainingWhiteRuleInitializer.setTarget(TrainingWhiteRuleHandler);
  110. MyCFGReader // Building our interpreter.
  111. .Element("node")
  112. .Attribute("identity", node_identity)
  113. .Attribute("licenseid", node_licenseid)
  114. .Attribute("authentication", node_authentication)
  115. .Element("paths")
  116. .Element("workspace")
  117. .Attribute("path", paths_workspace_path)
  118. .End("workspace")
  119. .Element("rulebase")
  120. .Attribute("path", paths_rulebase_path)
  121. .End("rulebase")
  122. .Element("log")
  123. .Attribute("path", paths_log_path)
  124. .End("log")
  125. .End("paths")
  126. .Element("logs")
  127. .Element("rotation")
  128. .Attribute("localtime", Logs_Rotation_LocalTime_OnOff, false)
  129. .Mnemonic("yes", "true")
  130. .Mnemonic("no", "false")
  131. .End("rotation")
  132. .Element("status")
  133. .Element("second")
  134. .Attribute("log", Status_SecondReport_Log_OnOff, false)
  135. .Mnemonic("yes", "true")
  136. .Mnemonic("no", "false")
  137. .Attribute("append", Status_SecondReport_Append_OnOff, false)
  138. .Mnemonic("yes", "true")
  139. .Mnemonic("no", "false")
  140. .End("second")
  141. .Element("minute")
  142. .Attribute("log", Status_MinuteReport_Log_OnOff, false)
  143. .Mnemonic("yes", "true")
  144. .Mnemonic("no", "false")
  145. .Attribute("append", Status_MinuteReport_Append_OnOff, false)
  146. .Mnemonic("yes", "true")
  147. .Mnemonic("no", "false")
  148. .End("minute")
  149. .Element("hour")
  150. .Attribute("log", Status_HourReport_Log_OnOff, false)
  151. .Mnemonic("yes", "true")
  152. .Mnemonic("no", "false")
  153. .Attribute("append", Status_HourReport_Append_OnOff, false)
  154. .Mnemonic("yes", "true")
  155. .Mnemonic("no", "false")
  156. .End("hour")
  157. .End("status")
  158. .Element("scan")
  159. .Element("identifier")
  160. .Attribute("force-message-id", Scan_Identifier_Force_Message_Id, false)
  161. .End("identifier")
  162. .Element("classic")
  163. .Attribute("mode", Scan_Classic_Mode, LogOutputMode_None)
  164. .Mnemonic("none", "0")
  165. .Mnemonic("api", "1")
  166. .Mnemonic("file", "2")
  167. .Attribute("rotate", Scan_Classic_Rotate, false)
  168. .Attribute("matches", Scan_Classic_Matches, ScanLogMatches_None)
  169. .Mnemonic("none", "0")
  170. .Mnemonic("unique", "1")
  171. .Mnemonic("all","2")
  172. .End("classic")
  173. .Element("xml")
  174. .Attribute("mode", Scan_XML_Mode, LogOutputMode_None)
  175. .Mnemonic("none", "0")
  176. .Mnemonic("api", "1")
  177. .Mnemonic("file", "2")
  178. .Attribute("rotate", Scan_XML_Rotate, false)
  179. .Attribute("matches", Scan_XML_Matches, ScanLogMatches_None)
  180. .Mnemonic("none", "0")
  181. .Mnemonic("unique", "1")
  182. .Mnemonic("all","2")
  183. .Attribute("performance", Scan_XML_Performance, false)
  184. .Attribute("gbudb", Scan_XML_GBUdb, false)
  185. .End("xml")
  186. .Element("xheaders")
  187. .atStartCall(XHDRSymbolHeadersInitializer)
  188. .Element("output")
  189. .Attribute("mode", XHDROutput_Mode, LogOutputMode_None)
  190. .Mnemonic("none", "0")
  191. .Mnemonic("api", "1")
  192. .Mnemonic("file", "2")
  193. .Mnemonic("inject", "3")
  194. .End("output")
  195. .Element("symbol", XHDRSymbolHeaders.Header, "")
  196. .atEndCall(XHDRSymbolHeaders)
  197. .Attribute("on-off", XHDRSymbolHeaders.OnOff, false)
  198. .Mnemonic("on", "true")
  199. .Mnemonic("off", "false")
  200. .Attribute("n", XHDRSymbolHeaders.Symbol, -1)
  201. .End("symbol")
  202. .Element("version", XHDRVersion_Header, "")
  203. .Attribute("on-off", XHDRVersion_OnOff, false)
  204. .Mnemonic("on", "true")
  205. .Mnemonic("off", "false")
  206. .End("version")
  207. .Element("license", XHDRLicense_Header, "")
  208. .Attribute("on-off", XHDRLicense_OnOff, false)
  209. .Mnemonic("on", "true")
  210. .Mnemonic("off", "false")
  211. .End("license")
  212. .Element("rulebase", XHDRRulebase_Header, "")
  213. .Attribute("on-off", XHDRRulebase_OnOff, false)
  214. .Mnemonic("on", "true")
  215. .Mnemonic("off", "false")
  216. .End("rulebase")
  217. .Element("identifier", XHDRIdentifier_Header, "")
  218. .Attribute("on-off", XHDRIdentifier_OnOff, false)
  219. .Mnemonic("on", "true")
  220. .Mnemonic("off", "false")
  221. .End("identifier")
  222. .Element("gbudb", XHDRGBUdb_Header, "")
  223. .Attribute("on-off", XHDRGBUdb_OnOff, false)
  224. .Mnemonic("on", "true")
  225. .Mnemonic("off", "false")
  226. .End("gbudb")
  227. .Element("result", XHDRResult_Header, "")
  228. .Attribute("on-off", XHDRResult_OnOff, false)
  229. .Mnemonic("on", "true")
  230. .Mnemonic("off", "false")
  231. .End("result")
  232. .Element("matches", XHDRMatches_Header, "")
  233. .Attribute("on-off", XHDRMatches_OnOff, false)
  234. .Mnemonic("on", "true")
  235. .Mnemonic("off", "false")
  236. .End("matches")
  237. .Element("black", XHDRBlack_Header, "")
  238. .Attribute("on-off", XHDRBlack_OnOff, false)
  239. .Mnemonic("on", "true")
  240. .Mnemonic("off", "false")
  241. .End("black")
  242. .Element("white", XHDRWhite_Header, "")
  243. .Attribute("on-off", XHDRWhite_OnOff, false)
  244. .Mnemonic("on", "true")
  245. .Mnemonic("off", "false")
  246. .End("white")
  247. .Element("clean", XHDRClean_Header, "")
  248. .Attribute("on-off", XHDRClean_OnOff, false)
  249. .Mnemonic("on", "true")
  250. .Mnemonic("off", "false")
  251. .End("clean")
  252. .End("xheaders")
  253. .End("scan")
  254. .End("logs")
  255. .Element("network")
  256. .Element("sync")
  257. .Attribute("secs", network_sync_secs, 30)
  258. .Attribute("host", network_sync_host, "sync.messagesniffer.net")
  259. .Attribute("port", network_sync_port, 25)
  260. .End("sync")
  261. .Element("update-script")
  262. .Attribute("on-off", update_script_on_off, false)
  263. .Mnemonic("on", "true")
  264. .Mnemonic("off", "false")
  265. .Attribute("call", update_script_call, "")
  266. .Attribute("guard-time", update_script_guard_time, 180)
  267. .End("update-script")
  268. .End("network")
  269. .Element("xci")
  270. .Attribute("on-off", XCI_OnOff, true)
  271. .Mnemonic("on", "true")
  272. .Mnemonic("off", "false")
  273. .Attribute("port", XCI_Port, 9001)
  274. .End("xci")
  275. .Element("gbudb")
  276. .Element("database")
  277. .Element("condense")
  278. .Attribute("minimum-seconds-between", gbudb_database_condense_minimum_seconds_between, 600)
  279. .Element("time-trigger")
  280. .Attribute("on-off", gbudb_database_condense_time_trigger_on_off, true)
  281. .Mnemonic("on", "true")
  282. .Mnemonic("off", "false")
  283. .Attribute("seconds", gbudb_database_condense_time_trigger_seconds, 84600)
  284. .End("time-trigger")
  285. .Element("posts-trigger")
  286. .Attribute("on-off", gbudb_database_condense_posts_trigger_on_off, false)
  287. .Mnemonic("on", "true")
  288. .Mnemonic("off", "false")
  289. .Attribute("posts", gbudb_database_condense_posts_trigger_posts, 32768)
  290. .End("posts-trigger")
  291. .Element("records-trigger")
  292. .Attribute("on-off", gbudb_database_condense_records_trigger_on_off, false)
  293. .Mnemonic("on", "true")
  294. .Mnemonic("off", "false")
  295. .Attribute("records", gbudb_database_condense_records_trigger_records, 150000)
  296. .End("records-trigger")
  297. .Element("size-trigger")
  298. .Attribute("on-off", gbudb_database_condense_size_trigger_on_off, false)
  299. .Mnemonic("on", "true")
  300. .Mnemonic("off", "false")
  301. .Attribute("megabytes", gbudb_database_condense_size_trigger_megabytes, 150)
  302. .End("size-trigger")
  303. .End("condense")
  304. .Element("checkpoint")
  305. .Attribute("on-off", gbudb_database_checkpoint_on_off, true)
  306. .Mnemonic("on", "true")
  307. .Mnemonic("off", "false")
  308. .Attribute("secs", gbudb_database_checkpoint_secs, 3600)
  309. .End("checkpoint")
  310. .End("database")
  311. .Element("regions")
  312. .Element("white")
  313. .atStartCall(WhiteRangeInitializer)
  314. .Attribute("on-off", WhiteRangeHandler.On_Off, true)
  315. .Mnemonic("on", "true")
  316. .Mnemonic("off", "false")
  317. .Attribute("symbol", WhiteRangeHandler.Symbol, 0)
  318. .Attribute("priority", WhiteRangeHandler.Priority, 1)
  319. .Element("edge")
  320. .atEndCall(WhiteRangeHandler)
  321. .Attribute("probability", WhiteRangeHandler.EdgeInput.Probability, 0.0)
  322. .Attribute("confidence", WhiteRangeHandler.EdgeInput.Confidence, 0.0)
  323. .End("edge")
  324. .Element("panic")
  325. .Attribute("on-off", gbudb_regions_white_panic_on_off, true)
  326. .Mnemonic("on", "true")
  327. .Mnemonic("off", "false")
  328. .Attribute("rule-range", gbudb_regions_white_panic_rule_range, 1000)
  329. .End("panic")
  330. .End("white")
  331. .Element("black")
  332. .atStartCall(BlackRangeInitializer)
  333. .Attribute("on-off", BlackRangeHandler.On_Off, true)
  334. .Mnemonic("on", "true")
  335. .Mnemonic("off", "false")
  336. .Attribute("symbol", BlackRangeHandler.Symbol, 63)
  337. .mapTo(gbudb_regions_black_truncate_symbol, 63)
  338. .Attribute("priority", BlackRangeHandler.Priority, 2)
  339. .Element("edge")
  340. .atEndCall(BlackRangeHandler)
  341. .Attribute("probability", BlackRangeHandler.EdgeInput.Probability, 0.0)
  342. .Attribute("confidence", BlackRangeHandler.EdgeInput.Confidence, 0.0)
  343. .End("edge")
  344. .Element("truncate")
  345. .Attribute("on-off", gbudb_regions_black_truncate_on_off, true)
  346. .Mnemonic("on", "true")
  347. .Mnemonic("off", "false")
  348. .Attribute("probability", gbudb_regions_black_truncate_probability, 0.5)
  349. .Attribute("peek-one-in", gbudb_regions_black_truncate_peek_one_in, 3)
  350. .Attribute("symbol", gbudb_regions_black_truncate_symbol, 63)
  351. .End("truncate")
  352. .Element("sample")
  353. .Attribute("on-off", gbudb_regions_black_sample_on_off, true)
  354. .Mnemonic("on", "true")
  355. .Mnemonic("off", "false")
  356. .Attribute("probability", gbudb_regions_black_sample_probability, 0.5)
  357. .Attribute("grab-one-in", gbudb_regions_black_sample_grab_one_in, 10)
  358. .Attribute("passthrough", gbudb_regions_black_sample_passthrough, false)
  359. .Attribute("passthrough-symbol", gbudb_regions_black_sample_passthrough_symbol, 0)
  360. .End("sample")
  361. .End("black")
  362. .Element("caution")
  363. .atStartCall(CautionRangeInitializer)
  364. .Attribute("on-off", CautionRangeHandler.On_Off, true)
  365. .Mnemonic("on", "true")
  366. .Mnemonic("off", "false")
  367. .Attribute("symbol", CautionRangeHandler.Symbol, 30)
  368. .Attribute("priority", CautionRangeHandler.Priority, 3)
  369. .Element("edge")
  370. .atEndCall(CautionRangeHandler)
  371. .Attribute("probability", CautionRangeHandler.EdgeInput.Probability, 0.0)
  372. .Attribute("confidence", CautionRangeHandler.EdgeInput.Confidence, 0.0)
  373. .End("edge")
  374. .End("caution")
  375. .End("regions")
  376. .Element("training")
  377. .atStartCall(HeaderDirectivesInitializer)
  378. .Attribute("on-off", GBUdbTrainingOn_Off, true)
  379. .Mnemonic("on", "true")
  380. .Mnemonic("off", "false")
  381. .Element("source")
  382. .Element("header")
  383. .atStartCall(HDSourceHeaderInitializer)
  384. .atEndCall(HeaderDirectivesHandler)
  385. .Attribute("name", HeaderDirectivesHandler.DirectiveInput.Header, "\n\n")
  386. .Attribute("received", HeaderDirectivesHandler.ContextInput.Contains, "\n\n")
  387. .Attribute("ordinal", HeaderDirectivesHandler.ContextInput.Ordinal, 0)
  388. .End("header")
  389. .End("source")
  390. .Element("drilldown")
  391. .Element("received")
  392. .atStartCall(HDDrilldownInitializer)
  393. .atEndCall(HeaderDirectivesHandler)
  394. .Attribute("ordinal", HeaderDirectivesHandler.DirectiveInput.Ordinal, 0)
  395. .Attribute("find", HeaderDirectivesHandler.DirectiveInput.Contains, "\n\n")
  396. .End("received")
  397. .End("drilldown")
  398. .Element("bypass")
  399. .atStartCall(TrainingBypassRuleInitializer)
  400. .Element("result")
  401. .atEndCall(TrainingBypassRuleHandler)
  402. .Attribute("code", TrainingBypassRuleHandler.IntegerInput,-1)
  403. .End("result")
  404. .Element("header")
  405. .atStartCall(HDBypassHeaderInitializer)
  406. .atEndCall(HeaderDirectivesHandler)
  407. .Attribute("name", HeaderDirectivesHandler.DirectiveInput.Header, "\n\n")
  408. .Attribute("ordinal", HeaderDirectivesHandler.DirectiveInput.Ordinal, 0)
  409. .Attribute("find", HeaderDirectivesHandler.DirectiveInput.Contains, "\n\n")
  410. .End("header")
  411. .End("bypass")
  412. .Element("white")
  413. .atStartCall(TrainingWhiteRuleInitializer)
  414. .Element("result")
  415. .atEndCall(TrainingWhiteRuleHandler)
  416. .Attribute("code", TrainingWhiteRuleHandler.IntegerInput,-1)
  417. .End("result")
  418. .Element("header")
  419. .atStartCall(HDWhiteHeaderInitializer)
  420. .atEndCall(HeaderDirectivesHandler)
  421. .Attribute("name", HeaderDirectivesHandler.DirectiveInput.Header, "\n\n")
  422. .Attribute("ordinal", HeaderDirectivesHandler.DirectiveInput.Ordinal, 0)
  423. .Attribute("find", HeaderDirectivesHandler.DirectiveInput.Contains, "\n\n")
  424. .End("header")
  425. .End("white")
  426. .End("training")
  427. .End("gbudb")
  428. .Element("rule-panics")
  429. .atStartCall(RulePanicInitializer)
  430. .Element("rule")
  431. .atEndCall(RulePanicHandler)
  432. .Attribute("id", RulePanicHandler.IntegerInput, -1)
  433. .End("rule")
  434. .End("rule-panics")
  435. .Element("platform", PlatformElementContents, "")
  436. .End("platform")
  437. .Element("msg-file")
  438. .Attribute("type", MessageFileTypeCGP_on_off, false)
  439. .Mnemonic("cgp", "true")
  440. .End("msg-file")
  441. .End("node")
  442. .End("snf");
  443. }
  444. void fixPathTermination(string& s) { // Ensure s ends in a / or a \ as needed.
  445. if(0 == s.length()) return; // If the string is empty we do nothing.
  446. // Determine what our path terminator should be by looking to
  447. // see what separator has already been used.
  448. char Terminator; // This will be our terminator.
  449. if(string::npos == s.find('\\')) { // If we're not using a backslash then
  450. Terminator = '/'; // we will use the forward slash.
  451. } else { // If we are using the backslash then
  452. Terminator = '\\'; // we will remain consistent and terminate
  453. } // with a backslash.
  454. // If the path that's given doesn't have a terminator then we will add
  455. // the appropriate separator to the end.
  456. if( // If the string is
  457. '\\' != s.at(s.length()-1) && // not terminated by a backslash nor
  458. '/' != s.at(s.length()-1) // by a forward slash then
  459. ) { // we will append an appropriate
  460. s.append(1,Terminator); // terminator. Otherwise we will
  461. } // leave it as it is.
  462. }
  463. void snfCFGData::initializeFromFile(const char* FileName) { // Initialize from the provided file.
  464. ConfigurationData MyCFGData(FileName); // Create a cfg data object from the file.
  465. if(0 == MyCFGData.Data(0)) throw false; // If we didn't read a config file throw!
  466. MyCFGReader.initialize(); // Initialize to defaults.
  467. MyCFGReader.interpret(MyCFGData); // Interpret the data.
  468. fixPathTermination(paths_log_path); // Automagically fix / or \ termination
  469. fixPathTermination(paths_rulebase_path); // for the paths provided in the
  470. fixPathTermination(paths_workspace_path); // configuration <path/> section.
  471. ConfigFilePath = FileName; // Set the ConfigFilePath for what we read.
  472. }
  473. snfIPRange snfCFGData::RangeEvaluation(GBUdbRecord& R) { // Returns the range for a GBUdbRecord.
  474. if(Good == R.Flag()) { // If the flag on the IP is Good
  475. return White; // then this IP is automatically white.
  476. } else
  477. if(Bad == R.Flag()) { // If the flag on this IP is Bad
  478. if(true == gbudb_regions_black_truncate_on_off) { // and truncate is turned on then
  479. return Truncate; // the IP is automatically in the
  480. } else { // truncate range. If truncate is off
  481. return Black; // then this IP is automatically black.
  482. }
  483. }
  484. // If it's not so simple then get a
  485. RangePoint P(R.Confidence(), R.Probability()); // range point and evaluate it that way.
  486. return RangeEvaluation(P);
  487. }
  488. snfIPRange snfCFGData::RangeEvaluation(RangePoint& p) { // Returns the range for a RangePoint.
  489. if( // If the IP is unknown, indicated
  490. 0.0 == p.Confidence && // by a zero confidence and
  491. 0.0 == p.Probability // a zero probability, then
  492. ) { // the range point cannot be "in"
  493. return New; // any range.
  494. }
  495. if(WhiteRangeHandler.isInWhite(p)) { // If it's in the white range,
  496. return White; // return White.
  497. } else // White has priority over all others.
  498. if(BlackRangeHandler.isInBlack(p)) { // If it's in the black range then
  499. if(p.Probability >= gbudb_regions_black_truncate_probability) { // determine if it's also in the truncate
  500. return Truncate; // range, and if so - send back Truncate.
  501. } else { // If not then we can send back a
  502. return Black; // normal black result.
  503. }
  504. } else // Black takes precedence over caution.
  505. if(CautionRangeHandler.isInBlack(p)) { // If we're in the caution range
  506. return Caution; // then return caution.
  507. } // If none of those ranges matched then
  508. return Normal; // the IP is in the normal range.
  509. }
  510. //// snfCFGmgr /////////////////////////////////////////////////////////////////
  511. void snfCFGmgr::initialize( // Initialize our configuration data.
  512. const char* FileName,
  513. const char* LicenseId,
  514. const char* Authentication) {
  515. // Check for NULLs and assign Init parameters
  516. InitFileName = (NULL==FileName)?"":FileName; // Initilization parameters are reused
  517. InitLicenseId = (NULL==LicenseId)?"":LicenseId; // any time load() is called.
  518. InitAuthentication = (NULL==Authentication)?"":Authentication;
  519. }
  520. void logCFGData(snfCFGData& D) { // Log interpreted cfg data (debug aid).
  521. try {
  522. string CFGLogPath; // Build the snf_cfg log path.
  523. CFGLogPath = D.paths_log_path +
  524. D.node_licenseid + "_snf_engine_cfg.log";
  525. ofstream cfgl(CFGLogPath.c_str(), ios::trunc); // Open and truncate the cfg log file.
  526. cfgl // Report important cfg information.
  527. << "SNF Engine Configuration" << endl
  528. << "____________" << endl
  529. << "Fundamentals" << endl
  530. << " License: " << D.node_licenseid << endl
  531. << " ConfigFilePath: " << D.ConfigFilePath << endl
  532. << " IdentityFilePath: " << D.node_identity << endl
  533. << " SecurityKey: " << D.SecurityKey << endl
  534. << "_____" << endl
  535. << "Paths" << endl
  536. << " Log Path: " << D.paths_log_path << endl
  537. << " Rulebase Path: " << D.paths_rulebase_path << endl
  538. << " Workspace Path: " << D.paths_workspace_path << endl
  539. << " RuleFilePath: " << D.RuleFilePath << endl
  540. << "____" << endl
  541. << "Logs" << endl
  542. << endl
  543. << " Rotation-Midnight: " << ((D.Logs_Rotation_LocalTime_OnOff)? "Local" : "UTC") << endl
  544. << " ______" << endl
  545. << " Status" << endl
  546. << " PerSecond: "
  547. << ((D.Status_SecondReport_Log_OnOff)? "yes, " : "no, ")
  548. << "Append: "
  549. << ((D.Status_SecondReport_Append_OnOff)? "yes" : "no")
  550. << endl
  551. << " PerMinute: "
  552. << ((D.Status_MinuteReport_Log_OnOff)? "yes, " : "no, ")
  553. << "Append: "
  554. << ((D.Status_MinuteReport_Append_OnOff)? "yes" : "no")
  555. << endl
  556. << " PerHour: "
  557. << ((D.Status_HourReport_Log_OnOff)? "yes, " : "no, ")
  558. << "Append: "
  559. << ((D.Status_HourReport_Append_OnOff)? "yes" : "no")
  560. << endl
  561. << " ____" << endl
  562. << " Scan" << endl
  563. << " Identifier: "
  564. << ((D.Scan_Identifier_Force_Message_Id)? "Force RFC822 Message-ID" : "Use Provided Identifier")
  565. << endl
  566. << " Classic: Output-"
  567. << ((LogOutputMode_None == D.Scan_Classic_Mode)? "None, " :
  568. ((LogOutputMode_API == D.Scan_Classic_Mode)? "API, " :
  569. ((LogOutputMode_File == D.Scan_Classic_Mode)? "File, " : "Error!")))
  570. << ((D.Scan_Classic_Rotate)? "Rotating, ": "Non-Rotating, ")
  571. << ((D.Scan_Classic_Matches == ScanLogMatches_None) ? "No Mathes":
  572. ((D.Scan_Classic_Matches == ScanLogMatches_Unique) ? "Unique Matches":
  573. ((D.Scan_Classic_Matches == ScanLogMatches_All) ? "All Matches" : "Error!")))
  574. << endl
  575. << " XML: Output-"
  576. << ((LogOutputMode_None == D.Scan_XML_Mode)? "None, " :
  577. ((LogOutputMode_API == D.Scan_XML_Mode)? "API, " :
  578. ((LogOutputMode_File == D.Scan_XML_Mode)? "File, " : "Error!")))
  579. << ((D.Scan_XML_Rotate)? "Rotating, ": "Non-Rotating, ")
  580. << ((D.Scan_XML_Matches == ScanLogMatches_None) ? "No Mathes, ":
  581. ((D.Scan_XML_Matches == ScanLogMatches_Unique) ? "Unique Matches, ":
  582. ((D.Scan_XML_Matches == ScanLogMatches_All) ? "All Matches, " : "Match Error! ")))
  583. << ((D.Scan_XML_Performance)? "Performance Metrics, " : "No Performance Metrics, ")
  584. << ((D.Scan_XML_GBUdb)? "GBUdb Data" : "No GBUdb Data")
  585. << endl
  586. << " XHeaders:" << endl
  587. << " Output: "
  588. << ((LogOutputMode_None == D.XHDROutput_Mode) ? "None" :
  589. ((LogOutputMode_API == D.XHDROutput_Mode) ? "API" :
  590. ((LogOutputMode_File == D.XHDROutput_Mode) ? "File" :
  591. ((LogOutputMode_Inject == D.XHDROutput_Mode)? "Inject" : "Error!"))))
  592. << endl
  593. << " Version: "
  594. << ((D.XHDRVersion_OnOff)? "On, " : "Off, ")
  595. << D.XHDRVersion_Header
  596. << endl
  597. << " License: "
  598. << ((D.XHDRLicense_OnOff)? "On, " : "Off, ")
  599. << D.XHDRLicense_Header
  600. << endl
  601. << " Rulebase: "
  602. << ((D.XHDRRulebase_OnOff)? "On, " : "Off, ")
  603. << D.XHDRRulebase_Header
  604. << endl
  605. << " Identifier: "
  606. << ((D.XHDRIdentifier_OnOff)? "On, " : "Off, ")
  607. << D.XHDRIdentifier_Header
  608. << endl
  609. << " GBUdb: "
  610. << ((D.XHDRGBUdb_OnOff)? "On, " : "Off, ")
  611. << D.XHDRGBUdb_Header
  612. << endl
  613. << " Result: "
  614. << ((D.XHDRResult_OnOff)? "On, " : "Off, ")
  615. << D.XHDRResult_Header
  616. << endl
  617. << " Matches: "
  618. << ((D.XHDRMatches_OnOff)? "On, " : "Off, ")
  619. << D.XHDRMatches_Header
  620. << endl
  621. << " Black: "
  622. << ((D.XHDRBlack_OnOff)? "On, " : "Off, ")
  623. << D.XHDRBlack_Header
  624. << endl
  625. << " White: "
  626. << ((D.XHDRWhite_OnOff)? "On, " : "Off, ")
  627. << D.XHDRWhite_Header
  628. << endl
  629. << " Clean: "
  630. << ((D.XHDRClean_OnOff)? "On, " : "Off, ")
  631. << D.XHDRClean_Header
  632. << endl;
  633. for(
  634. set<XHDRSymbol>::iterator iH = D.XHDRSymbolHeaders.SymbolHeaders.begin();
  635. iH != D.XHDRSymbolHeaders.SymbolHeaders.end(); iH++
  636. ) {
  637. cfgl
  638. << " Symbol: "
  639. << (*iH).Symbol << ", "
  640. << (*iH).Header
  641. << endl;
  642. }
  643. cfgl
  644. << "_______" << endl
  645. << "Network" << endl
  646. << " Sync Host: " << D.network_sync_host << endl
  647. << " Sync Port: " << D.network_sync_port << endl
  648. << " Sync Secs: " << D.network_sync_secs << endl
  649. << " _____________" << endl
  650. << " Update-Script" << endl
  651. << " On-Off: " << ((D.update_script_on_off) ? "On" : "Off") << endl
  652. << " Script: " << D.update_script_call << endl
  653. << " Guard-Time: " << D.update_script_guard_time << " seconds" << endl
  654. << "___" << endl
  655. << "XCI" << endl
  656. << " " << ((D.XCI_OnOff)? "Enabled" : "Disabled") << endl
  657. << " Port: " << D.XCI_Port << endl
  658. << "_____" << endl
  659. << "GBUdb" << endl
  660. << " ____________" << endl
  661. << " Condensation" << endl
  662. << " Minimum-Seconds-Between = " << D.gbudb_database_condense_minimum_seconds_between << endl
  663. << " Time-Trigger: "
  664. << ((D.gbudb_database_condense_time_trigger_on_off)? "on, " : "off, ")
  665. << D.gbudb_database_condense_time_trigger_seconds << " seconds" << endl
  666. << " Posts-Trigger: "
  667. << ((D.gbudb_database_condense_posts_trigger_on_off)? "on, " : "off, ")
  668. << D.gbudb_database_condense_posts_trigger_posts << " posts" << endl
  669. << " Records-Trigger: "
  670. << ((D.gbudb_database_condense_records_trigger_on_off) ? "on, " : "off, ")
  671. << D.gbudb_database_condense_records_trigger_records << " records" << endl
  672. << " Size-Trigger: "
  673. << ((D.gbudb_database_condense_size_trigger_on_off) ? "on, " : "off, ")
  674. << D.gbudb_database_condense_size_trigger_megabytes << " megabytes" << endl
  675. << " __________" << endl
  676. << " Checkpoint" << endl
  677. << " Checkpoint: "
  678. << ((D.gbudb_database_checkpoint_on_off) ? "on, " : "off, ")
  679. << D.gbudb_database_checkpoint_secs << " seconds" << endl
  680. << " ______" << endl
  681. << " Ranges" << endl
  682. << " White: "
  683. << ((D.WhiteRangeHandler.On_Off) ? "on, " : "off, ")
  684. << "Symbol " << D.WhiteRangeHandler.Symbol << endl
  685. << " Auto-Panic: "
  686. << ((D.gbudb_regions_white_panic_on_off) ? "on, " : "off, ")
  687. << "Range " << D.gbudb_regions_white_panic_rule_range << endl
  688. << endl
  689. << " Caution: "
  690. << ((D.CautionRangeHandler.On_Off) ? "on, " : "off, ")
  691. << "Symbol " << D.CautionRangeHandler.Symbol << endl
  692. << endl
  693. << " Black: "
  694. << ((D.BlackRangeHandler.On_Off) ? "on, " : "off, ")
  695. << "Symbol " << D.BlackRangeHandler.Symbol << endl
  696. << " Truncate: "
  697. << ((D.gbudb_regions_black_truncate_on_off) ? "on, " : "off, ")
  698. << "Probability " << D.gbudb_regions_black_truncate_probability << ", "
  699. << "Peek-One-In " << D.gbudb_regions_black_truncate_peek_one_in << ", "
  700. << "Symbol " << D.gbudb_regions_black_truncate_symbol << endl
  701. << " Sample: "
  702. << ((D.gbudb_regions_black_sample_on_off) ? "on, " : "off, ")
  703. << "Probability: " << D.gbudb_regions_black_sample_probability << ", "
  704. << "Grab-One-In: " << D.gbudb_regions_black_sample_grab_one_in << ", " << endl
  705. << " Passthrough: "
  706. << ((D.gbudb_regions_black_sample_passthrough) ? "yes, " : "no, ")
  707. << "Passthrough Symbol " << D.gbudb_regions_black_sample_passthrough_symbol << endl
  708. << endl
  709. << " Range Map - [W]hite [B]lack [C]aution [ ]undefined" << endl << endl
  710. << " |-9876543210123456789+|" << endl;
  711. // Output GBUdb Range Map
  712. for(double c = 0; c < 1.01; c+=0.1) { // Run through the confidence
  713. cfgl << " |";
  714. for(double p = -1.0; p < 1.01; p+=0.1) { // and probability ranges.
  715. RangePoint t(c,p); // Test the range point w/ c & p
  716. if(D.WhiteRangeHandler.isInWhite(t)) { // If it's in the white range
  717. cfgl << "W"; // put in a W.
  718. } else
  719. if(D.BlackRangeHandler.isInBlack(t)) { // If it's in the black range
  720. cfgl << "B"; // put in a B.
  721. } else
  722. if(D.CautionRangeHandler.isInBlack(t)) { // If it's in the caution range
  723. cfgl << "C"; // put in a C.
  724. } else {
  725. cfgl << " "; // Otherwise put in a space.
  726. }
  727. }
  728. cfgl << "|" << c << endl;
  729. }
  730. cfgl << " |---------------------|" << endl;
  731. cfgl
  732. << endl
  733. << " ________" << endl
  734. << " Training" << endl
  735. << " GBUdb Updates: "
  736. << ((D.GBUdbTrainingOn_Off)? "Enabled" : "Disabled") << endl
  737. << endl;
  738. cfgl
  739. << " Source Header Directives: " << endl;
  740. for(
  741. HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin();
  742. iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++
  743. ) {
  744. const HeaderFinderPattern& Dx = *iD;
  745. if(HeaderDirectiveContext == Dx.Directive) {
  746. cfgl
  747. << " "
  748. << "Context " << Dx.Context << " is a "
  749. << Dx.Header << " header at"
  750. << " Ordinal " << Dx.Ordinal
  751. << " that Contains " << Dx.Contains << endl;
  752. } else
  753. if(HeaderDirectiveSource == Dx.Directive) {
  754. cfgl
  755. << " "
  756. << "Context " << Dx.Context << " Source ip is in "
  757. << Dx.Header << " header at"
  758. << " Ordinal " << Dx.Ordinal << endl;
  759. }
  760. }
  761. cfgl << endl;
  762. cfgl
  763. << " Drilldown Header Directives: " << endl;
  764. for(
  765. HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin();
  766. iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++
  767. ) {
  768. const HeaderFinderPattern& Dx = *iD;
  769. if(HeaderDirectiveDrillDown == Dx.Directive) {
  770. cfgl
  771. << " "
  772. << Dx.Header << " header at"
  773. << " Ordinal " << Dx.Ordinal
  774. << " Contains " << Dx.Contains << endl;
  775. }
  776. }
  777. cfgl << endl;
  778. cfgl
  779. << " Bypass Header Directives: " << endl;
  780. for(
  781. HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin();
  782. iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++
  783. ) {
  784. const HeaderFinderPattern& Dx = *iD;
  785. if(HeaderDirectiveBypass == Dx.Directive) {
  786. cfgl
  787. << " "
  788. << Dx.Header << " header at"
  789. << " Ordinal " << Dx.Ordinal
  790. << " Contains " << Dx.Contains << endl;
  791. }
  792. }
  793. cfgl << endl;
  794. cfgl
  795. << " White Rule Header Directives: " << endl;
  796. for(
  797. HeaderDirectiveSet::iterator iD = D.HeaderDirectivesHandler.HeaderDirectives.begin();
  798. iD != D.HeaderDirectivesHandler.HeaderDirectives.end(); iD++
  799. ) {
  800. const HeaderFinderPattern& Dx = *iD;
  801. if(HeaderDirectiveWhite == Dx.Directive) {
  802. cfgl
  803. << " "
  804. << Dx.Header << " header at"
  805. << " Ordinal " << Dx.Ordinal
  806. << " Contains " << Dx.Contains << endl;
  807. }
  808. }
  809. cfgl << endl;
  810. cfgl
  811. << " White Rule Symbols: ";
  812. // Output white rule symbols
  813. for(
  814. set<int>::iterator ix = D.TrainingWhiteRuleHandler.IntegerSet.begin();
  815. ix != D.TrainingWhiteRuleHandler.IntegerSet.end();
  816. ix ++) {
  817. if(D.TrainingWhiteRuleHandler.IntegerSet.begin() != ix) {
  818. cfgl << ", ";
  819. }
  820. cfgl << (*ix);
  821. }
  822. cfgl << endl;
  823. // Rule Panics
  824. cfgl
  825. << "___________" << endl
  826. << "Rule-Panics" << endl;
  827. for(
  828. set<int>::iterator ix = D.RulePanicHandler.IntegerSet.begin();
  829. ix != D.RulePanicHandler.IntegerSet.end();
  830. ix ++) {
  831. cfgl << " Rule ID: " << (*ix) << endl;
  832. }
  833. cfgl << endl;
  834. cfgl
  835. << "___________" << endl
  836. << "Integration" << endl
  837. << endl
  838. << " Message Format: "
  839. << ((D.MessageFileTypeCGP_on_off)? "CGP" : "RFC822")
  840. << endl;
  841. #ifdef __BIG_ENDIAN__
  842. cfgl << " Rulebase Conversion: BIG ENDIAN" << endl;
  843. #else
  844. cfgl << " Rulebase Conversion: LITTLE ENDIAN" << endl;
  845. #endif
  846. cfgl
  847. << "________" << endl
  848. << "Platform" << endl
  849. << D.PlatformElementContents
  850. << endl;
  851. cfgl << endl; // End with a new line.
  852. cfgl.close(); // Close the cfg log file.
  853. } catch (...) {} // Ignore any errors.
  854. }
  855. void snfCFGmgr::load() {
  856. // What shall we configure -- the inactive snfCFGData.
  857. snfCFGData& CFGData = InactiveData();
  858. // How shall we configure?
  859. // If FileName ends in .snf then find the .cfg file for details.
  860. // If the FileName ends some other way it _should_ be our cfg file.
  861. int PathLength = InitFileName.length(); // How long is the path?
  862. const int MinimumPathLength = 12; // Must be at least licensid.snf long.
  863. if(MinimumPathLength > PathLength) throw LoadFailure(); // Path length is impossible? throw!
  864. const string SNFExt = ".snf"; // The extension we are looking for.
  865. const string CFGExt = ".xml"; // The default cfg extension.
  866. const int SNFExtLength = SNFExt.length(); // The length of the extension.
  867. int SNFExtPosition = InitFileName.rfind(SNFExt,PathLength); // Find the extension at the end.
  868. bool InitPathIsRulebase = false; // Was the init FileName the Rulebase?
  869. bool InitLicenseIdIsProvided = (0 < InitLicenseId.length()); // Was the init LicenseId provided?
  870. bool InitAuthenticationIsProvided = (0 < InitAuthentication.length()); // Was the authentication provided?
  871. if((PathLength - SNFExtLength) == SNFExtPosition) { // If path ends in .snf then
  872. InitPathIsRulebase = true; // set our flag to keep track then set
  873. ConfigurationPath = InitFileName.substr(0,SNFExtPosition); // our configuration path as the init
  874. ConfigurationPath.append(CFGExt); // file name with the config extension.
  875. } else { // If the init file is not a rulebase
  876. ConfigurationPath = InitFileName; // then it is the config file name.
  877. }
  878. // At this point we know where to read our configuration from.
  879. try { CFGData.initializeFromFile(ConfigurationPath.c_str()); } // Initialize the inactive config.
  880. catch(...) { // If that failed then throw.
  881. throw LoadFailure();
  882. }
  883. // Now that the main config has been read we create the derived cfg data.
  884. // Anything that was provided in Init takes precedence over the config.
  885. //// SecurityKey
  886. //// If an identity path has been provided we must load that data.
  887. if(0 < CFGData.node_identity.length()) { // If an identity path was provided
  888. ConfigurationData Identity(CFGData.node_identity.c_str()); // then get the data from that file.
  889. ConfigurationElement IdentityReader("snf"); // Create an Identity reader and
  890. IdentityReader // configure it.
  891. .Element("identity")
  892. .Attribute("licenseid", CFGData.node_licenseid)
  893. .Attribute("authentication", CFGData.node_authentication)
  894. .End("identity")
  895. .End("snf");
  896. IdentityReader.interpret(Identity); // Then read the data.
  897. }
  898. //// The SecurityKey is built from the licenseID and the Authentication
  899. if(InitLicenseIdIsProvided) { // If the LicenseID has been provided then
  900. CFGData.SecurityKey = InitLicenseId; // the first part of our security key is that.
  901. } else { // If it was not provided then we will get
  902. CFGData.SecurityKey = CFGData.node_licenseid; // the LicenseID from our config file.
  903. }
  904. if(InitAuthenticationIsProvided) { // If the Authentication has been provided then
  905. CFGData.SecurityKey += InitAuthentication; // we use it for the second part of our
  906. } else { // security key. Otherwise we will get the
  907. CFGData.SecurityKey += CFGData.node_authentication; // Authentication from the config file.
  908. }
  909. //// RuleFilePath
  910. if(InitPathIsRulebase) { // If the Rulebase path was provided
  911. CFGData.RuleFilePath = InitFileName; // then we have our rulebase path.
  912. } else { // If not then we must figure it out...
  913. CFGData.RuleFilePath = // We build the path from the base
  914. CFGData.paths_rulebase_path + // rulebase path concattonated with
  915. CFGData.node_licenseid + // the license id concattonated with
  916. SNFExt; // the rulebase extension.
  917. }
  918. // Once all of the configuration data is correct we make it active.
  919. swapCFGData(); // Then swap it into the active state.
  920. // Log the configuration data as it was interpreted.
  921. logCFGData(ActiveData());
  922. }