maintidi.c 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194
  1. /*
  2. *
  3. Copyright (c) Eicon Networks, 2000.
  4. *
  5. This source file is supplied for the use with
  6. Eicon Networks range of DIVA Server Adapters.
  7. *
  8. Eicon File Revision : 1.9
  9. *
  10. This program is free software; you can redistribute it and/or modify
  11. it under the terms of the GNU General Public License as published by
  12. the Free Software Foundation; either version 2, or (at your option)
  13. any later version.
  14. *
  15. This program is distributed in the hope that it will be useful,
  16. but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
  17. implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  18. See the GNU General Public License for more details.
  19. *
  20. You should have received a copy of the GNU General Public License
  21. along with this program; if not, write to the Free Software
  22. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23. *
  24. */
  25. #include "platform.h"
  26. #include "kst_ifc.h"
  27. #include "di_defs.h"
  28. #include "maintidi.h"
  29. #include "pc.h"
  30. #include "man_defs.h"
  31. extern void diva_mnt_internal_dprintf(dword drv_id, dword type, char *p, ...);
  32. #define MODEM_PARSE_ENTRIES 16 /* amount of variables of interest */
  33. #define FAX_PARSE_ENTRIES 12 /* amount of variables of interest */
  34. #define LINE_PARSE_ENTRIES 15 /* amount of variables of interest */
  35. #define STAT_PARSE_ENTRIES 70 /* amount of variables of interest */
  36. /*
  37. LOCAL FUNCTIONS
  38. */
  39. static int DivaSTraceLibraryStart(void *hLib);
  40. static int DivaSTraceLibraryStop(void *hLib);
  41. static int SuperTraceLibraryFinit(void *hLib);
  42. static void *SuperTraceGetHandle(void *hLib);
  43. static int SuperTraceMessageInput(void *hLib);
  44. static int SuperTraceSetAudioTap(void *hLib, int Channel, int on);
  45. static int SuperTraceSetBChannel(void *hLib, int Channel, int on);
  46. static int SuperTraceSetDChannel(void *hLib, int on);
  47. static int SuperTraceSetInfo(void *hLib, int on);
  48. static int SuperTraceClearCall(void *hLib, int Channel);
  49. static int SuperTraceGetOutgoingCallStatistics(void *hLib);
  50. static int SuperTraceGetIncomingCallStatistics(void *hLib);
  51. static int SuperTraceGetModemStatistics(void *hLib);
  52. static int SuperTraceGetFaxStatistics(void *hLib);
  53. static int SuperTraceGetBLayer1Statistics(void *hLib);
  54. static int SuperTraceGetBLayer2Statistics(void *hLib);
  55. static int SuperTraceGetDLayer1Statistics(void *hLib);
  56. static int SuperTraceGetDLayer2Statistics(void *hLib);
  57. /*
  58. LOCAL FUNCTIONS
  59. */
  60. static int ScheduleNextTraceRequest(diva_strace_context_t *pLib);
  61. static int process_idi_event(diva_strace_context_t *pLib,
  62. diva_man_var_header_t *pVar);
  63. static int process_idi_info(diva_strace_context_t *pLib,
  64. diva_man_var_header_t *pVar);
  65. static int diva_modem_event(diva_strace_context_t *pLib, int Channel);
  66. static int diva_fax_event(diva_strace_context_t *pLib, int Channel);
  67. static int diva_line_event(diva_strace_context_t *pLib, int Channel);
  68. static int diva_modem_info(diva_strace_context_t *pLib,
  69. int Channel,
  70. diva_man_var_header_t *pVar);
  71. static int diva_fax_info(diva_strace_context_t *pLib,
  72. int Channel,
  73. diva_man_var_header_t *pVar);
  74. static int diva_line_info(diva_strace_context_t *pLib,
  75. int Channel,
  76. diva_man_var_header_t *pVar);
  77. static int diva_ifc_statistics(diva_strace_context_t *pLib,
  78. diva_man_var_header_t *pVar);
  79. static diva_man_var_header_t *get_next_var(diva_man_var_header_t *pVar);
  80. static diva_man_var_header_t *find_var(diva_man_var_header_t *pVar,
  81. const char *name);
  82. static int diva_strace_read_int(diva_man_var_header_t *pVar, int *var);
  83. static int diva_strace_read_uint(diva_man_var_header_t *pVar, dword *var);
  84. static int diva_strace_read_asz(diva_man_var_header_t *pVar, char *var);
  85. static int diva_strace_read_asc(diva_man_var_header_t *pVar, char *var);
  86. static int diva_strace_read_ie(diva_man_var_header_t *pVar,
  87. diva_trace_ie_t *var);
  88. static void diva_create_parse_table(diva_strace_context_t *pLib);
  89. static void diva_trace_error(diva_strace_context_t *pLib,
  90. int error, const char *file, int line);
  91. static void diva_trace_notify_user(diva_strace_context_t *pLib,
  92. int Channel,
  93. int notify_subject);
  94. static int diva_trace_read_variable(diva_man_var_header_t *pVar,
  95. void *variable);
  96. /*
  97. Initialize the library and return context
  98. of the created trace object that will represent
  99. the IDI adapter.
  100. Return 0 on error.
  101. */
  102. diva_strace_library_interface_t *DivaSTraceLibraryCreateInstance(int Adapter,
  103. const diva_trace_library_user_interface_t *user_proc,
  104. byte *pmem) {
  105. diva_strace_context_t *pLib = (diva_strace_context_t *)pmem;
  106. int i;
  107. if (!pLib) {
  108. return NULL;
  109. }
  110. pmem += sizeof(*pLib);
  111. memset(pLib, 0x00, sizeof(*pLib));
  112. pLib->Adapter = Adapter;
  113. /*
  114. Set up Library Interface
  115. */
  116. pLib->instance.hLib = pLib;
  117. pLib->instance.DivaSTraceLibraryStart = DivaSTraceLibraryStart;
  118. pLib->instance.DivaSTraceLibraryStop = DivaSTraceLibraryStop;
  119. pLib->instance.DivaSTraceLibraryFinit = SuperTraceLibraryFinit;
  120. pLib->instance.DivaSTraceMessageInput = SuperTraceMessageInput;
  121. pLib->instance.DivaSTraceGetHandle = SuperTraceGetHandle;
  122. pLib->instance.DivaSTraceSetAudioTap = SuperTraceSetAudioTap;
  123. pLib->instance.DivaSTraceSetBChannel = SuperTraceSetBChannel;
  124. pLib->instance.DivaSTraceSetDChannel = SuperTraceSetDChannel;
  125. pLib->instance.DivaSTraceSetInfo = SuperTraceSetInfo;
  126. pLib->instance.DivaSTraceGetOutgoingCallStatistics = \
  127. SuperTraceGetOutgoingCallStatistics;
  128. pLib->instance.DivaSTraceGetIncomingCallStatistics = \
  129. SuperTraceGetIncomingCallStatistics;
  130. pLib->instance.DivaSTraceGetModemStatistics = \
  131. SuperTraceGetModemStatistics;
  132. pLib->instance.DivaSTraceGetFaxStatistics = \
  133. SuperTraceGetFaxStatistics;
  134. pLib->instance.DivaSTraceGetBLayer1Statistics = \
  135. SuperTraceGetBLayer1Statistics;
  136. pLib->instance.DivaSTraceGetBLayer2Statistics = \
  137. SuperTraceGetBLayer2Statistics;
  138. pLib->instance.DivaSTraceGetDLayer1Statistics = \
  139. SuperTraceGetDLayer1Statistics;
  140. pLib->instance.DivaSTraceGetDLayer2Statistics = \
  141. SuperTraceGetDLayer2Statistics;
  142. pLib->instance.DivaSTraceClearCall = SuperTraceClearCall;
  143. if (user_proc) {
  144. pLib->user_proc_table.user_context = user_proc->user_context;
  145. pLib->user_proc_table.notify_proc = user_proc->notify_proc;
  146. pLib->user_proc_table.trace_proc = user_proc->trace_proc;
  147. pLib->user_proc_table.error_notify_proc = user_proc->error_notify_proc;
  148. }
  149. if (!(pLib->hAdapter = SuperTraceOpenAdapter(Adapter))) {
  150. diva_mnt_internal_dprintf(0, DLI_ERR, "Can not open XDI adapter");
  151. return NULL;
  152. }
  153. pLib->Channels = SuperTraceGetNumberOfChannels(pLib->hAdapter);
  154. /*
  155. Calculate amount of parte table entites necessary to translate
  156. information from all events of onterest
  157. */
  158. pLib->parse_entries = (MODEM_PARSE_ENTRIES + FAX_PARSE_ENTRIES + \
  159. STAT_PARSE_ENTRIES + \
  160. LINE_PARSE_ENTRIES + 1) * pLib->Channels;
  161. pLib->parse_table = (diva_strace_path2action_t *)pmem;
  162. for (i = 0; i < 30; i++) {
  163. pLib->lines[i].pInterface = &pLib->Interface;
  164. pLib->lines[i].pInterfaceStat = &pLib->InterfaceStat;
  165. }
  166. pLib->e.R = &pLib->RData;
  167. pLib->req_busy = 1;
  168. pLib->rc_ok = ASSIGN_OK;
  169. diva_create_parse_table(pLib);
  170. return ((diva_strace_library_interface_t *)pLib);
  171. }
  172. static int DivaSTraceLibraryStart(void *hLib) {
  173. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  174. return (SuperTraceASSIGN(pLib->hAdapter, pLib->buffer));
  175. }
  176. /*
  177. Return (-1) on error
  178. Return (0) if was initiated or pending
  179. Return (1) if removal is complete
  180. */
  181. static int DivaSTraceLibraryStop(void *hLib) {
  182. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  183. if (!pLib->e.Id) { /* Was never started/assigned */
  184. return (1);
  185. }
  186. switch (pLib->removal_state) {
  187. case 0:
  188. pLib->removal_state = 1;
  189. ScheduleNextTraceRequest(pLib);
  190. break;
  191. case 3:
  192. return (1);
  193. }
  194. return (0);
  195. }
  196. static int SuperTraceLibraryFinit(void *hLib) {
  197. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  198. if (pLib) {
  199. if (pLib->hAdapter) {
  200. SuperTraceCloseAdapter(pLib->hAdapter);
  201. }
  202. return (0);
  203. }
  204. return (-1);
  205. }
  206. static void *SuperTraceGetHandle(void *hLib) {
  207. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  208. return (&pLib->e);
  209. }
  210. /*
  211. After library handle object is gone in signaled state
  212. this function should be called and will pick up incoming
  213. IDI messages (return codes and indications).
  214. */
  215. static int SuperTraceMessageInput(void *hLib) {
  216. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  217. int ret = 0;
  218. byte Rc, Ind;
  219. if (pLib->e.complete == 255) {
  220. /*
  221. Process return code
  222. */
  223. pLib->req_busy = 0;
  224. Rc = pLib->e.Rc;
  225. pLib->e.Rc = 0;
  226. if (pLib->removal_state == 2) {
  227. pLib->removal_state = 3;
  228. return (0);
  229. }
  230. if (Rc != pLib->rc_ok) {
  231. int ignore = 0;
  232. /*
  233. Auto-detect amount of events/channels and features
  234. */
  235. if (pLib->general_b_ch_event == 1) {
  236. pLib->general_b_ch_event = 2;
  237. ignore = 1;
  238. } else if (pLib->general_fax_event == 1) {
  239. pLib->general_fax_event = 2;
  240. ignore = 1;
  241. } else if (pLib->general_mdm_event == 1) {
  242. pLib->general_mdm_event = 2;
  243. ignore = 1;
  244. } else if ((pLib->ChannelsTraceActive < pLib->Channels) && pLib->ChannelsTraceActive) {
  245. pLib->ChannelsTraceActive = pLib->Channels;
  246. ignore = 1;
  247. } else if (pLib->ModemTraceActive < pLib->Channels) {
  248. pLib->ModemTraceActive = pLib->Channels;
  249. ignore = 1;
  250. } else if (pLib->FaxTraceActive < pLib->Channels) {
  251. pLib->FaxTraceActive = pLib->Channels;
  252. ignore = 1;
  253. } else if (pLib->audio_trace_init == 2) {
  254. ignore = 1;
  255. pLib->audio_trace_init = 1;
  256. } else if (pLib->eye_pattern_pending) {
  257. pLib->eye_pattern_pending = 0;
  258. ignore = 1;
  259. } else if (pLib->audio_tap_pending) {
  260. pLib->audio_tap_pending = 0;
  261. ignore = 1;
  262. }
  263. if (!ignore) {
  264. return (-1); /* request failed */
  265. }
  266. } else {
  267. if (pLib->general_b_ch_event == 1) {
  268. pLib->ChannelsTraceActive = pLib->Channels;
  269. pLib->general_b_ch_event = 2;
  270. } else if (pLib->general_fax_event == 1) {
  271. pLib->general_fax_event = 2;
  272. pLib->FaxTraceActive = pLib->Channels;
  273. } else if (pLib->general_mdm_event == 1) {
  274. pLib->general_mdm_event = 2;
  275. pLib->ModemTraceActive = pLib->Channels;
  276. }
  277. }
  278. if (pLib->audio_trace_init == 2) {
  279. pLib->audio_trace_init = 1;
  280. }
  281. pLib->rc_ok = 0xff; /* default OK after assign was done */
  282. if ((ret = ScheduleNextTraceRequest(pLib))) {
  283. return (-1);
  284. }
  285. } else {
  286. /*
  287. Process indication
  288. Always 'RNR' indication if return code is pending
  289. */
  290. Ind = pLib->e.Ind;
  291. pLib->e.Ind = 0;
  292. if (pLib->removal_state) {
  293. pLib->e.RNum = 0;
  294. pLib->e.RNR = 2;
  295. } else if (pLib->req_busy) {
  296. pLib->e.RNum = 0;
  297. pLib->e.RNR = 1;
  298. } else {
  299. if (pLib->e.complete != 0x02) {
  300. /*
  301. Look-ahead call, set up buffers
  302. */
  303. pLib->e.RNum = 1;
  304. pLib->e.R->P = (byte *)&pLib->buffer[0];
  305. pLib->e.R->PLength = (word)(sizeof(pLib->buffer) - 1);
  306. } else {
  307. /*
  308. Indication reception complete, process it now
  309. */
  310. byte *p = (byte *)&pLib->buffer[0];
  311. pLib->buffer[pLib->e.R->PLength] = 0; /* terminate I.E. with zero */
  312. switch (Ind) {
  313. case MAN_COMBI_IND: {
  314. int total_length = pLib->e.R->PLength;
  315. word this_ind_length;
  316. while (total_length > 3 && *p) {
  317. Ind = *p++;
  318. this_ind_length = (word)p[0] | ((word)p[1] << 8);
  319. p += 2;
  320. switch (Ind) {
  321. case MAN_INFO_IND:
  322. if (process_idi_info(pLib, (diva_man_var_header_t *)p)) {
  323. return (-1);
  324. }
  325. break;
  326. case MAN_EVENT_IND:
  327. if (process_idi_event(pLib, (diva_man_var_header_t *)p)) {
  328. return (-1);
  329. }
  330. break;
  331. case MAN_TRACE_IND:
  332. if (pLib->trace_on == 1) {
  333. /*
  334. Ignore first trace event that is result of
  335. EVENT_ON operation
  336. */
  337. pLib->trace_on++;
  338. } else {
  339. /*
  340. Delivery XLOG buffer to application
  341. */
  342. if (pLib->user_proc_table.trace_proc) {
  343. (*(pLib->user_proc_table.trace_proc))(pLib->user_proc_table.user_context,
  344. &pLib->instance, pLib->Adapter,
  345. p, this_ind_length);
  346. }
  347. }
  348. break;
  349. default:
  350. diva_mnt_internal_dprintf(0, DLI_ERR, "Unknown IDI Ind (DMA mode): %02x", Ind);
  351. }
  352. p += (this_ind_length + 1);
  353. total_length -= (4 + this_ind_length);
  354. }
  355. } break;
  356. case MAN_INFO_IND:
  357. if (process_idi_info(pLib, (diva_man_var_header_t *)p)) {
  358. return (-1);
  359. }
  360. break;
  361. case MAN_EVENT_IND:
  362. if (process_idi_event(pLib, (diva_man_var_header_t *)p)) {
  363. return (-1);
  364. }
  365. break;
  366. case MAN_TRACE_IND:
  367. if (pLib->trace_on == 1) {
  368. /*
  369. Ignore first trace event that is result of
  370. EVENT_ON operation
  371. */
  372. pLib->trace_on++;
  373. } else {
  374. /*
  375. Delivery XLOG buffer to application
  376. */
  377. if (pLib->user_proc_table.trace_proc) {
  378. (*(pLib->user_proc_table.trace_proc))(pLib->user_proc_table.user_context,
  379. &pLib->instance, pLib->Adapter,
  380. p, pLib->e.R->PLength);
  381. }
  382. }
  383. break;
  384. default:
  385. diva_mnt_internal_dprintf(0, DLI_ERR, "Unknown IDI Ind: %02x", Ind);
  386. }
  387. }
  388. }
  389. }
  390. if ((ret = ScheduleNextTraceRequest(pLib))) {
  391. return (-1);
  392. }
  393. return (ret);
  394. }
  395. /*
  396. Internal state machine responsible for scheduling of requests
  397. */
  398. static int ScheduleNextTraceRequest(diva_strace_context_t *pLib) {
  399. char name[64];
  400. int ret = 0;
  401. int i;
  402. if (pLib->req_busy) {
  403. return (0);
  404. }
  405. if (pLib->removal_state == 1) {
  406. if (SuperTraceREMOVE(pLib->hAdapter)) {
  407. pLib->removal_state = 3;
  408. } else {
  409. pLib->req_busy = 1;
  410. pLib->removal_state = 2;
  411. }
  412. return (0);
  413. }
  414. if (pLib->removal_state) {
  415. return (0);
  416. }
  417. if (!pLib->general_b_ch_event) {
  418. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, "State\\B Event", pLib->buffer))) {
  419. return (-1);
  420. }
  421. pLib->general_b_ch_event = 1;
  422. pLib->req_busy = 1;
  423. return (0);
  424. }
  425. if (!pLib->general_fax_event) {
  426. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, "State\\FAX Event", pLib->buffer))) {
  427. return (-1);
  428. }
  429. pLib->general_fax_event = 1;
  430. pLib->req_busy = 1;
  431. return (0);
  432. }
  433. if (!pLib->general_mdm_event) {
  434. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, "State\\Modem Event", pLib->buffer))) {
  435. return (-1);
  436. }
  437. pLib->general_mdm_event = 1;
  438. pLib->req_busy = 1;
  439. return (0);
  440. }
  441. if (pLib->ChannelsTraceActive < pLib->Channels) {
  442. pLib->ChannelsTraceActive++;
  443. sprintf(name, "State\\B%d\\Line", pLib->ChannelsTraceActive);
  444. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  445. pLib->ChannelsTraceActive--;
  446. return (-1);
  447. }
  448. pLib->req_busy = 1;
  449. return (0);
  450. }
  451. if (pLib->ModemTraceActive < pLib->Channels) {
  452. pLib->ModemTraceActive++;
  453. sprintf(name, "State\\B%d\\Modem\\Event", pLib->ModemTraceActive);
  454. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  455. pLib->ModemTraceActive--;
  456. return (-1);
  457. }
  458. pLib->req_busy = 1;
  459. return (0);
  460. }
  461. if (pLib->FaxTraceActive < pLib->Channels) {
  462. pLib->FaxTraceActive++;
  463. sprintf(name, "State\\B%d\\FAX\\Event", pLib->FaxTraceActive);
  464. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  465. pLib->FaxTraceActive--;
  466. return (-1);
  467. }
  468. pLib->req_busy = 1;
  469. return (0);
  470. }
  471. if (!pLib->trace_mask_init) {
  472. word tmp = 0x0000;
  473. if (SuperTraceWriteVar(pLib->hAdapter,
  474. pLib->buffer,
  475. "Trace\\Event Enable",
  476. &tmp,
  477. 0x87, /* MI_BITFLD */
  478. sizeof(tmp))) {
  479. return (-1);
  480. }
  481. pLib->trace_mask_init = 1;
  482. pLib->req_busy = 1;
  483. return (0);
  484. }
  485. if (!pLib->audio_trace_init) {
  486. dword tmp = 0x00000000;
  487. if (SuperTraceWriteVar(pLib->hAdapter,
  488. pLib->buffer,
  489. "Trace\\AudioCh# Enable",
  490. &tmp,
  491. 0x87, /* MI_BITFLD */
  492. sizeof(tmp))) {
  493. return (-1);
  494. }
  495. pLib->audio_trace_init = 2;
  496. pLib->req_busy = 1;
  497. return (0);
  498. }
  499. if (!pLib->bchannel_init) {
  500. dword tmp = 0x00000000;
  501. if (SuperTraceWriteVar(pLib->hAdapter,
  502. pLib->buffer,
  503. "Trace\\B-Ch# Enable",
  504. &tmp,
  505. 0x87, /* MI_BITFLD */
  506. sizeof(tmp))) {
  507. return (-1);
  508. }
  509. pLib->bchannel_init = 1;
  510. pLib->req_busy = 1;
  511. return (0);
  512. }
  513. if (!pLib->trace_length_init) {
  514. word tmp = 30;
  515. if (SuperTraceWriteVar(pLib->hAdapter,
  516. pLib->buffer,
  517. "Trace\\Max Log Length",
  518. &tmp,
  519. 0x82, /* MI_UINT */
  520. sizeof(tmp))) {
  521. return (-1);
  522. }
  523. pLib->trace_length_init = 1;
  524. pLib->req_busy = 1;
  525. return (0);
  526. }
  527. if (!pLib->trace_on) {
  528. if (SuperTraceTraceOnRequest(pLib->hAdapter,
  529. "Trace\\Log Buffer",
  530. pLib->buffer)) {
  531. return (-1);
  532. }
  533. pLib->trace_on = 1;
  534. pLib->req_busy = 1;
  535. return (0);
  536. }
  537. if (pLib->trace_event_mask != pLib->current_trace_event_mask) {
  538. if (SuperTraceWriteVar(pLib->hAdapter,
  539. pLib->buffer,
  540. "Trace\\Event Enable",
  541. &pLib->trace_event_mask,
  542. 0x87, /* MI_BITFLD */
  543. sizeof(pLib->trace_event_mask))) {
  544. return (-1);
  545. }
  546. pLib->current_trace_event_mask = pLib->trace_event_mask;
  547. pLib->req_busy = 1;
  548. return (0);
  549. }
  550. if ((pLib->audio_tap_pending >= 0) && (pLib->audio_tap_mask != pLib->current_audio_tap_mask)) {
  551. if (SuperTraceWriteVar(pLib->hAdapter,
  552. pLib->buffer,
  553. "Trace\\AudioCh# Enable",
  554. &pLib->audio_tap_mask,
  555. 0x87, /* MI_BITFLD */
  556. sizeof(pLib->audio_tap_mask))) {
  557. return (-1);
  558. }
  559. pLib->current_audio_tap_mask = pLib->audio_tap_mask;
  560. pLib->audio_tap_pending = 1;
  561. pLib->req_busy = 1;
  562. return (0);
  563. }
  564. if ((pLib->eye_pattern_pending >= 0) && (pLib->audio_tap_mask != pLib->current_eye_pattern_mask)) {
  565. if (SuperTraceWriteVar(pLib->hAdapter,
  566. pLib->buffer,
  567. "Trace\\EyeCh# Enable",
  568. &pLib->audio_tap_mask,
  569. 0x87, /* MI_BITFLD */
  570. sizeof(pLib->audio_tap_mask))) {
  571. return (-1);
  572. }
  573. pLib->current_eye_pattern_mask = pLib->audio_tap_mask;
  574. pLib->eye_pattern_pending = 1;
  575. pLib->req_busy = 1;
  576. return (0);
  577. }
  578. if (pLib->bchannel_trace_mask != pLib->current_bchannel_trace_mask) {
  579. if (SuperTraceWriteVar(pLib->hAdapter,
  580. pLib->buffer,
  581. "Trace\\B-Ch# Enable",
  582. &pLib->bchannel_trace_mask,
  583. 0x87, /* MI_BITFLD */
  584. sizeof(pLib->bchannel_trace_mask))) {
  585. return (-1);
  586. }
  587. pLib->current_bchannel_trace_mask = pLib->bchannel_trace_mask;
  588. pLib->req_busy = 1;
  589. return (0);
  590. }
  591. if (!pLib->trace_events_down) {
  592. if (SuperTraceTraceOnRequest(pLib->hAdapter,
  593. "Events Down",
  594. pLib->buffer)) {
  595. return (-1);
  596. }
  597. pLib->trace_events_down = 1;
  598. pLib->req_busy = 1;
  599. return (0);
  600. }
  601. if (!pLib->l1_trace) {
  602. if (SuperTraceTraceOnRequest(pLib->hAdapter,
  603. "State\\Layer1",
  604. pLib->buffer)) {
  605. return (-1);
  606. }
  607. pLib->l1_trace = 1;
  608. pLib->req_busy = 1;
  609. return (0);
  610. }
  611. if (!pLib->l2_trace) {
  612. if (SuperTraceTraceOnRequest(pLib->hAdapter,
  613. "State\\Layer2 No1",
  614. pLib->buffer)) {
  615. return (-1);
  616. }
  617. pLib->l2_trace = 1;
  618. pLib->req_busy = 1;
  619. return (0);
  620. }
  621. for (i = 0; i < 30; i++) {
  622. if (pLib->pending_line_status & (1L << i)) {
  623. sprintf(name, "State\\B%d", i + 1);
  624. if (SuperTraceReadRequest(pLib->hAdapter, name, pLib->buffer)) {
  625. return (-1);
  626. }
  627. pLib->pending_line_status &= ~(1L << i);
  628. pLib->req_busy = 1;
  629. return (0);
  630. }
  631. if (pLib->pending_modem_status & (1L << i)) {
  632. sprintf(name, "State\\B%d\\Modem", i + 1);
  633. if (SuperTraceReadRequest(pLib->hAdapter, name, pLib->buffer)) {
  634. return (-1);
  635. }
  636. pLib->pending_modem_status &= ~(1L << i);
  637. pLib->req_busy = 1;
  638. return (0);
  639. }
  640. if (pLib->pending_fax_status & (1L << i)) {
  641. sprintf(name, "State\\B%d\\FAX", i + 1);
  642. if (SuperTraceReadRequest(pLib->hAdapter, name, pLib->buffer)) {
  643. return (-1);
  644. }
  645. pLib->pending_fax_status &= ~(1L << i);
  646. pLib->req_busy = 1;
  647. return (0);
  648. }
  649. if (pLib->clear_call_command & (1L << i)) {
  650. sprintf(name, "State\\B%d\\Clear Call", i + 1);
  651. if (SuperTraceExecuteRequest(pLib->hAdapter, name, pLib->buffer)) {
  652. return (-1);
  653. }
  654. pLib->clear_call_command &= ~(1L << i);
  655. pLib->req_busy = 1;
  656. return (0);
  657. }
  658. }
  659. if (pLib->outgoing_ifc_stats) {
  660. if (SuperTraceReadRequest(pLib->hAdapter,
  661. "Statistics\\Outgoing Calls",
  662. pLib->buffer)) {
  663. return (-1);
  664. }
  665. pLib->outgoing_ifc_stats = 0;
  666. pLib->req_busy = 1;
  667. return (0);
  668. }
  669. if (pLib->incoming_ifc_stats) {
  670. if (SuperTraceReadRequest(pLib->hAdapter,
  671. "Statistics\\Incoming Calls",
  672. pLib->buffer)) {
  673. return (-1);
  674. }
  675. pLib->incoming_ifc_stats = 0;
  676. pLib->req_busy = 1;
  677. return (0);
  678. }
  679. if (pLib->modem_ifc_stats) {
  680. if (SuperTraceReadRequest(pLib->hAdapter,
  681. "Statistics\\Modem",
  682. pLib->buffer)) {
  683. return (-1);
  684. }
  685. pLib->modem_ifc_stats = 0;
  686. pLib->req_busy = 1;
  687. return (0);
  688. }
  689. if (pLib->fax_ifc_stats) {
  690. if (SuperTraceReadRequest(pLib->hAdapter,
  691. "Statistics\\FAX",
  692. pLib->buffer)) {
  693. return (-1);
  694. }
  695. pLib->fax_ifc_stats = 0;
  696. pLib->req_busy = 1;
  697. return (0);
  698. }
  699. if (pLib->b1_ifc_stats) {
  700. if (SuperTraceReadRequest(pLib->hAdapter,
  701. "Statistics\\B-Layer1",
  702. pLib->buffer)) {
  703. return (-1);
  704. }
  705. pLib->b1_ifc_stats = 0;
  706. pLib->req_busy = 1;
  707. return (0);
  708. }
  709. if (pLib->b2_ifc_stats) {
  710. if (SuperTraceReadRequest(pLib->hAdapter,
  711. "Statistics\\B-Layer2",
  712. pLib->buffer)) {
  713. return (-1);
  714. }
  715. pLib->b2_ifc_stats = 0;
  716. pLib->req_busy = 1;
  717. return (0);
  718. }
  719. if (pLib->d1_ifc_stats) {
  720. if (SuperTraceReadRequest(pLib->hAdapter,
  721. "Statistics\\D-Layer1",
  722. pLib->buffer)) {
  723. return (-1);
  724. }
  725. pLib->d1_ifc_stats = 0;
  726. pLib->req_busy = 1;
  727. return (0);
  728. }
  729. if (pLib->d2_ifc_stats) {
  730. if (SuperTraceReadRequest(pLib->hAdapter,
  731. "Statistics\\D-Layer2",
  732. pLib->buffer)) {
  733. return (-1);
  734. }
  735. pLib->d2_ifc_stats = 0;
  736. pLib->req_busy = 1;
  737. return (0);
  738. }
  739. if (!pLib->IncomingCallsCallsActive) {
  740. pLib->IncomingCallsCallsActive = 1;
  741. sprintf(name, "%s", "Statistics\\Incoming Calls\\Calls");
  742. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  743. pLib->IncomingCallsCallsActive = 0;
  744. return (-1);
  745. }
  746. pLib->req_busy = 1;
  747. return (0);
  748. }
  749. if (!pLib->IncomingCallsConnectedActive) {
  750. pLib->IncomingCallsConnectedActive = 1;
  751. sprintf(name, "%s", "Statistics\\Incoming Calls\\Connected");
  752. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  753. pLib->IncomingCallsConnectedActive = 0;
  754. return (-1);
  755. }
  756. pLib->req_busy = 1;
  757. return (0);
  758. }
  759. if (!pLib->OutgoingCallsCallsActive) {
  760. pLib->OutgoingCallsCallsActive = 1;
  761. sprintf(name, "%s", "Statistics\\Outgoing Calls\\Calls");
  762. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  763. pLib->OutgoingCallsCallsActive = 0;
  764. return (-1);
  765. }
  766. pLib->req_busy = 1;
  767. return (0);
  768. }
  769. if (!pLib->OutgoingCallsConnectedActive) {
  770. pLib->OutgoingCallsConnectedActive = 1;
  771. sprintf(name, "%s", "Statistics\\Outgoing Calls\\Connected");
  772. if ((ret = SuperTraceTraceOnRequest(pLib->hAdapter, name, pLib->buffer))) {
  773. pLib->OutgoingCallsConnectedActive = 0;
  774. return (-1);
  775. }
  776. pLib->req_busy = 1;
  777. return (0);
  778. }
  779. return (0);
  780. }
  781. static int process_idi_event(diva_strace_context_t *pLib,
  782. diva_man_var_header_t *pVar) {
  783. const char *path = (char *)&pVar->path_length + 1;
  784. char name[64];
  785. int i;
  786. if (!strncmp("State\\B Event", path, pVar->path_length)) {
  787. dword ch_id;
  788. if (!diva_trace_read_variable(pVar, &ch_id)) {
  789. if (!pLib->line_init_event && !pLib->pending_line_status) {
  790. for (i = 1; i <= pLib->Channels; i++) {
  791. diva_line_event(pLib, i);
  792. }
  793. return (0);
  794. } else if (ch_id && ch_id <= pLib->Channels) {
  795. return (diva_line_event(pLib, (int)ch_id));
  796. }
  797. return (0);
  798. }
  799. return (-1);
  800. }
  801. if (!strncmp("State\\FAX Event", path, pVar->path_length)) {
  802. dword ch_id;
  803. if (!diva_trace_read_variable(pVar, &ch_id)) {
  804. if (!pLib->pending_fax_status && !pLib->fax_init_event) {
  805. for (i = 1; i <= pLib->Channels; i++) {
  806. diva_fax_event(pLib, i);
  807. }
  808. return (0);
  809. } else if (ch_id && ch_id <= pLib->Channels) {
  810. return (diva_fax_event(pLib, (int)ch_id));
  811. }
  812. return (0);
  813. }
  814. return (-1);
  815. }
  816. if (!strncmp("State\\Modem Event", path, pVar->path_length)) {
  817. dword ch_id;
  818. if (!diva_trace_read_variable(pVar, &ch_id)) {
  819. if (!pLib->pending_modem_status && !pLib->modem_init_event) {
  820. for (i = 1; i <= pLib->Channels; i++) {
  821. diva_modem_event(pLib, i);
  822. }
  823. return (0);
  824. } else if (ch_id && ch_id <= pLib->Channels) {
  825. return (diva_modem_event(pLib, (int)ch_id));
  826. }
  827. return (0);
  828. }
  829. return (-1);
  830. }
  831. /*
  832. First look for Line Event
  833. */
  834. for (i = 1; i <= pLib->Channels; i++) {
  835. sprintf(name, "State\\B%d\\Line", i);
  836. if (find_var(pVar, name)) {
  837. return (diva_line_event(pLib, i));
  838. }
  839. }
  840. /*
  841. Look for Moden Progress Event
  842. */
  843. for (i = 1; i <= pLib->Channels; i++) {
  844. sprintf(name, "State\\B%d\\Modem\\Event", i);
  845. if (find_var(pVar, name)) {
  846. return (diva_modem_event(pLib, i));
  847. }
  848. }
  849. /*
  850. Look for Fax Event
  851. */
  852. for (i = 1; i <= pLib->Channels; i++) {
  853. sprintf(name, "State\\B%d\\FAX\\Event", i);
  854. if (find_var(pVar, name)) {
  855. return (diva_fax_event(pLib, i));
  856. }
  857. }
  858. /*
  859. Notification about loss of events
  860. */
  861. if (!strncmp("Events Down", path, pVar->path_length)) {
  862. if (pLib->trace_events_down == 1) {
  863. pLib->trace_events_down = 2;
  864. } else {
  865. diva_trace_error(pLib, 1, "Events Down", 0);
  866. }
  867. return (0);
  868. }
  869. if (!strncmp("State\\Layer1", path, pVar->path_length)) {
  870. diva_strace_read_asz(pVar, &pLib->lines[0].pInterface->Layer1[0]);
  871. if (pLib->l1_trace == 1) {
  872. pLib->l1_trace = 2;
  873. } else {
  874. diva_trace_notify_user(pLib, 0, DIVA_SUPER_TRACE_INTERFACE_CHANGE);
  875. }
  876. return (0);
  877. }
  878. if (!strncmp("State\\Layer2 No1", path, pVar->path_length)) {
  879. char *tmp = &pLib->lines[0].pInterface->Layer2[0];
  880. dword l2_state;
  881. if (diva_strace_read_uint(pVar, &l2_state))
  882. return -1;
  883. switch (l2_state) {
  884. case 0:
  885. strcpy(tmp, "Idle");
  886. break;
  887. case 1:
  888. strcpy(tmp, "Layer2 UP");
  889. break;
  890. case 2:
  891. strcpy(tmp, "Layer2 Disconnecting");
  892. break;
  893. case 3:
  894. strcpy(tmp, "Layer2 Connecting");
  895. break;
  896. case 4:
  897. strcpy(tmp, "SPID Initializing");
  898. break;
  899. case 5:
  900. strcpy(tmp, "SPID Initialised");
  901. break;
  902. case 6:
  903. strcpy(tmp, "Layer2 Connecting");
  904. break;
  905. case 7:
  906. strcpy(tmp, "Auto SPID Stopped");
  907. break;
  908. case 8:
  909. strcpy(tmp, "Auto SPID Idle");
  910. break;
  911. case 9:
  912. strcpy(tmp, "Auto SPID Requested");
  913. break;
  914. case 10:
  915. strcpy(tmp, "Auto SPID Delivery");
  916. break;
  917. case 11:
  918. strcpy(tmp, "Auto SPID Complete");
  919. break;
  920. default:
  921. sprintf(tmp, "U:%d", (int)l2_state);
  922. }
  923. if (pLib->l2_trace == 1) {
  924. pLib->l2_trace = 2;
  925. } else {
  926. diva_trace_notify_user(pLib, 0, DIVA_SUPER_TRACE_INTERFACE_CHANGE);
  927. }
  928. return (0);
  929. }
  930. if (!strncmp("Statistics\\Incoming Calls\\Calls", path, pVar->path_length) ||
  931. !strncmp("Statistics\\Incoming Calls\\Connected", path, pVar->path_length)) {
  932. return (SuperTraceGetIncomingCallStatistics(pLib));
  933. }
  934. if (!strncmp("Statistics\\Outgoing Calls\\Calls", path, pVar->path_length) ||
  935. !strncmp("Statistics\\Outgoing Calls\\Connected", path, pVar->path_length)) {
  936. return (SuperTraceGetOutgoingCallStatistics(pLib));
  937. }
  938. return (-1);
  939. }
  940. static int diva_line_event(diva_strace_context_t *pLib, int Channel) {
  941. pLib->pending_line_status |= (1L << (Channel - 1));
  942. return (0);
  943. }
  944. static int diva_modem_event(diva_strace_context_t *pLib, int Channel) {
  945. pLib->pending_modem_status |= (1L << (Channel - 1));
  946. return (0);
  947. }
  948. static int diva_fax_event(diva_strace_context_t *pLib, int Channel) {
  949. pLib->pending_fax_status |= (1L << (Channel - 1));
  950. return (0);
  951. }
  952. /*
  953. Process INFO indications that arrive from the card
  954. Uses path of first I.E. to detect the source of the
  955. infication
  956. */
  957. static int process_idi_info(diva_strace_context_t *pLib,
  958. diva_man_var_header_t *pVar) {
  959. const char *path = (char *)&pVar->path_length + 1;
  960. char name[64];
  961. int i, len;
  962. /*
  963. First look for Modem Status Info
  964. */
  965. for (i = pLib->Channels; i > 0; i--) {
  966. len = sprintf(name, "State\\B%d\\Modem", i);
  967. if (!strncmp(name, path, len)) {
  968. return (diva_modem_info(pLib, i, pVar));
  969. }
  970. }
  971. /*
  972. Look for Fax Status Info
  973. */
  974. for (i = pLib->Channels; i > 0; i--) {
  975. len = sprintf(name, "State\\B%d\\FAX", i);
  976. if (!strncmp(name, path, len)) {
  977. return (diva_fax_info(pLib, i, pVar));
  978. }
  979. }
  980. /*
  981. Look for Line Status Info
  982. */
  983. for (i = pLib->Channels; i > 0; i--) {
  984. len = sprintf(name, "State\\B%d", i);
  985. if (!strncmp(name, path, len)) {
  986. return (diva_line_info(pLib, i, pVar));
  987. }
  988. }
  989. if (!diva_ifc_statistics(pLib, pVar)) {
  990. return (0);
  991. }
  992. return (-1);
  993. }
  994. /*
  995. MODEM INSTANCE STATE UPDATE
  996. Update Modem Status Information and issue notification to user,
  997. that will inform about change in the state of modem instance, that is
  998. associuated with this channel
  999. */
  1000. static int diva_modem_info(diva_strace_context_t *pLib,
  1001. int Channel,
  1002. diva_man_var_header_t *pVar) {
  1003. diva_man_var_header_t *cur;
  1004. int i, nr = Channel - 1;
  1005. for (i = pLib->modem_parse_entry_first[nr];
  1006. i <= pLib->modem_parse_entry_last[nr]; i++) {
  1007. if ((cur = find_var(pVar, pLib->parse_table[i].path))) {
  1008. if (diva_trace_read_variable(cur, pLib->parse_table[i].variable)) {
  1009. diva_trace_error(pLib, -3, __FILE__, __LINE__);
  1010. return (-1);
  1011. }
  1012. } else {
  1013. diva_trace_error(pLib, -2, __FILE__, __LINE__);
  1014. return (-1);
  1015. }
  1016. }
  1017. /*
  1018. We do not use first event to notify user - this is the event that is
  1019. generated as result of EVENT ON operation and is used only to initialize
  1020. internal variables of application
  1021. */
  1022. if (pLib->modem_init_event & (1L << nr)) {
  1023. diva_trace_notify_user(pLib, nr, DIVA_SUPER_TRACE_NOTIFY_MODEM_CHANGE);
  1024. } else {
  1025. pLib->modem_init_event |= (1L << nr);
  1026. }
  1027. return (0);
  1028. }
  1029. static int diva_fax_info(diva_strace_context_t *pLib,
  1030. int Channel,
  1031. diva_man_var_header_t *pVar) {
  1032. diva_man_var_header_t *cur;
  1033. int i, nr = Channel - 1;
  1034. for (i = pLib->fax_parse_entry_first[nr];
  1035. i <= pLib->fax_parse_entry_last[nr]; i++) {
  1036. if ((cur = find_var(pVar, pLib->parse_table[i].path))) {
  1037. if (diva_trace_read_variable(cur, pLib->parse_table[i].variable)) {
  1038. diva_trace_error(pLib, -3, __FILE__, __LINE__);
  1039. return (-1);
  1040. }
  1041. } else {
  1042. diva_trace_error(pLib, -2, __FILE__, __LINE__);
  1043. return (-1);
  1044. }
  1045. }
  1046. /*
  1047. We do not use first event to notify user - this is the event that is
  1048. generated as result of EVENT ON operation and is used only to initialize
  1049. internal variables of application
  1050. */
  1051. if (pLib->fax_init_event & (1L << nr)) {
  1052. diva_trace_notify_user(pLib, nr, DIVA_SUPER_TRACE_NOTIFY_FAX_CHANGE);
  1053. } else {
  1054. pLib->fax_init_event |= (1L << nr);
  1055. }
  1056. return (0);
  1057. }
  1058. /*
  1059. LINE STATE UPDATE
  1060. Update Line Status Information and issue notification to user,
  1061. that will inform about change in the line state.
  1062. */
  1063. static int diva_line_info(diva_strace_context_t *pLib,
  1064. int Channel,
  1065. diva_man_var_header_t *pVar) {
  1066. diva_man_var_header_t *cur;
  1067. int i, nr = Channel - 1;
  1068. for (i = pLib->line_parse_entry_first[nr];
  1069. i <= pLib->line_parse_entry_last[nr]; i++) {
  1070. if ((cur = find_var(pVar, pLib->parse_table[i].path))) {
  1071. if (diva_trace_read_variable(cur, pLib->parse_table[i].variable)) {
  1072. diva_trace_error(pLib, -3, __FILE__, __LINE__);
  1073. return (-1);
  1074. }
  1075. } else {
  1076. diva_trace_error(pLib, -2 , __FILE__, __LINE__);
  1077. return (-1);
  1078. }
  1079. }
  1080. /*
  1081. We do not use first event to notify user - this is the event that is
  1082. generated as result of EVENT ON operation and is used only to initialize
  1083. internal variables of application
  1084. Exception is is if the line is "online". In this case we have to notify
  1085. user about this confition.
  1086. */
  1087. if (pLib->line_init_event & (1L << nr)) {
  1088. diva_trace_notify_user(pLib, nr, DIVA_SUPER_TRACE_NOTIFY_LINE_CHANGE);
  1089. } else {
  1090. pLib->line_init_event |= (1L << nr);
  1091. if (strcmp(&pLib->lines[nr].Line[0], "Idle")) {
  1092. diva_trace_notify_user(pLib, nr, DIVA_SUPER_TRACE_NOTIFY_LINE_CHANGE);
  1093. }
  1094. }
  1095. return (0);
  1096. }
  1097. /*
  1098. Move position to next vatianle in the chain
  1099. */
  1100. static diva_man_var_header_t *get_next_var(diva_man_var_header_t *pVar) {
  1101. byte *msg = (byte *)pVar;
  1102. byte *start;
  1103. int msg_length;
  1104. if (*msg != ESC) return NULL;
  1105. start = msg + 2;
  1106. msg_length = *(msg + 1);
  1107. msg = (start + msg_length);
  1108. if (*msg != ESC) return NULL;
  1109. return ((diva_man_var_header_t *)msg);
  1110. }
  1111. /*
  1112. Move position to variable with given name
  1113. */
  1114. static diva_man_var_header_t *find_var(diva_man_var_header_t *pVar,
  1115. const char *name) {
  1116. const char *path;
  1117. do {
  1118. path = (char *)&pVar->path_length + 1;
  1119. if (!strncmp(name, path, pVar->path_length)) {
  1120. break;
  1121. }
  1122. } while ((pVar = get_next_var(pVar)));
  1123. return (pVar);
  1124. }
  1125. static void diva_create_line_parse_table(diva_strace_context_t *pLib,
  1126. int Channel) {
  1127. diva_trace_line_state_t *pLine = &pLib->lines[Channel];
  1128. int nr = Channel + 1;
  1129. if ((pLib->cur_parse_entry + LINE_PARSE_ENTRIES) >= pLib->parse_entries) {
  1130. diva_trace_error(pLib, -1, __FILE__, __LINE__);
  1131. return;
  1132. }
  1133. pLine->ChannelNumber = nr;
  1134. pLib->line_parse_entry_first[Channel] = pLib->cur_parse_entry;
  1135. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1136. "State\\B%d\\Framing", nr);
  1137. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->Framing[0];
  1138. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1139. "State\\B%d\\Line", nr);
  1140. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->Line[0];
  1141. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1142. "State\\B%d\\Layer2", nr);
  1143. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->Layer2[0];
  1144. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1145. "State\\B%d\\Layer3", nr);
  1146. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->Layer3[0];
  1147. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1148. "State\\B%d\\Remote Address", nr);
  1149. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1150. &pLine->RemoteAddress[0];
  1151. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1152. "State\\B%d\\Remote SubAddr", nr);
  1153. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1154. &pLine->RemoteSubAddress[0];
  1155. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1156. "State\\B%d\\Local Address", nr);
  1157. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1158. &pLine->LocalAddress[0];
  1159. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1160. "State\\B%d\\Local SubAddr", nr);
  1161. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1162. &pLine->LocalSubAddress[0];
  1163. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1164. "State\\B%d\\BC", nr);
  1165. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->call_BC;
  1166. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1167. "State\\B%d\\HLC", nr);
  1168. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->call_HLC;
  1169. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1170. "State\\B%d\\LLC", nr);
  1171. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->call_LLC;
  1172. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1173. "State\\B%d\\Charges", nr);
  1174. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->Charges;
  1175. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1176. "State\\B%d\\Call Reference", nr);
  1177. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->CallReference;
  1178. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1179. "State\\B%d\\Last Disc Cause", nr);
  1180. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1181. &pLine->LastDisconnecCause;
  1182. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1183. "State\\B%d\\User ID", nr);
  1184. pLib->parse_table[pLib->cur_parse_entry++].variable = &pLine->UserID[0];
  1185. pLib->line_parse_entry_last[Channel] = pLib->cur_parse_entry - 1;
  1186. }
  1187. static void diva_create_fax_parse_table(diva_strace_context_t *pLib,
  1188. int Channel) {
  1189. diva_trace_fax_state_t *pFax = &pLib->lines[Channel].fax;
  1190. int nr = Channel + 1;
  1191. if ((pLib->cur_parse_entry + FAX_PARSE_ENTRIES) >= pLib->parse_entries) {
  1192. diva_trace_error(pLib, -1, __FILE__, __LINE__);
  1193. return;
  1194. }
  1195. pFax->ChannelNumber = nr;
  1196. pLib->fax_parse_entry_first[Channel] = pLib->cur_parse_entry;
  1197. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1198. "State\\B%d\\FAX\\Event", nr);
  1199. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Event;
  1200. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1201. "State\\B%d\\FAX\\Page Counter", nr);
  1202. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Page_Counter;
  1203. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1204. "State\\B%d\\FAX\\Features", nr);
  1205. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Features;
  1206. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1207. "State\\B%d\\FAX\\Station ID", nr);
  1208. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Station_ID[0];
  1209. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1210. "State\\B%d\\FAX\\Subaddress", nr);
  1211. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Subaddress[0];
  1212. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1213. "State\\B%d\\FAX\\Password", nr);
  1214. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Password[0];
  1215. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1216. "State\\B%d\\FAX\\Speed", nr);
  1217. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Speed;
  1218. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1219. "State\\B%d\\FAX\\Resolution", nr);
  1220. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Resolution;
  1221. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1222. "State\\B%d\\FAX\\Paper Width", nr);
  1223. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Paper_Width;
  1224. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1225. "State\\B%d\\FAX\\Paper Length", nr);
  1226. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Paper_Length;
  1227. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1228. "State\\B%d\\FAX\\Scanline Time", nr);
  1229. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Scanline_Time;
  1230. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1231. "State\\B%d\\FAX\\Disc Reason", nr);
  1232. pLib->parse_table[pLib->cur_parse_entry++].variable = &pFax->Disc_Reason;
  1233. pLib->fax_parse_entry_last[Channel] = pLib->cur_parse_entry - 1;
  1234. }
  1235. static void diva_create_modem_parse_table(diva_strace_context_t *pLib,
  1236. int Channel) {
  1237. diva_trace_modem_state_t *pModem = &pLib->lines[Channel].modem;
  1238. int nr = Channel + 1;
  1239. if ((pLib->cur_parse_entry + MODEM_PARSE_ENTRIES) >= pLib->parse_entries) {
  1240. diva_trace_error(pLib, -1, __FILE__, __LINE__);
  1241. return;
  1242. }
  1243. pModem->ChannelNumber = nr;
  1244. pLib->modem_parse_entry_first[Channel] = pLib->cur_parse_entry;
  1245. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1246. "State\\B%d\\Modem\\Event", nr);
  1247. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->Event;
  1248. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1249. "State\\B%d\\Modem\\Norm", nr);
  1250. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->Norm;
  1251. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1252. "State\\B%d\\Modem\\Options", nr);
  1253. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->Options;
  1254. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1255. "State\\B%d\\Modem\\TX Speed", nr);
  1256. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->TxSpeed;
  1257. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1258. "State\\B%d\\Modem\\RX Speed", nr);
  1259. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->RxSpeed;
  1260. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1261. "State\\B%d\\Modem\\Roundtrip ms", nr);
  1262. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->RoundtripMsec;
  1263. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1264. "State\\B%d\\Modem\\Symbol Rate", nr);
  1265. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->SymbolRate;
  1266. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1267. "State\\B%d\\Modem\\RX Level dBm", nr);
  1268. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->RxLeveldBm;
  1269. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1270. "State\\B%d\\Modem\\Echo Level dBm", nr);
  1271. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->EchoLeveldBm;
  1272. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1273. "State\\B%d\\Modem\\SNR dB", nr);
  1274. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->SNRdb;
  1275. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1276. "State\\B%d\\Modem\\MAE", nr);
  1277. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->MAE;
  1278. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1279. "State\\B%d\\Modem\\Local Retrains", nr);
  1280. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->LocalRetrains;
  1281. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1282. "State\\B%d\\Modem\\Remote Retrains", nr);
  1283. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->RemoteRetrains;
  1284. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1285. "State\\B%d\\Modem\\Local Resyncs", nr);
  1286. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->LocalResyncs;
  1287. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1288. "State\\B%d\\Modem\\Remote Resyncs", nr);
  1289. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->RemoteResyncs;
  1290. sprintf(pLib->parse_table[pLib->cur_parse_entry].path,
  1291. "State\\B%d\\Modem\\Disc Reason", nr);
  1292. pLib->parse_table[pLib->cur_parse_entry++].variable = &pModem->DiscReason;
  1293. pLib->modem_parse_entry_last[Channel] = pLib->cur_parse_entry - 1;
  1294. }
  1295. static void diva_create_parse_table(diva_strace_context_t *pLib) {
  1296. int i;
  1297. for (i = 0; i < pLib->Channels; i++) {
  1298. diva_create_line_parse_table(pLib, i);
  1299. diva_create_modem_parse_table(pLib, i);
  1300. diva_create_fax_parse_table(pLib, i);
  1301. }
  1302. pLib->statistic_parse_first = pLib->cur_parse_entry;
  1303. /*
  1304. Outgoing Calls
  1305. */
  1306. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1307. "Statistics\\Outgoing Calls\\Calls");
  1308. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1309. &pLib->InterfaceStat.outg.Calls;
  1310. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1311. "Statistics\\Outgoing Calls\\Connected");
  1312. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1313. &pLib->InterfaceStat.outg.Connected;
  1314. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1315. "Statistics\\Outgoing Calls\\User Busy");
  1316. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1317. &pLib->InterfaceStat.outg.User_Busy;
  1318. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1319. "Statistics\\Outgoing Calls\\No Answer");
  1320. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1321. &pLib->InterfaceStat.outg.No_Answer;
  1322. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1323. "Statistics\\Outgoing Calls\\Wrong Number");
  1324. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1325. &pLib->InterfaceStat.outg.Wrong_Number;
  1326. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1327. "Statistics\\Outgoing Calls\\Call Rejected");
  1328. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1329. &pLib->InterfaceStat.outg.Call_Rejected;
  1330. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1331. "Statistics\\Outgoing Calls\\Other Failures");
  1332. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1333. &pLib->InterfaceStat.outg.Other_Failures;
  1334. /*
  1335. Incoming Calls
  1336. */
  1337. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1338. "Statistics\\Incoming Calls\\Calls");
  1339. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1340. &pLib->InterfaceStat.inc.Calls;
  1341. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1342. "Statistics\\Incoming Calls\\Connected");
  1343. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1344. &pLib->InterfaceStat.inc.Connected;
  1345. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1346. "Statistics\\Incoming Calls\\User Busy");
  1347. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1348. &pLib->InterfaceStat.inc.User_Busy;
  1349. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1350. "Statistics\\Incoming Calls\\Call Rejected");
  1351. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1352. &pLib->InterfaceStat.inc.Call_Rejected;
  1353. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1354. "Statistics\\Incoming Calls\\Wrong Number");
  1355. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1356. &pLib->InterfaceStat.inc.Wrong_Number;
  1357. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1358. "Statistics\\Incoming Calls\\Incompatible Dst");
  1359. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1360. &pLib->InterfaceStat.inc.Incompatible_Dst;
  1361. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1362. "Statistics\\Incoming Calls\\Out of Order");
  1363. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1364. &pLib->InterfaceStat.inc.Out_of_Order;
  1365. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1366. "Statistics\\Incoming Calls\\Ignored");
  1367. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1368. &pLib->InterfaceStat.inc.Ignored;
  1369. /*
  1370. Modem Statistics
  1371. */
  1372. pLib->mdm_statistic_parse_first = pLib->cur_parse_entry;
  1373. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1374. "Statistics\\Modem\\Disc Normal");
  1375. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1376. &pLib->InterfaceStat.mdm.Disc_Normal;
  1377. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1378. "Statistics\\Modem\\Disc Unspecified");
  1379. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1380. &pLib->InterfaceStat.mdm.Disc_Unspecified;
  1381. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1382. "Statistics\\Modem\\Disc Busy Tone");
  1383. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1384. &pLib->InterfaceStat.mdm.Disc_Busy_Tone;
  1385. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1386. "Statistics\\Modem\\Disc Congestion");
  1387. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1388. &pLib->InterfaceStat.mdm.Disc_Congestion;
  1389. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1390. "Statistics\\Modem\\Disc Carr. Wait");
  1391. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1392. &pLib->InterfaceStat.mdm.Disc_Carr_Wait;
  1393. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1394. "Statistics\\Modem\\Disc Trn Timeout");
  1395. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1396. &pLib->InterfaceStat.mdm.Disc_Trn_Timeout;
  1397. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1398. "Statistics\\Modem\\Disc Incompat.");
  1399. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1400. &pLib->InterfaceStat.mdm.Disc_Incompat;
  1401. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1402. "Statistics\\Modem\\Disc Frame Rej.");
  1403. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1404. &pLib->InterfaceStat.mdm.Disc_Frame_Rej;
  1405. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1406. "Statistics\\Modem\\Disc V42bis");
  1407. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1408. &pLib->InterfaceStat.mdm.Disc_V42bis;
  1409. pLib->mdm_statistic_parse_last = pLib->cur_parse_entry - 1;
  1410. /*
  1411. Fax Statistics
  1412. */
  1413. pLib->fax_statistic_parse_first = pLib->cur_parse_entry;
  1414. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1415. "Statistics\\FAX\\Disc Normal");
  1416. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1417. &pLib->InterfaceStat.fax.Disc_Normal;
  1418. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1419. "Statistics\\FAX\\Disc Not Ident.");
  1420. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1421. &pLib->InterfaceStat.fax.Disc_Not_Ident;
  1422. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1423. "Statistics\\FAX\\Disc No Response");
  1424. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1425. &pLib->InterfaceStat.fax.Disc_No_Response;
  1426. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1427. "Statistics\\FAX\\Disc Retries");
  1428. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1429. &pLib->InterfaceStat.fax.Disc_Retries;
  1430. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1431. "Statistics\\FAX\\Disc Unexp. Msg.");
  1432. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1433. &pLib->InterfaceStat.fax.Disc_Unexp_Msg;
  1434. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1435. "Statistics\\FAX\\Disc No Polling.");
  1436. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1437. &pLib->InterfaceStat.fax.Disc_No_Polling;
  1438. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1439. "Statistics\\FAX\\Disc Training");
  1440. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1441. &pLib->InterfaceStat.fax.Disc_Training;
  1442. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1443. "Statistics\\FAX\\Disc Unexpected");
  1444. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1445. &pLib->InterfaceStat.fax.Disc_Unexpected;
  1446. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1447. "Statistics\\FAX\\Disc Application");
  1448. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1449. &pLib->InterfaceStat.fax.Disc_Application;
  1450. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1451. "Statistics\\FAX\\Disc Incompat.");
  1452. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1453. &pLib->InterfaceStat.fax.Disc_Incompat;
  1454. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1455. "Statistics\\FAX\\Disc No Command");
  1456. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1457. &pLib->InterfaceStat.fax.Disc_No_Command;
  1458. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1459. "Statistics\\FAX\\Disc Long Msg");
  1460. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1461. &pLib->InterfaceStat.fax.Disc_Long_Msg;
  1462. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1463. "Statistics\\FAX\\Disc Supervisor");
  1464. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1465. &pLib->InterfaceStat.fax.Disc_Supervisor;
  1466. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1467. "Statistics\\FAX\\Disc SUB SEP PWD");
  1468. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1469. &pLib->InterfaceStat.fax.Disc_SUB_SEP_PWD;
  1470. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1471. "Statistics\\FAX\\Disc Invalid Msg");
  1472. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1473. &pLib->InterfaceStat.fax.Disc_Invalid_Msg;
  1474. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1475. "Statistics\\FAX\\Disc Page Coding");
  1476. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1477. &pLib->InterfaceStat.fax.Disc_Page_Coding;
  1478. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1479. "Statistics\\FAX\\Disc App Timeout");
  1480. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1481. &pLib->InterfaceStat.fax.Disc_App_Timeout;
  1482. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1483. "Statistics\\FAX\\Disc Unspecified");
  1484. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1485. &pLib->InterfaceStat.fax.Disc_Unspecified;
  1486. pLib->fax_statistic_parse_last = pLib->cur_parse_entry - 1;
  1487. /*
  1488. B-Layer1"
  1489. */
  1490. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1491. "Statistics\\B-Layer1\\X-Frames");
  1492. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1493. &pLib->InterfaceStat.b1.X_Frames;
  1494. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1495. "Statistics\\B-Layer1\\X-Bytes");
  1496. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1497. &pLib->InterfaceStat.b1.X_Bytes;
  1498. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1499. "Statistics\\B-Layer1\\X-Errors");
  1500. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1501. &pLib->InterfaceStat.b1.X_Errors;
  1502. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1503. "Statistics\\B-Layer1\\R-Frames");
  1504. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1505. &pLib->InterfaceStat.b1.R_Frames;
  1506. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1507. "Statistics\\B-Layer1\\R-Bytes");
  1508. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1509. &pLib->InterfaceStat.b1.R_Bytes;
  1510. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1511. "Statistics\\B-Layer1\\R-Errors");
  1512. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1513. &pLib->InterfaceStat.b1.R_Errors;
  1514. /*
  1515. B-Layer2
  1516. */
  1517. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1518. "Statistics\\B-Layer2\\X-Frames");
  1519. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1520. &pLib->InterfaceStat.b2.X_Frames;
  1521. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1522. "Statistics\\B-Layer2\\X-Bytes");
  1523. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1524. &pLib->InterfaceStat.b2.X_Bytes;
  1525. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1526. "Statistics\\B-Layer2\\X-Errors");
  1527. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1528. &pLib->InterfaceStat.b2.X_Errors;
  1529. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1530. "Statistics\\B-Layer2\\R-Frames");
  1531. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1532. &pLib->InterfaceStat.b2.R_Frames;
  1533. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1534. "Statistics\\B-Layer2\\R-Bytes");
  1535. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1536. &pLib->InterfaceStat.b2.R_Bytes;
  1537. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1538. "Statistics\\B-Layer2\\R-Errors");
  1539. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1540. &pLib->InterfaceStat.b2.R_Errors;
  1541. /*
  1542. D-Layer1
  1543. */
  1544. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1545. "Statistics\\D-Layer1\\X-Frames");
  1546. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1547. &pLib->InterfaceStat.d1.X_Frames;
  1548. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1549. "Statistics\\D-Layer1\\X-Bytes");
  1550. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1551. &pLib->InterfaceStat.d1.X_Bytes;
  1552. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1553. "Statistics\\D-Layer1\\X-Errors");
  1554. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1555. &pLib->InterfaceStat.d1.X_Errors;
  1556. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1557. "Statistics\\D-Layer1\\R-Frames");
  1558. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1559. &pLib->InterfaceStat.d1.R_Frames;
  1560. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1561. "Statistics\\D-Layer1\\R-Bytes");
  1562. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1563. &pLib->InterfaceStat.d1.R_Bytes;
  1564. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1565. "Statistics\\D-Layer1\\R-Errors");
  1566. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1567. &pLib->InterfaceStat.d1.R_Errors;
  1568. /*
  1569. D-Layer2
  1570. */
  1571. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1572. "Statistics\\D-Layer2\\X-Frames");
  1573. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1574. &pLib->InterfaceStat.d2.X_Frames;
  1575. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1576. "Statistics\\D-Layer2\\X-Bytes");
  1577. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1578. &pLib->InterfaceStat.d2.X_Bytes;
  1579. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1580. "Statistics\\D-Layer2\\X-Errors");
  1581. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1582. &pLib->InterfaceStat.d2.X_Errors;
  1583. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1584. "Statistics\\D-Layer2\\R-Frames");
  1585. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1586. &pLib->InterfaceStat.d2.R_Frames;
  1587. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1588. "Statistics\\D-Layer2\\R-Bytes");
  1589. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1590. &pLib->InterfaceStat.d2.R_Bytes;
  1591. strcpy(pLib->parse_table[pLib->cur_parse_entry].path,
  1592. "Statistics\\D-Layer2\\R-Errors");
  1593. pLib->parse_table[pLib->cur_parse_entry++].variable = \
  1594. &pLib->InterfaceStat.d2.R_Errors;
  1595. pLib->statistic_parse_last = pLib->cur_parse_entry - 1;
  1596. }
  1597. static void diva_trace_error(diva_strace_context_t *pLib,
  1598. int error, const char *file, int line) {
  1599. if (pLib->user_proc_table.error_notify_proc) {
  1600. (*(pLib->user_proc_table.error_notify_proc))(\
  1601. pLib->user_proc_table.user_context,
  1602. &pLib->instance, pLib->Adapter,
  1603. error, file, line);
  1604. }
  1605. }
  1606. /*
  1607. Delivery notification to user
  1608. */
  1609. static void diva_trace_notify_user(diva_strace_context_t *pLib,
  1610. int Channel,
  1611. int notify_subject) {
  1612. if (pLib->user_proc_table.notify_proc) {
  1613. (*(pLib->user_proc_table.notify_proc))(pLib->user_proc_table.user_context,
  1614. &pLib->instance,
  1615. pLib->Adapter,
  1616. &pLib->lines[Channel],
  1617. notify_subject);
  1618. }
  1619. }
  1620. /*
  1621. Read variable value to they destination based on the variable type
  1622. */
  1623. static int diva_trace_read_variable(diva_man_var_header_t *pVar,
  1624. void *variable) {
  1625. switch (pVar->type) {
  1626. case 0x03: /* MI_ASCIIZ - syting */
  1627. return (diva_strace_read_asz(pVar, (char *)variable));
  1628. case 0x04: /* MI_ASCII - string */
  1629. return (diva_strace_read_asc(pVar, (char *)variable));
  1630. case 0x05: /* MI_NUMBER - counted sequence of bytes */
  1631. return (diva_strace_read_ie(pVar, (diva_trace_ie_t *)variable));
  1632. case 0x81: /* MI_INT - signed integer */
  1633. return (diva_strace_read_int(pVar, (int *)variable));
  1634. case 0x82: /* MI_UINT - unsigned integer */
  1635. return (diva_strace_read_uint(pVar, (dword *)variable));
  1636. case 0x83: /* MI_HINT - unsigned integer, hex representetion */
  1637. return (diva_strace_read_uint(pVar, (dword *)variable));
  1638. case 0x87: /* MI_BITFLD - unsigned integer, bit representation */
  1639. return (diva_strace_read_uint(pVar, (dword *)variable));
  1640. }
  1641. /*
  1642. This type of variable is not handled, indicate error
  1643. Or one problem in management interface, or in application recodeing
  1644. table, or this application should handle it.
  1645. */
  1646. return (-1);
  1647. }
  1648. /*
  1649. Read signed integer to destination
  1650. */
  1651. static int diva_strace_read_int(diva_man_var_header_t *pVar, int *var) {
  1652. byte *ptr = (char *)&pVar->path_length;
  1653. int value;
  1654. ptr += (pVar->path_length + 1);
  1655. switch (pVar->value_length) {
  1656. case 1:
  1657. value = *(char *)ptr;
  1658. break;
  1659. case 2:
  1660. value = (short)GET_WORD(ptr);
  1661. break;
  1662. case 4:
  1663. value = (int)GET_DWORD(ptr);
  1664. break;
  1665. default:
  1666. return (-1);
  1667. }
  1668. *var = value;
  1669. return (0);
  1670. }
  1671. static int diva_strace_read_uint(diva_man_var_header_t *pVar, dword *var) {
  1672. byte *ptr = (char *)&pVar->path_length;
  1673. dword value;
  1674. ptr += (pVar->path_length + 1);
  1675. switch (pVar->value_length) {
  1676. case 1:
  1677. value = (byte)(*ptr);
  1678. break;
  1679. case 2:
  1680. value = (word)GET_WORD(ptr);
  1681. break;
  1682. case 3:
  1683. value = (dword)GET_DWORD(ptr);
  1684. value &= 0x00ffffff;
  1685. break;
  1686. case 4:
  1687. value = (dword)GET_DWORD(ptr);
  1688. break;
  1689. default:
  1690. return (-1);
  1691. }
  1692. *var = value;
  1693. return (0);
  1694. }
  1695. /*
  1696. Read zero terminated ASCII string
  1697. */
  1698. static int diva_strace_read_asz(diva_man_var_header_t *pVar, char *var) {
  1699. char *ptr = (char *)&pVar->path_length;
  1700. int length;
  1701. ptr += (pVar->path_length + 1);
  1702. if (!(length = pVar->value_length)) {
  1703. length = strlen(ptr);
  1704. }
  1705. memcpy(var, ptr, length);
  1706. var[length] = 0;
  1707. return (0);
  1708. }
  1709. /*
  1710. Read counted (with leading length byte) ASCII string
  1711. */
  1712. static int diva_strace_read_asc(diva_man_var_header_t *pVar, char *var) {
  1713. char *ptr = (char *)&pVar->path_length;
  1714. ptr += (pVar->path_length + 1);
  1715. memcpy(var, ptr + 1, *ptr);
  1716. var[(int)*ptr] = 0;
  1717. return (0);
  1718. }
  1719. /*
  1720. Read one information element - i.e. one string of byte values with
  1721. one length byte in front
  1722. */
  1723. static int diva_strace_read_ie(diva_man_var_header_t *pVar,
  1724. diva_trace_ie_t *var) {
  1725. char *ptr = (char *)&pVar->path_length;
  1726. ptr += (pVar->path_length + 1);
  1727. var->length = *ptr;
  1728. memcpy(&var->data[0], ptr + 1, *ptr);
  1729. return (0);
  1730. }
  1731. static int SuperTraceSetAudioTap(void *hLib, int Channel, int on) {
  1732. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1733. if ((Channel < 1) || (Channel > pLib->Channels)) {
  1734. return (-1);
  1735. }
  1736. Channel--;
  1737. if (on) {
  1738. pLib->audio_tap_mask |= (1L << Channel);
  1739. } else {
  1740. pLib->audio_tap_mask &= ~(1L << Channel);
  1741. }
  1742. /*
  1743. EYE patterns have TM_M_DATA set as additional
  1744. condition
  1745. */
  1746. if (pLib->audio_tap_mask) {
  1747. pLib->trace_event_mask |= TM_M_DATA;
  1748. } else {
  1749. pLib->trace_event_mask &= ~TM_M_DATA;
  1750. }
  1751. return (ScheduleNextTraceRequest(pLib));
  1752. }
  1753. static int SuperTraceSetBChannel(void *hLib, int Channel, int on) {
  1754. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1755. if ((Channel < 1) || (Channel > pLib->Channels)) {
  1756. return (-1);
  1757. }
  1758. Channel--;
  1759. if (on) {
  1760. pLib->bchannel_trace_mask |= (1L << Channel);
  1761. } else {
  1762. pLib->bchannel_trace_mask &= ~(1L << Channel);
  1763. }
  1764. return (ScheduleNextTraceRequest(pLib));
  1765. }
  1766. static int SuperTraceSetDChannel(void *hLib, int on) {
  1767. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1768. if (on) {
  1769. pLib->trace_event_mask |= (TM_D_CHAN | TM_C_COMM | TM_DL_ERR | TM_LAYER1);
  1770. } else {
  1771. pLib->trace_event_mask &= ~(TM_D_CHAN | TM_C_COMM | TM_DL_ERR | TM_LAYER1);
  1772. }
  1773. return (ScheduleNextTraceRequest(pLib));
  1774. }
  1775. static int SuperTraceSetInfo(void *hLib, int on) {
  1776. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1777. if (on) {
  1778. pLib->trace_event_mask |= TM_STRING;
  1779. } else {
  1780. pLib->trace_event_mask &= ~TM_STRING;
  1781. }
  1782. return (ScheduleNextTraceRequest(pLib));
  1783. }
  1784. static int SuperTraceClearCall(void *hLib, int Channel) {
  1785. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1786. if ((Channel < 1) || (Channel > pLib->Channels)) {
  1787. return (-1);
  1788. }
  1789. Channel--;
  1790. pLib->clear_call_command |= (1L << Channel);
  1791. return (ScheduleNextTraceRequest(pLib));
  1792. }
  1793. /*
  1794. Parse and update cumulative statistice
  1795. */
  1796. static int diva_ifc_statistics(diva_strace_context_t *pLib,
  1797. diva_man_var_header_t *pVar) {
  1798. diva_man_var_header_t *cur;
  1799. int i, one_updated = 0, mdm_updated = 0, fax_updated = 0;
  1800. for (i = pLib->statistic_parse_first; i <= pLib->statistic_parse_last; i++) {
  1801. if ((cur = find_var(pVar, pLib->parse_table[i].path))) {
  1802. if (diva_trace_read_variable(cur, pLib->parse_table[i].variable)) {
  1803. diva_trace_error(pLib, -3 , __FILE__, __LINE__);
  1804. return (-1);
  1805. }
  1806. one_updated = 1;
  1807. if ((i >= pLib->mdm_statistic_parse_first) && (i <= pLib->mdm_statistic_parse_last)) {
  1808. mdm_updated = 1;
  1809. }
  1810. if ((i >= pLib->fax_statistic_parse_first) && (i <= pLib->fax_statistic_parse_last)) {
  1811. fax_updated = 1;
  1812. }
  1813. }
  1814. }
  1815. /*
  1816. We do not use first event to notify user - this is the event that is
  1817. generated as result of EVENT ON operation and is used only to initialize
  1818. internal variables of application
  1819. */
  1820. if (mdm_updated) {
  1821. diva_trace_notify_user(pLib, 0, DIVA_SUPER_TRACE_NOTIFY_MDM_STAT_CHANGE);
  1822. } else if (fax_updated) {
  1823. diva_trace_notify_user(pLib, 0, DIVA_SUPER_TRACE_NOTIFY_FAX_STAT_CHANGE);
  1824. } else if (one_updated) {
  1825. diva_trace_notify_user(pLib, 0, DIVA_SUPER_TRACE_NOTIFY_STAT_CHANGE);
  1826. }
  1827. return (one_updated ? 0 : -1);
  1828. }
  1829. static int SuperTraceGetOutgoingCallStatistics(void *hLib) {
  1830. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1831. pLib->outgoing_ifc_stats = 1;
  1832. return (ScheduleNextTraceRequest(pLib));
  1833. }
  1834. static int SuperTraceGetIncomingCallStatistics(void *hLib) {
  1835. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1836. pLib->incoming_ifc_stats = 1;
  1837. return (ScheduleNextTraceRequest(pLib));
  1838. }
  1839. static int SuperTraceGetModemStatistics(void *hLib) {
  1840. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1841. pLib->modem_ifc_stats = 1;
  1842. return (ScheduleNextTraceRequest(pLib));
  1843. }
  1844. static int SuperTraceGetFaxStatistics(void *hLib) {
  1845. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1846. pLib->fax_ifc_stats = 1;
  1847. return (ScheduleNextTraceRequest(pLib));
  1848. }
  1849. static int SuperTraceGetBLayer1Statistics(void *hLib) {
  1850. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1851. pLib->b1_ifc_stats = 1;
  1852. return (ScheduleNextTraceRequest(pLib));
  1853. }
  1854. static int SuperTraceGetBLayer2Statistics(void *hLib) {
  1855. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1856. pLib->b2_ifc_stats = 1;
  1857. return (ScheduleNextTraceRequest(pLib));
  1858. }
  1859. static int SuperTraceGetDLayer1Statistics(void *hLib) {
  1860. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1861. pLib->d1_ifc_stats = 1;
  1862. return (ScheduleNextTraceRequest(pLib));
  1863. }
  1864. static int SuperTraceGetDLayer2Statistics(void *hLib) {
  1865. diva_strace_context_t *pLib = (diva_strace_context_t *)hLib;
  1866. pLib->d2_ifc_stats = 1;
  1867. return (ScheduleNextTraceRequest(pLib));
  1868. }
  1869. dword DivaSTraceGetMemotyRequirement(int channels) {
  1870. dword parse_entries = (MODEM_PARSE_ENTRIES + FAX_PARSE_ENTRIES + \
  1871. STAT_PARSE_ENTRIES + \
  1872. LINE_PARSE_ENTRIES + 1) * channels;
  1873. return (sizeof(diva_strace_context_t) + \
  1874. (parse_entries * sizeof(diva_strace_path2action_t)));
  1875. }