@@ -353,53 +353,114 @@ private function getServerAddress()
353
353
}
354
354
}
355
355
356
+ /**
357
+ * RFC Mode setter
358
+ *
359
+ * @param int $rfc The RFC mode. Can be NET_SYSLOG_RFC542X or NET_SYSLOG_RFC3164
360
+ *
361
+ * @access public
362
+ */
356
363
public function setRFC ($ rfc )
357
364
{
358
365
$ this ->_rfc = $ rfc ;
359
366
}
360
367
368
+ /**
369
+ * Sender hostname setter
370
+ *
371
+ * @param string $hostname No domain name, only a-z A-Z 0-9 and other authorized characters
372
+ *
373
+ * @access public
374
+ */
361
375
public function setHostname ($ hostname )
362
376
{
363
377
$ this ->_hostname = substr ($ hostname , 0 , 255 );
364
378
if (strlen ($ this ->_hostname ) == 0 ) $ this ->_hostname = NET_SYSLOG_NILVALUE ;
365
379
}
366
380
381
+ /**
382
+ * Remote server address setter
383
+ *
384
+ * @param string $server Can be an ip or a network name
385
+ *
386
+ * @access public
387
+ */
367
388
public function setServer ($ server )
368
389
{
369
390
$ this ->_server = $ server ;
370
391
}
371
392
393
+ /**
394
+ * Remote server port setter
395
+ *
396
+ * @param int $port TCP or UDP port on the remote syslog server
397
+ *
398
+ * @access public
399
+ */
372
400
public function setPort ($ port )
373
401
{
374
402
if ((intval ($ port ) > 0 ) && (intval ($ port ) < 65536 )) {
375
403
$ this ->_port = intval ($ port );
376
404
}
377
405
}
378
406
407
+ /**
408
+ * Protocol setter
409
+ *
410
+ * @param string $protocol Can be NET_SYSLOG_UDP, NET_SYSLOG_TCP, NET_SYSLOG_SSL or NET_SYSLOG_TLS
411
+ *
412
+ * @access public
413
+ */
379
414
public function setProtocol ($ protocol )
380
415
{
381
416
if (in_array ($ protocol , array (NET_SYSLOG_UDP , NET_SYSLOG_TCP , NET_SYSLOG_SSL , NET_SYSLOG_TLS ))) {
382
417
$ this ->_protocol = $ protocol ;
383
418
}
384
419
}
385
420
421
+ /**
422
+ * CA File setter
423
+ *
424
+ * @param string $cafile Filename for CA Certificate used in SSL connection, if necessary
425
+ *
426
+ * @access public
427
+ */
386
428
public function setCAFile ($ cafile )
387
429
{
388
430
$ this ->_cafile = $ cafile ;
389
431
}
390
432
433
+ /**
434
+ * ProcID setter
435
+ *
436
+ * @param string $procid ProcID as defined in RFC 5424
437
+ *
438
+ * @access public
439
+ */
391
440
public function setProcid ($ procid )
392
441
{
393
442
$ this ->_procid = substr ($ procid , 0 , 128 );
394
443
if (strlen ($ this ->_procid ) == 0 ) $ this ->_procid = NET_SYSLOG_NILVALUE ;
395
444
}
396
445
446
+ /**
447
+ * AppName setter
448
+ *
449
+ * @param string $appname AppName as defined in RFC 5424
450
+ *
451
+ * @access public
452
+ */
397
453
public function setAppname ($ appname )
398
454
{
399
455
$ this ->_appname = substr ($ appname , 0 , 48 );
400
456
if (strlen ($ this ->_appname ) == 0 ) $ this ->_appname = NET_SYSLOG_NILVALUE ;
401
457
}
402
458
459
+ /**
460
+ * Open the socket to connect to the remote syslog server
461
+ *
462
+ * @access private
463
+ */
403
464
private function openSocket ()
404
465
{
405
466
if ($ this ->_socket )
@@ -429,6 +490,11 @@ private function openSocket ()
429
490
}
430
491
}
431
492
493
+ /**
494
+ * Close the socket to the remote syslog server
495
+ *
496
+ * @access private
497
+ */
432
498
private function closeSocket ()
433
499
{
434
500
fclose ($ this ->_socket );
0 commit comments