amphost.c.html 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597
  1. <?xml version='1.0' encoding='iso-8859-1'?>
  2. <!doctype html public '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
  3. <html xmlns='http://www.w3c.org/1999/xhtml' lang='en-us'>
  4. <head>
  5. <title>
  6. amphost.c
  7. </title>
  8. <meta http-equiv='content-type' content='text/html;iso-8859-1'/>
  9. <meta name='generator' content='motley-tools 1.9.4 13:40:33 Feb 18 2015'/>
  10. <meta name='author' content='cmaier@cmassoc.net'/>
  11. <meta name='robots' content='noindex,nofollow'/>
  12. <link href='toolkit.css' rel='stylesheet' type='text/css'/>
  13. </head>
  14. <body>
  15. <div class='headerlink'>
  16. [<a href='ampboot.c.html' title=' ampboot.c '>PREV</a>]
  17. [<a href='toolkit.html' title=' Index '>HOME</a>]
  18. [<a href='ampID.c.html' title=' ampID.c '>NEXT</a>]
  19. </div>
  20. <pre>
  21. /*====================================================================*
  22. *
  23. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  24. *
  25. * All rights reserved.
  26. *
  27. * Redistribution and use in source and binary forms, with or
  28. * without modification, are permitted (subject to the limitations
  29. * in the disclaimer below) provided that the following conditions
  30. * are met:
  31. *
  32. * * Redistributions of source code must retain the above copyright
  33. * notice, this list of conditions and the following disclaimer.
  34. *
  35. * * Redistributions in binary form must reproduce the above
  36. * copyright notice, this list of conditions and the following
  37. * disclaimer in the documentation and/or other materials
  38. * provided with the distribution.
  39. *
  40. * * Neither the name of Qualcomm Atheros nor the names of
  41. * its contributors may be used to endorse or promote products
  42. * derived from this software without specific prior written
  43. * permission.
  44. *
  45. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  46. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE
  47. * COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND ANY EXPRESS OR
  48. * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  49. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  50. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
  51. * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  52. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  53. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  54. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  55. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  56. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  57. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  58. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  59. *
  60. *--------------------------------------------------------------------*/
  61. /*====================================================================*&quot;
  62. *
  63. * amphost.c -
  64. *
  65. *
  66. * Contributor(s):
  67. * Charles Maier &lt;cmaier@qca.qualcomm.com&gt;
  68. * Nathaniel Houghton &lt;nhoughto@qca.qualcomm.com&gt;
  69. *
  70. *--------------------------------------------------------------------*/
  71. /*====================================================================*&quot;
  72. * system header files;
  73. *--------------------------------------------------------------------*/
  74. #include &lt;unistd.h&gt;
  75. #include &lt;stdlib.h&gt;
  76. #include &lt;limits.h&gt;
  77. #include &lt;string.h&gt;
  78. #include &lt;ctype.h&gt;
  79. /*====================================================================*
  80. * custom header files;
  81. *--------------------------------------------------------------------*/
  82. #include &quot;../tools/getoptv.h&quot;
  83. #include &quot;../tools/putoptv.h&quot;
  84. #include &quot;../tools/memory.h&quot;
  85. #include &quot;../tools/number.h&quot;
  86. #include &quot;../tools/types.h&quot;
  87. #include &quot;../tools/flags.h&quot;
  88. #include &quot;../tools/files.h&quot;
  89. #include &quot;../tools/error.h&quot;
  90. #include &quot;../ram/nvram.h&quot;
  91. #include &quot;../ram/sdram.h&quot;
  92. #include &quot;../plc/plc.h&quot;
  93. #include &quot;../nvm/nvm.h&quot;
  94. #include &quot;../pib/pib.h&quot;
  95. /*====================================================================*
  96. * custom source files;
  97. *--------------------------------------------------------------------*/
  98. #ifndef MAKEFILE
  99. #include &quot;../plc/chipset.c&quot;
  100. #include &quot;../plc/Confirm.c&quot;
  101. #include &quot;../plc/Devices.c&quot;
  102. #include &quot;../plc/Failure.c&quot;
  103. #include &quot;../plc/FactoryDefaults.c&quot;
  104. #include &quot;../plc/FlashDevice1.c&quot;
  105. #include &quot;../plc/FlashNVM.c&quot;
  106. #include &quot;../plc/HostActionResponse.c&quot;
  107. #include &quot;../plc/Request.c&quot;
  108. #include &quot;../plc/ResetDevice.c&quot;
  109. #include &quot;../plc/ReadMME.c&quot;
  110. #include &quot;../plc/SendMME.c&quot;
  111. #include &quot;../plc/WaitForReset.c&quot;
  112. #include &quot;../plc/WaitForStart.c&quot;
  113. #include &quot;../plc/WaitForRestart.c&quot;
  114. #include &quot;../plc/WriteExecuteFirmware1.c&quot;
  115. #include &quot;../plc/WriteExecutePIB.c&quot;
  116. #include &quot;../plc/WriteMEM.c&quot;
  117. #include &quot;../plc/WriteNVM.c&quot;
  118. #include &quot;../plc/WritePIB.c&quot;
  119. #include &quot;../plc/ReadFirmware1.c&quot;
  120. #include &quot;../plc/ReadParameters1.c&quot;
  121. #include &quot;../plc/InitDevice1.c&quot;
  122. #include &quot;../plc/BootDevice1.c&quot;
  123. #include &quot;../plc/BootFirmware1.c&quot;
  124. #include &quot;../plc/BootParameters1.c&quot;
  125. #include &quot;../plc/WriteFirmware1.c&quot;
  126. #include &quot;../plc/StartFirmware1.c&quot;
  127. #include &quot;../plc/ModuleRead.c&quot;
  128. #endif
  129. #ifndef MAKEFILE
  130. #include &quot;../tools/getoptv.c&quot;
  131. #include &quot;../tools/putoptv.c&quot;
  132. #include &quot;../tools/version.c&quot;
  133. #include &quot;../tools/uintspec.c&quot;
  134. #include &quot;../tools/checkfilename.c&quot;
  135. #include &quot;../tools/hexdecode.c&quot;
  136. #include &quot;../tools/hexstring.c&quot;
  137. #include &quot;../tools/todigit.c&quot;
  138. #include &quot;../tools/hexdump.c&quot;
  139. #include &quot;../tools/checksum32.c&quot;
  140. #include &quot;../tools/fdchecksum32.c&quot;
  141. #include &quot;../tools/error.c&quot;
  142. #include &quot;../tools/strfbits.c&quot;
  143. #include &quot;../tools/typename.c&quot;
  144. #endif
  145. #ifndef MAKEFILE
  146. #include &quot;../ether/openchannel.c&quot;
  147. #include &quot;../ether/closechannel.c&quot;
  148. #include &quot;../ether/readpacket.c&quot;
  149. #include &quot;../ether/sendpacket.c&quot;
  150. #include &quot;../ether/channel.c&quot;
  151. #endif
  152. #ifndef MAKEFILE
  153. #include &quot;../mme/EthernetHeader.c&quot;
  154. #include &quot;../mme/QualcommHeader.c&quot;
  155. #include &quot;../mme/UnwantedMessage.c&quot;
  156. #include &quot;../mme/MMECode.c&quot;
  157. #endif
  158. #ifndef MAKEFILE
  159. #include &quot;../ram/sdramfile.c&quot;
  160. #include &quot;../ram/sdrampeek.c&quot;
  161. #endif
  162. #ifndef MAKEFILE
  163. #include &quot;../nvm/nvmfile1.c&quot;
  164. #endif
  165. #ifndef MAKEFILE
  166. #include &quot;../pib/pibpeek1.c&quot;
  167. #include &quot;../pib/pibfile1.c&quot;
  168. #endif
  169. #ifndef MAKEFILE
  170. #include &quot;../key/keys.c&quot;
  171. #endif
  172. /*====================================================================*
  173. * program constants;
  174. *--------------------------------------------------------------------*/
  175. #define NEWPIB &quot;user.pib&quot;
  176. #define NEWNVM &quot;user.nvm&quot;
  177. /*====================================================================*
  178. *
  179. * signed function (struct plc * plc);
  180. *
  181. * plc.h
  182. *
  183. * wait indefinitely for VS_HOST_ACTION messages; service the device
  184. * only; it will stop dead - like a bug! - on error;
  185. *
  186. *
  187. * Contributor(s):
  188. * Charles Maier &lt;cmaier@qca.qualcomm.com&gt;
  189. *
  190. *--------------------------------------------------------------------*/
  191. signed function (struct plc * plc)
  192. {
  193. struct channel * channel = (struct channel *)(plc-&gt;channel);
  194. struct message * message = (struct message *)(plc-&gt;message);
  195. static char const * actions [] =
  196. {
  197. &quot;start device&quot;,
  198. &quot;store firmware&quot;,
  199. &quot;store parameters&quot;,
  200. &quot;update host&quot;,
  201. &quot;config memory&quot;,
  202. &quot;restore defaults&quot;,
  203. &quot;unknown&quot;
  204. };
  205. #ifndef __GNUC__
  206. #pragma pack (push,1)
  207. #endif
  208. struct __packed vs_host_action_ind
  209. {
  210. struct ethernet_hdr ethernet;
  211. struct qualcomm_hdr qualcomm;
  212. uint8_t MACTION;
  213. uint8_t MAJOR_VERSION;
  214. uint8_t MINOR_VERSION;
  215. }
  216. * indicate = (struct vs_host_action_ind *) (message);
  217. #ifndef __GNUC__
  218. #pragma pack (pop)
  219. #endif
  220. char const * FactoryNVM = plc-&gt;NVM.name;
  221. char const * FactoryPIB = plc-&gt;PIB.name;
  222. signed status;
  223. signed action;
  224. Request (plc, &quot;Waiting for Host Action&quot;);
  225. while (1)
  226. {
  227. status = ReadMME (plc, 0, (VS_HOST_ACTION | MMTYPE_IND));
  228. if (status &lt; 0)
  229. {
  230. break;
  231. }
  232. if (status &gt; 0)
  233. {
  234. printf (&quot;\n&quot;);
  235. if (indicate-&gt;MACTION &lt; SIZEOF (actions))
  236. {
  237. Confirm (plc, &quot;Host Action Request is (%d) %s.&quot;, indicate-&gt;MACTION, actions [indicate-&gt;MACTION]);
  238. }
  239. else
  240. {
  241. error (0, ENOTSUP, &quot;Host Action 0x%0X&quot;, indicate-&gt;MACTION);
  242. continue;
  243. }
  244. action = indicate-&gt;MACTION;
  245. memcpy (channel-&gt;peer, indicate-&gt;ethernet.OSA, sizeof (channel-&gt;peer));
  246. if (HostActionResponse (plc))
  247. {
  248. return (-1);
  249. }
  250. if (action == 0x00)
  251. {
  252. if (BootDevice1 (plc))
  253. {
  254. return (-1);
  255. }
  256. if (_anyset (plc-&gt;flags, PLC_FLASH_DEVICE))
  257. {
  258. FlashDevice1 (plc);
  259. }
  260. continue;
  261. }
  262. if (action == 0x01)
  263. {
  264. close (plc-&gt;NVM.file);
  265. if (ReadFirmware1 (plc))
  266. {
  267. return (-1);
  268. }
  269. if ((plc-&gt;NVM.file = open (plc-&gt;NVM.name = plc-&gt;nvm.name, O_BINARY|O_RDONLY)) == -1)
  270. {
  271. error (1, errno, &quot;%s&quot;, plc-&gt;NVM.name);
  272. }
  273. if (ResetDevice (plc))
  274. {
  275. return (-1);
  276. }
  277. continue;
  278. }
  279. if (action == 0x02)
  280. {
  281. close (plc-&gt;PIB.file);
  282. if (ReadParameters1 (plc))
  283. {
  284. return (-1);
  285. }
  286. if ((plc-&gt;PIB.file = open (plc-&gt;PIB.name = plc-&gt;pib.name, O_BINARY|O_RDONLY)) == -1)
  287. {
  288. error (1, errno, &quot;%s&quot;, plc-&gt;PIB.name);
  289. }
  290. if (ResetDevice (plc))
  291. {
  292. return (-1);
  293. }
  294. continue;
  295. }
  296. if (action == 0x03)
  297. {
  298. close (plc-&gt;PIB.file);
  299. if (ReadParameters1 (plc))
  300. {
  301. return (-1);
  302. }
  303. if ((plc-&gt;PIB.file = open (plc-&gt;PIB.name = plc-&gt;pib.name, O_BINARY|O_RDONLY)) == -1)
  304. {
  305. error (1, errno, &quot;%s&quot;, plc-&gt;PIB.name);
  306. }
  307. close (plc-&gt;NVM.file);
  308. if (ReadFirmware1 (plc))
  309. {
  310. return (-1);
  311. }
  312. if ((plc-&gt;NVM.file = open (plc-&gt;NVM.name = plc-&gt;nvm.name, O_BINARY|O_RDONLY)) == -1)
  313. {
  314. error (1, errno, &quot;%s&quot;, plc-&gt;NVM.name);
  315. }
  316. if (ResetDevice (plc))
  317. {
  318. return (-1);
  319. }
  320. continue;
  321. }
  322. if (action == 0x04)
  323. {
  324. if (InitDevice1 (plc))
  325. {
  326. return (-1);
  327. }
  328. continue;
  329. }
  330. if (action == 0x05)
  331. {
  332. close (plc-&gt;PIB.file);
  333. if ((plc-&gt;PIB.file = open (plc-&gt;PIB.name = FactoryPIB, O_BINARY|O_RDONLY)) == -1)
  334. {
  335. error (1, errno, &quot;%s&quot;, plc-&gt;PIB.name);
  336. }
  337. close (plc-&gt;NVM.file);
  338. if ((plc-&gt;NVM.file = open (plc-&gt;NVM.name = FactoryNVM, O_BINARY|O_RDONLY)) == -1)
  339. {
  340. error (1, errno, &quot;%s&quot;, plc-&gt;NVM.name);
  341. }
  342. if (ResetDevice (plc))
  343. {
  344. return (-1);
  345. }
  346. continue;
  347. }
  348. if (action == 0x06)
  349. {
  350. close (plc-&gt;PIB.file);
  351. if (ReadParameters1 (plc))
  352. {
  353. return (-1);
  354. }
  355. if ((plc-&gt;PIB.file = open (plc-&gt;PIB.name = plc-&gt;pib.name, O_BINARY|O_RDONLY)) == -1)
  356. {
  357. error (1, errno, &quot;%s&quot;, plc-&gt;PIB.name);
  358. }
  359. continue;
  360. }
  361. error (0, ENOSYS, &quot;Host Action 0x%02X&quot;, action);
  362. }
  363. }
  364. return (0);
  365. }
  366. /*====================================================================*
  367. *
  368. * int main (int argc, char const * argv[]);
  369. *
  370. * parse command line, populate plc structure and perform selected
  371. * operations; show help summary when asked; see getoptv and putoptv
  372. * to understand command line parsing and help summary display; see
  373. * plc.h for the definition of struct plc;
  374. *
  375. * the default interface is eth1 because most people use eth0 as
  376. * their principle network connection; you can specify another
  377. * interface with -i or define environment string PLC to make
  378. * that the default interface and save typing;
  379. *
  380. *
  381. *--------------------------------------------------------------------*/
  382. int main (int argc, char const * argv [])
  383. {
  384. extern struct channel channel;
  385. static char const * optv [] =
  386. {
  387. &quot;Fi:n:N:p:P:qt:vx&quot;,
  388. &quot;-N file -P file [-n file] [-p file]&quot;,
  389. &quot;Qualcomm Atheros INT6400 Host Emulator&quot;,
  390. &quot;F[F]\tflash (force) NVRAM using VS_MOD_NVM&quot;,
  391. #if defined (WINPCAP) || defined (LIBPCAP)
  392. &quot;i n\thost interface is (n) [&quot; LITERAL (CHANNEL_ETHNUMBER) &quot;]&quot;,
  393. #else
  394. &quot;i s\thost interface is (s) [&quot; LITERAL (CHANNEL_ETHDEVICE) &quot;]&quot;,
  395. #endif
  396. &quot;n f\tread NVM from device into file using VS_RD_MOD&quot;,
  397. &quot;N f\twrite NVM file to device using VS_WR_MEM&quot;,
  398. &quot;p f\tread PIB from device into file using VS_RD_MOD&quot;,
  399. &quot;P f\twrite PIB file to device using VS_WR_MEM&quot;,
  400. &quot;q\tquiet mode&quot;,
  401. &quot;t n\tread timeout is (n) milliseconds [&quot; LITERAL (CHANNEL_TIMEOUT) &quot;]&quot;,
  402. &quot;v\tverbose mode&quot;,
  403. &quot;x\texit on error&quot;,
  404. (char const *) (0)
  405. };
  406. #include &quot;../plc/plc.c&quot;
  407. signed c;
  408. if (getenv (PLCDEVICE))
  409. {
  410. #if defined (WINPCAP) || defined (LIBPCAP)
  411. channel.ifindex = atoi (getenv (PLCDEVICE));
  412. #else
  413. channel.ifname = strdup (getenv (PLCDEVICE));
  414. #endif
  415. }
  416. optind = 1;
  417. while ((c = getoptv (argc, argv, optv)) != -1)
  418. {
  419. switch (c)
  420. {
  421. case 'F':
  422. _setbits (plc.module, (VS_MODULE_MAC | VS_MODULE_PIB));
  423. if (_anyset (plc.flags, PLC_FLASH_DEVICE))
  424. {
  425. _setbits (plc.module, VS_MODULE_FORCE);
  426. }
  427. _setbits (plc.flags, PLC_FLASH_DEVICE);
  428. break;
  429. case 'i':
  430. #if defined (WINPCAP) || defined (LIBPCAP)
  431. channel.ifindex = atoi (optarg);
  432. #else
  433. channel.ifname = optarg;
  434. #endif
  435. break;
  436. case 'N':
  437. if (!checkfilename (optarg))
  438. {
  439. error (1, EINVAL, &quot;%s&quot;, optarg);
  440. }
  441. if ((plc.NVM.file = open (plc.NVM.name = optarg, O_BINARY|O_RDONLY)) == -1)
  442. {
  443. error (1, errno, &quot;%s&quot;, plc.NVM.name);
  444. }
  445. if (nvmfile1 (&amp;plc.NVM))
  446. {
  447. error (1, errno, &quot;Bad firmware file: %s&quot;, plc.NVM.name);
  448. }
  449. _setbits (plc.flags, PLC_WRITE_MAC);
  450. break;
  451. case 'n':
  452. if (!checkfilename (optarg))
  453. {
  454. error (1, EINVAL, &quot;%s&quot;, optarg);
  455. }
  456. if ((plc.nvm.file = open (plc.nvm.name = optarg, O_BINARY|O_CREAT|O_RDWR|O_TRUNC, FILE_FILEMODE)) == -1)
  457. {
  458. error (1, errno, &quot;%s&quot;, plc.nvm.name);
  459. }
  460. break;
  461. case 'P':
  462. if (!checkfilename (optarg))
  463. {
  464. error (1, EINVAL, &quot;%s&quot;, optarg);
  465. }
  466. if ((plc.PIB.file = open (plc.PIB.name = optarg, O_BINARY|O_RDONLY)) == -1)
  467. {
  468. error (1, errno, &quot;%s&quot;, plc.PIB.name);
  469. }
  470. if (pibfile1 (&amp;plc.PIB))
  471. {
  472. error (1, errno, &quot;Bad parameter file: %s&quot;, plc.PIB.name);
  473. }
  474. _setbits (plc.flags, PLC_WRITE_PIB);
  475. break;
  476. case 'p':
  477. if (!checkfilename (optarg))
  478. {
  479. error (1, EINVAL, &quot;%s&quot;, optarg);
  480. }
  481. if ((plc.pib.file = open (plc.pib.name = optarg, O_BINARY|O_CREAT|O_RDWR|O_TRUNC, FILE_FILEMODE)) == -1)
  482. {
  483. error (1, errno, &quot;%s&quot;, plc.pib.name);
  484. }
  485. break;
  486. case 'q':
  487. _setbits (channel.flags, CHANNEL_SILENCE);
  488. _setbits (plc.flags, PLC_SILENCE);
  489. break;
  490. case 't':
  491. channel.timeout = (signed)(uintspec (optarg, 0, UINT_MAX));
  492. break;
  493. case 'v':
  494. _setbits (channel.flags, CHANNEL_VERBOSE);
  495. _setbits (plc.flags, PLC_VERBOSE);
  496. break;
  497. case 'x':
  498. _setbits (plc.flags, PLC_BAILOUT);
  499. break;
  500. default:
  501. break;
  502. }
  503. }
  504. argc -= optind;
  505. argv += optind;
  506. if (argc)
  507. {
  508. error (1, ENOTSUP, ERROR_TOOMANY);
  509. }
  510. if (plc.NVM.file == -1)
  511. {
  512. error (1, ECANCELED, &quot;No host NVM file named&quot;);
  513. }
  514. if (plc.PIB.file == -1)
  515. {
  516. error (1, ECANCELED, &quot;No host PIB file named&quot;);
  517. }
  518. if (plc.nvm.file == -1)
  519. {
  520. if ((plc.nvm.file = open (plc.nvm.name = NEWNVM, O_BINARY|O_CREAT|O_RDWR|O_TRUNC, FILE_FILEMODE)) == -1)
  521. {
  522. error (1, errno, &quot;%s&quot;, plc.nvm.name);
  523. }
  524. }
  525. if (plc.pib.file == -1)
  526. {
  527. if ((plc.pib.file = open (plc.pib.name = NEWPIB, O_BINARY|O_CREAT|O_RDWR|O_TRUNC, FILE_FILEMODE)) == -1)
  528. {
  529. error (1, errno, &quot;%s&quot;, plc.pib.name);
  530. }
  531. }
  532. openchannel (&amp;channel);
  533. if (!(plc.message = malloc (sizeof (* plc.message))))
  534. {
  535. error (1, errno, PLC_NOMEMORY);
  536. }
  537. function (&amp;plc);
  538. free (plc.message);
  539. closechannel (&amp;channel);
  540. exit (0);
  541. }
  542. </pre>
  543. <div class='footerlink'>
  544. [<a href='ampboot.c.html' title=' ampboot.c '>PREV</a>]
  545. [<a href='toolkit.html' title=' Index '>HOME</a>]
  546. [<a href='ampID.c.html' title=' ampID.c '>NEXT</a>]
  547. </div>
  548. </body>
  549. </html>