main.pm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. package Rstat::main;
  2. #
  3. # Copyright (C) Roman Dmitiriev, rnd@rajven.ru
  4. #
  5. use utf8;
  6. use strict;
  7. use English;
  8. use FindBin '$Bin';
  9. use lib "$Bin";
  10. use base 'Exporter';
  11. use vars qw(@EXPORT @ISA);
  12. use Rstat::config;
  13. use Socket;
  14. use IO::Select;
  15. use IO::Handle;
  16. use Crypt::CBC;
  17. use MIME::Base64;
  18. our @ISA = qw(Exporter);
  19. our @EXPORT = qw(
  20. log_file
  21. write_to_file
  22. wrlog
  23. log_session
  24. log_warning
  25. log_info
  26. log_debug
  27. log_error
  28. log_verbose
  29. log_die
  30. timestamp
  31. do_exec
  32. do_exec_ref
  33. do_exit
  34. sendEmail
  35. IsNotRun
  36. IsMyPID
  37. Add_PID
  38. Remove_PID
  39. IsNotLocked
  40. IsMyLock
  41. Add_Lock
  42. Remove_Lock
  43. DefHash
  44. read_file
  45. uniq
  46. strim
  47. trim
  48. is_integer
  49. is_float
  50. run_in_parallel
  51. translit
  52. crypt_string
  53. decrypt_string
  54. netdev_set_auth
  55. );
  56. BEGIN
  57. {
  58. #---------------------------------------------------------------------------------------------------------
  59. sub log_file {
  60. return if (!$_[0]);
  61. return if (!$_[1]);
  62. return if (!$_[2]);
  63. open (LG,">>$_[0]") || die("Error open log file $_[0]!!! die...");
  64. my ($sec,$min,$hour,$mday,$mon,$year) = (localtime())[0,1,2,3,4,5];
  65. $mon += 1; $year += 1900;
  66. my @msg = split("\n",$_[2]);
  67. foreach my $row (@msg) {
  68. next if (!$row);
  69. printf LG "%04d%02d%02d-%02d%02d%02d %s [%d] %s\n",$year,$mon,$mday,$hour,$min,$sec,$_[1],$$,$row;
  70. }
  71. close (LG);
  72. if ($< ==0) {
  73. my $uid = getpwnam $log_owner_user;
  74. my $gid = getgrnam $log_owner_user;
  75. if (!$gid) { $gid=getgrnam "root"; }
  76. if (!$uid) { $uid=getpwnam "root"; }
  77. chown $uid, $gid, $_[0];
  78. chmod oct("0660"), $_[0];
  79. }
  80. }
  81. #---------------------------------------------------------------------------------------------------------
  82. sub write_to_file {
  83. return if (!$_[0]);
  84. return if (!$_[1]);
  85. my $f_name = shift;
  86. my $cmd = shift;
  87. my $append = shift;
  88. if ($append) {
  89. open (LG,">>$f_name") || die("Error open file $f_name!!! die...");
  90. } else {
  91. open (LG,">$f_name") || die("Error open file $f_name!!! die...");
  92. }
  93. if (ref($cmd) eq 'ARRAY') {
  94. foreach my $row (@$cmd) {
  95. next if (!$row);
  96. print LG $row."\n";
  97. }
  98. } else {
  99. my @msg = split("\n",$cmd);
  100. foreach my $row (@msg) {
  101. next if (!$row);
  102. print LG $row."\n";
  103. }
  104. }
  105. close (LG);
  106. }
  107. #---------------------------------------------------------------------------------------------------------
  108. sub wrlog {
  109. my $level = shift;
  110. my $string = shift;
  111. my $PRN_LEVEL = 'INFO:';
  112. if ($level == $W_INFO) { log_info($string); }
  113. if ($level == $W_ERROR) { $PRN_LEVEL = 'ERROR:'; log_error($string); }
  114. if ($level == $W_DEBUG) { $PRN_LEVEL = 'DEBUG'; log_debug($string); }
  115. my @msg = split("\n",$string);
  116. foreach my $row (@msg) {
  117. next if (!$row);
  118. print $PRN_LEVEL.' '.$row."\n";
  119. }
  120. }
  121. #---------------------------------------------------------------------------------------------------------
  122. sub log_session { log_file($LOG_COMMON,"SESSION:",$_[0]) if ($log_enable); }
  123. #---------------------------------------------------------------------------------------------------------
  124. sub log_info { log_file($LOG_COMMON,"INFO:",$_[0]) if ($log_enable); }
  125. #---------------------------------------------------------------------------------------------------------
  126. sub log_verbose { log_file($LOG_COMMON,"VERBOSE:",$_[0]) if ($log_enable); }
  127. #---------------------------------------------------------------------------------------------------------
  128. sub log_warning { log_file($LOG_COMMON,"WARN:",$_[0]) if ($log_enable); }
  129. #---------------------------------------------------------------------------------------------------------
  130. sub log_debug { log_file($LOG_DEBUG,"DEBUG:",$_[0]) if $debug; }
  131. #---------------------------------------------------------------------------------------------------------
  132. sub log_error { log_file($LOG_ERR,"ERROR:",$_[0]) if ($log_enable); }
  133. #---------------------------------------------------------------------------------------------------------
  134. sub log_die {
  135. wrlog($W_ERROR,$_[0]);
  136. my $worktime = time()-$BASETIME;
  137. log_info("Script work $worktime sec.");
  138. sendEmail("$HOSTNAME - $MY_NAME die! ","Process: $MY_NAME aborted with error:\n$_[0]");
  139. die ($_[0]);
  140. }
  141. #---------------------------------------------------------------------------------------------------------
  142. sub timestamp {
  143. my $worktime = time()-$BASETIME;
  144. log_info("TimeStamp: $worktime sec.");
  145. }
  146. #---------------------------------------------------------------------------------------------------------.
  147. sub do_exec_ref {
  148. my $ret = `$_[0]`;
  149. my $res = $?;
  150. my %result;
  151. chomp($ret);
  152. $result{output}=$ret;
  153. $result{status}=$res;
  154. log_debug("Run: $_[0] Output:\n$ret\nResult code: $res");
  155. if ($res eq "0") { log_info("Run: $_[0] - $ret"); } else { log_error("Run: $_[0] - $ret"); }
  156. return %result;
  157. }
  158. #---------------------------------------------------------------------------------------------------------
  159. sub do_exec {
  160. my $ret = `$_[0]`;
  161. my $res = $?;
  162. log_debug("Run: $_[0] Output:\n$ret\nResult code: $res");
  163. if ($res eq "0") {
  164. log_info("Run: $_[0] - $ret");
  165. } else {
  166. $ret = "Error";
  167. log_error("Run: $_[0] - $ret");
  168. }
  169. return $ret;
  170. }
  171. #---------------------------------------------------------------------------------------------------------
  172. sub do_exit {
  173. my $worktime = time()-$BASETIME;
  174. my $code;
  175. if ($_[0]) { $code = $_[0]; } else { $code = 0; }
  176. log_info("Script work $worktime sec. Exit code: $code");
  177. exit $code;
  178. }
  179. #---------------------------------------------------------------------------------------------------------
  180. sub sendEmail {
  181. my ($subject, $message, $crf) = @_;
  182. return if (!$send_email);
  183. my $sendmail = '/sbin/sendmail';
  184. open(MAIL, "|$sendmail -oi -t");
  185. print MAIL "From: $sender_email\n";
  186. print MAIL "To: $admin_email\n";
  187. print MAIL "Subject: $subject\nMIME-Version: 1.0\nContent-Language: ru\nContent-Type: text/html; charset=utf-8\nContent-Transfer-Encoding: 8bit\n\n";
  188. print MAIL '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
  189. print MAIL '<html xmlns="http://www.w3.org/1999/xhtml">'."\n";
  190. print MAIL "<head><title>$subject </title></head><body>\n";
  191. my @msg = split("\n",$message);
  192. foreach my $row (@msg) {
  193. if ($crf) { print MAIL "$row<br>"; } else { print MAIL "$row\n"; };
  194. }
  195. print MAIL "</body></html>\n";
  196. close(MAIL);
  197. log_info("Send email from $sender_email to $admin_email with subject: $subject");
  198. log_debug("Body:\n$message");
  199. }
  200. #---------------------------------------------------------------------------------------------------------
  201. ### Check few run script
  202. sub IsNotRun {
  203. my $pname = shift;
  204. my $lockfile = $pname.".pid";
  205. # if pid file not exists - OK
  206. log_debug("Check what pid file $lockfile exists.");
  207. if (! -e $lockfile) { log_debug("pid file not found. Continue."); return 1; }
  208. open (FF,"<$lockfile") or log_die("can't open file $lockfile: $!");
  209. my $lockid = <FF>;
  210. close(FF);
  211. chomp($lockid);
  212. # If the process ID belongs to the current program - OK
  213. if ($lockid eq $$) { log_debug("pid file found, but owner is this process. Continue. "); return 1; }
  214. # if owner of this process ID not exists - OK
  215. my $process_count = `ps -p $lockid | grep \'$lockid\' | wc -l`;
  216. chomp($process_count);
  217. log_debug("Process count with id $lockid is $process_count");
  218. if ($process_count==0) { log_debug("pid file found, but owner process not found. Remove lock file and continue. "); unlink $lockfile; return 1; }
  219. log_debug("Another proceess with name $MY_NAME pid: $lockid already worked. ");
  220. return 0;
  221. }
  222. #---------------------------------------------------------------------------------------------------------
  223. sub IsMyPID {
  224. my $pname = shift;
  225. my $lockfile = $pname.".pid";
  226. log_debug("Check what pid file $lockfile exists.");
  227. if (! -e $lockfile) { log_debug("pid file not found. Continue."); return 1; }
  228. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  229. my $lockid = <FF>;
  230. close(FF);
  231. chomp($lockid);
  232. if ($lockid eq $$) { log_debug("pid file is my. continue."); return 1; }
  233. log_debug("Another proceess with name $MY_NAME pid: $lockid already worked. ");
  234. return 0;
  235. }
  236. #---------------------------------------------------------------------------------------------------------
  237. sub Add_PID {
  238. my $pname = shift;
  239. my $lockfile = $pname.".pid";
  240. log_debug("Try create lock file $lockfile");
  241. open (FF,">$lockfile") or log_die "can't open file $lockfile: $!";
  242. flock(FF,2) or log_die "can't flock $lockfile: $!";
  243. print FF $$;
  244. close(FF);
  245. log_debug("Ok.");
  246. return 1;
  247. }
  248. #---------------------------------------------------------------------------------------------------------
  249. sub Remove_PID {
  250. my $pname = shift;
  251. my $lockfile = $pname.".pid";
  252. log_debug("Check what pid file $lockfile exists.");
  253. if (! -e $lockfile) { log_debug("pid file not exists. Continue."); return 1; }
  254. unlink $lockfile or return 0;
  255. log_debug("pid file $lockfile removed.");
  256. return 1;
  257. }
  258. #---------------------------------------------------------------------------------------------------------
  259. sub IsNotLocked {
  260. my $lockfile = $_[0] . ".lock";
  261. log_debug("Check what lock file $lockfile exists.");
  262. if (! -e $lockfile) { log_debug("lock file not found. Continue."); return 1; }
  263. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  264. my $lockid = <FF>;
  265. close(FF);
  266. chomp($lockid);
  267. if ($lockid eq $$) { log_debug("lock file found, but it is owner is this process. Continue. "); return 1; }
  268. my $process_count = `ps -p $lockid | grep \'$lockid\' | wc -l`;
  269. if ($process_count lt 1) { log_debug("lock file found, but owner process not found. Remove lock file and continue. "); unlink $lockfile; return 1; }
  270. log_debug("Another proceess with pid: $lockid already use $_[0]");
  271. return 0;
  272. }
  273. #---------------------------------------------------------------------------------------------------------
  274. sub IsMyLock {
  275. my $lockfile = $_[0] . ".lock";
  276. log_debug("Check what lock file $lockfile exists.");
  277. if (! -e $lockfile) { log_debug("lock file not found. Continue."); return 0; }
  278. open (FF,"<$lockfile") or log_die "can't open file $lockfile: $!";
  279. my $lockid = <FF>;
  280. close(FF);
  281. chomp($lockid);
  282. if ($lockid eq $$) { log_debug("lock file found, but it is owner is this process. Continue. "); return 1; }
  283. log_debug("file $_[0] used by process with pid: $lockid");
  284. return 0;
  285. }
  286. #---------------------------------------------------------------------------------------------------------
  287. sub Add_Lock {
  288. if (!IsNotLocked($_[0])) { return 0; }
  289. my $lockfile = $_[0] . ".lock";
  290. open (FF,">$lockfile") or log_die "can't open file $lockfile: $!";
  291. flock(FF,2) or log_die "can't flock $lockfile: $!";
  292. print FF $$;
  293. close(FF);
  294. log_debug("Create lock file for $_[0]");
  295. return 1;
  296. }
  297. #---------------------------------------------------------------------------------------------------------
  298. sub Remove_Lock {
  299. if (!IsNotLocked($_[0])) { return 0; }
  300. my $lockfile = $_[0] . ".lock";
  301. if (! -e $lockfile) { return 1; }
  302. unlink $lockfile or return 0;
  303. log_debug("Lock file for $_[0] removed");
  304. return 1;
  305. }
  306. #---------------------------------------------------------------------------------------------------------
  307. sub DefHash {
  308. my $hash=$_[0];
  309. my $num_list = $_[1];
  310. my %num_keys;
  311. if ($num_list) {
  312. my @ret_num = split(' ',$num_list);
  313. %num_keys = map { $_, 1 } @ret_num;
  314. }
  315. foreach my $key (keys %$hash) {
  316. my $null_value = "";
  317. $null_value = 0 if (defined $num_keys{$key});
  318. $hash->{$key}=$null_value if (!defined($hash->{$key}));
  319. }
  320. return $hash;
  321. }
  322. #---------------------------------------------------------------------------------------------------------
  323. sub read_file {
  324. my $filename = shift;
  325. return if (!$filename);
  326. return if (!-e $filename);
  327. open (FF,"<$filename") or die "unable to open file $filename!" ;
  328. my @tmp=<FF>;
  329. close(FF);
  330. chomp(@tmp);
  331. return @tmp;
  332. }
  333. #---------------------------------------------------------------------------------------------------------
  334. sub uniq (\@) {
  335. my @tmp = @{(shift)};
  336. if (scalar(@tmp) eq 0) { return @tmp; }
  337. chomp(@tmp);
  338. my %newlist = map { $_, 1 } @tmp;
  339. return keys %newlist;
  340. }
  341. #---------------------------------------------------------------------------------------------------------
  342. sub strim {
  343. my $str=shift;
  344. return if (!$str);
  345. #$str =~ s/.*[^[:print:]]+//g;
  346. #$str =~ s/[^[:print:]]+//g;
  347. #$str =~ s/[^(a-z|A-Z|0-9|\:|\-|\s|\.)]//g;
  348. #$str =~ s/[:^print:]//g;
  349. $str =~ s/[^[:ascii:]]//g;
  350. $str =~ s/^\s+//g;
  351. $str =~ s/\s+$//g;
  352. return $str;
  353. }
  354. #---------------------------------------------------------------------------------------------------------
  355. sub trim {
  356. my $str=shift;
  357. return if (!$str);
  358. $str =~ s/\n/ /g;
  359. $str =~ s/^\s+//g;
  360. $str =~ s/\s+$//g;
  361. return $str;
  362. }
  363. #---------------------------------------------------------------------------------------------------------
  364. sub is_integer {
  365. defined $_[0] && $_[0] =~ /^[+-]?\d+$/;
  366. }
  367. #---------------------------------------------------------------------------------------------------------
  368. sub is_float {
  369. defined $_[0] && $_[0] =~ /^[+-]?\d+(\.\d+)?$/;
  370. }
  371. #---------------------------------------------------------------------------------------------------------
  372. sub run_in_parallel(\@) {
  373. my @commands = @{(shift)};
  374. my @result = ();
  375. return @result if (!@commands or !scalar(@commands));
  376. my $count = scalar(@commands);
  377. my $start = 0;
  378. while ($start<=$count-1) {
  379. my @run_list=();
  380. my $select = IO::Select->new();
  381. my $stop = $start + $parallel_process_count;
  382. $stop=$count-1 if ($stop >=$count);
  383. for (my $index = $start; $index <=$stop; $index++) {
  384. next if (!$commands[$index]);
  385. my $cmd=$commands[$index];
  386. log_info("Starting ".$cmd);
  387. my ($hchild, $hparent, $childid);
  388. socketpair($hchild, $hparent, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!";
  389. $childid = fork;
  390. die "cannot fork" if($childid == -1);
  391. # redirect child Input|Output
  392. unless($childid) {
  393. open STDIN, "<&", $hparent;
  394. open STDOUT, ">&", $hparent;
  395. open STDERR, ">&", $hparent;
  396. close $hparent;
  397. close $hchild;
  398. $select->remove($_) and close $_ for($select->handles);
  399. exec "/bin/nice -n 15 ".$cmd;
  400. }
  401. close $hparent;
  402. $select->add($hchild);
  403. }
  404. while (my @ready = $select->can_read) {
  405. next if (!@ready or !scalar(@ready));
  406. for my $read(@ready) {
  407. if($read->eof || $read->error) {
  408. # child exit
  409. $select->remove($read);
  410. close $read;
  411. next;
  412. }
  413. if(defined(my $str = <$read>)) {
  414. log_info("Read:".$str);
  415. push(@result,$str);
  416. }
  417. }
  418. }
  419. $start = $stop+1;
  420. }
  421. return (@result);
  422. }
  423. #---------------------------------------------------------------------------------
  424. sub translit {
  425. my $textline=shift;
  426. return if (!$textline);
  427. $textline =~ s/А/A/g; $textline =~ s/а/a/g;
  428. $textline =~ s/Б/B/g; $textline =~ s/б/b/g;
  429. $textline =~ s/В/V/g; $textline =~ s/в/v/g;
  430. $textline =~ s/Г/G/g; $textline =~ s/г/g/g;
  431. $textline =~ s/Д/D/g; $textline =~ s/д/d/g;
  432. $textline =~ s/Е/E/g; $textline =~ s/е/e/g;
  433. $textline =~ s/Ё/E/g; $textline =~ s/ё/e/g;
  434. $textline =~ s/Ж/Zh/g; $textline =~ s/ж/zh/g;
  435. $textline =~ s/З/Z/g; $textline =~ s/з/z/g;
  436. $textline =~ s/И/I/g; $textline =~ s/и/i/g;
  437. $textline =~ s/Й/I/g; $textline =~ s/й/i/g;
  438. $textline =~ s/К/K/g; $textline =~ s/к/k/g;
  439. $textline =~ s/Л/L/g; $textline =~ s/л/l/g;
  440. $textline =~ s/М/M/g; $textline =~ s/м/m/g;
  441. $textline =~ s/Н/N/g; $textline =~ s/н/n/g;
  442. $textline =~ s/О/O/g; $textline =~ s/о/o/g;
  443. $textline =~ s/П/P/g; $textline =~ s/п/p/g;
  444. $textline =~ s/Р/R/g; $textline =~ s/р/r/g;
  445. $textline =~ s/ТС/T-S/g; $textline =~ s/Тс/T-s/g; $textline =~ s/тс/t-s/g;
  446. $textline =~ s/С/S/g; $textline =~ s/с/s/g;
  447. $textline =~ s/Т/T/g; $textline =~ s/т/t/g;
  448. $textline =~ s/У/U/g; $textline =~ s/у/u/g;
  449. $textline =~ s/Ф/F/g; $textline =~ s/ф/f/g;
  450. $textline =~ s/Х/Kh/g; $textline =~ s/х/kh/g;
  451. $textline =~ s/Ц/Ts/g; $textline =~ s/ц/ts/g;
  452. $textline =~ s/Ч/Ch/g; $textline =~ s/ч/ch/g;
  453. $textline =~ s/Ш/Sh/g; $textline =~ s/ш/sh/g;
  454. $textline =~ s/Щ/Shch/g; $textline =~ s/щ/shch/g;
  455. $textline =~ s/Ь/'/g; $textline =~ s/ь/'/g;
  456. $textline =~ s/Ы/Y/g; $textline =~ s/ы/y/g;
  457. $textline =~ s/Ъ/''/g; $textline =~ s/ъ/''/g;
  458. $textline =~ s/Э/E/g; $textline =~ s/э/e/g;
  459. $textline =~ s/Ю/Yu/g; $textline =~ s/ю/yu/g;
  460. $textline =~ s/Я/Ya/g; $textline =~ s/я/ya/g;
  461. return $textline;
  462. }
  463. #---------------------------------------------------------------------------------
  464. sub netdev_set_auth {
  465. my $device = shift;
  466. $device->{login}=$config_ref{router_login} if (!$device->{login});
  467. $device->{password}=$config_ref{router_password} if (!$device->{password});
  468. $device->{password}=decrypt_string($device->{password});
  469. $device->{enable_password}='';
  470. #$device->{enable_password}=$device->{passowrd};
  471. $device->{proto} = 'ssh' if ($device->{protocol} eq '0');
  472. $device->{proto} = 'telnet' if ($device->{protocol} eq '1');
  473. $device->{port} = $device->{control_port} if ($device->{control_port});
  474. return $device;
  475. }
  476. #---------------------------------------------------------------------------------
  477. sub decrypt_string {
  478. my $crypted_string = shift;
  479. return if (!$crypted_string);
  480. my $cipher_handle = Crypt::CBC->new(
  481. {
  482. 'key' => $config_ref{encryption_key},
  483. 'cipher' => 'Cipher::AES',
  484. 'iv' => $config_ref{encryption_iv},
  485. 'literal_key' => 1,
  486. 'header' => 'none',
  487. keysize => 128 / 8
  488. }
  489. );
  490. my $result = $cipher_handle->decrypt(decode_base64($crypted_string));
  491. return $result;
  492. }
  493. #---------------------------------------------------------------------------------
  494. sub crypt_string {
  495. my $simple_string = shift;
  496. return if (!$simple_string);
  497. my $cipher_handle = Crypt::CBC->new(
  498. {
  499. 'key' => $config_ref{encryption_key},
  500. 'cipher' => 'Cipher::AES',
  501. 'iv' => $config_ref{encryption_iv},
  502. 'literal_key' => 1,
  503. 'header' => 'none',
  504. keysize => 128 / 8
  505. }
  506. );
  507. my $result = encode_base64($cipher_handle->encrypt($simple_string));
  508. return $result;
  509. }
  510. #---------------------------------------------------------------------------------
  511. #log_file($LOG_COMMON,"INFO:","----------------------------------------------------------------------------------------");
  512. #log_file($LOG_COMMON,"INFO:","Run script $0. Pid: $$ Pid file: $SPID.pid");
  513. #log_file($LOG_COMMON,"INFO:","User uid: $< Effective uid: $>");
  514. #log_file($LOG_COMMON,"INFO:","Status:");
  515. #log_file($LOG_COMMON,"INFO:","Logging enabled: $log_enable");
  516. #log_file($LOG_COMMON,"INFO:","Logging debug: $debug");
  517. 1;
  518. }