Class: SONIC_stream

Source Location: /sonic.stream.inc

Class Overview [line 136]

SONIC_thread
   |
   --SONIC_stream

Author(s):

Version:

Copyright:

Variables

Constants

Methods


Inherited Methods

Class: SONIC_thread

SONIC_thread::sonic_thread_run()
fork entire program Memory and Execution space aka M.E.


Class Details

[ Top ]


Class Variables

$config =  NULL

[line 151]

stream config array of key value pairs

Tags:

  • see - sonic-daemon.php::sonic_daemon_main()

Type: array

Overrides:

[ Top ]

$idle =  true

[line 144]

marks if stream is currently busy or idle

Tags:

  • see - SONIC_stream::sonic_stream_main()

Type: boolean

Overrides:

[ Top ]

$name =  NULL

[line 179]

name of service using stream

has preg_replace('/[^az-_0-9]/', '_', NAME); applied for indexing reasons

Tags:

  • see - sonic-daemon.php::sonic_daemon_main()

Type: string

Overrides:

[ Top ]

$pcntl_loaded =  false

[line 188]

true if PHP environment has posix and control extensions loaded

Tags:

  • see - SONIC_stream constructor

Type: boolean

Overrides:

[ Top ]

$rotate_shutdown =  false

[line 199]

rotate mode exit (return to daemon)

internal flag switched upon shutdown when in rotate type mode should be automagically set my sonic_stream_main() aka the plugin. usually on pcntl signals SIGTERM, SIGQUIT and SIGINT

Tags:

  • see - SONIC_stream::sonic_stream_main()

Type: boolean

Overrides:

[ Top ]

$sock =  NULL

[line 169]

socket resource var

Tags:

  • see - sonic-daemon.php::sonic_daemon_main()

Type: integer

Overrides:

[ Top ]

$sock_peername =  NULL

[line 208]

peername

cache of socket var connected client peername

Tags:

  • see - SONIC_stream::sonic_socket_getpeername()

Type: string

Overrides:

[ Top ]

$stunnel_peername =  NULL

[line 217]

peername (via stunnel)

cache of stunnels connected client peername matching local client peername of sock var

Tags:

  • see - SONIC_stream::sonic_stunnel_getpeername()

Type: string

Overrides:

[ Top ]

$verbose =  0

[line 160]

verbosity level

manually overriden by daemon if not supplied by stream setup

Tags:

  • see - sonic-daemon.php::sonic_daemon_main()

Type: integer

Overrides:

[ Top ]


Class Methods

SONIC_stream

SONIC_stream SONIC_stream( [array $config = NULL])

[line 227]

stream constructor

loads internal variables with supplied configuration key paired array. usually non service specific, but stream environment related.

Parameters:

  • array $config - option flags, (string) name, (resource) socket, (integer) verbose, (string) thread_out, (boolean) thread_buffer_quiet, (string) thread_log

[ Top ]

sonic_stream_buffer

void sonic_stream_buffer( )

[line 364]

flush()

buffer-flush for output mode 'flush' or 'buffer' NB, will also log set to var thread_log and in output mode set as 'buffer'. ie. also used for threaded child log write (as log write is handled by the server daemon in rotate mode)

Tags:

Parameters:

[ Top ]

sonic_stream_idle

boolean sonic_stream_idle( )

[line 300]

idle check

checks if stream has marked itself as busy or not

NB, currently not in use by daemon/IPC

Tags:

  • return - boolean value of internal variable 'idle'

Parameters:

[ Top ]

sonic_stream_prelog

string sonic_stream_prelog( )

[line 401]

log output unifier

returns a uniform prefix for log/output entries

Tags:

  • return - string usually with pid/process id and timestamp

Parameters:

[ Top ]

sonic_stream_socket_accept

boolean sonic_stream_socket_accept( string &$stat_msg, [array $config = NULL], [resource $sock = NULL], [boolean $pcntl_loaded = NULL])

[line 492]

socket_accept()

polled (if pcntl supported and enabled) socket_accept() and sets internal variable 'peername' via get_peername (stunnel via config supported)

Tags:

  • return - boolean see socket_getpeername()

Parameters:

  • string &$stat_msg - return status information
  • array $config - third party support (library mode) override, array of type see stream constructor
  • resource $sock - third party support (library mode) override, see PHP sockets
  • boolean $pcntl_loaded - third party support (library mode) override

[ Top ]

sonic_stream_socket_getpeername

boolean sonic_stream_socket_getpeername( string &$peername, [array $config = NULL], [resource $sock = NULL])

[line 416]

socket_getpeername()

Tags:

  • return - boolean see socket_getpeername()

Parameters:

  • string &$peername - host:port format of client peername on socket
  • array $config - third party support (library mode) override, array of type see stream constructor
  • resource $sock - third party support (library mode) override, see PHP sockets

[ Top ]

sonic_stream_stunnel_getpeername

string sonic_stream_stunnel_getpeername( [array $filter = array('time' => 0, 'server' => '')], [array $config = NULL], [resource $sock = NULL])

[line 797]

stunnel_getpeername()

map local peername with stunnel index for real connected client peername

Tags:

  • return - peername on success of false on failure

Parameters:

  • array $filter - flag options, (integer) time, (string) server
  • array $config - third party support (library mode) override, array of type see stream constructor
  • resource $sock - third party support (library mode) override, see PHP sockets

[ Top ]

sonic_stream_stunnel_info

boolean sonic_stream_stunnel_info( $st_out, array &$server_client, [array $filter = array('time' => 0, 'server' => '')], string $stl_out, integer $tail_lines)

[line 711]

filter stunnel log information

parse given stunnel log output matching filter rules

Tags:

  • return - true on success and false on failure

Parameters:

  • string $stl_out - to stunnel log data
  • array &$server_client - array with returned information requested by filter
  • integer $tail_lines - total amount of _most recently entered_ log lines to parse
  • array $filter - option flags, (integer) time, (string) server
  • $st_out -

[ Top ]

sonic_stream_stunnel_info_log

boolean sonic_stream_stunnel_info_log( string $stl_file, array &$server_client, [integer $tail_lines = 5], [array $filter = array('time' => 0, 'server' => '')])

[line 651]

filter stunnel log information

parse X last lines from given stunnel log matching filter rules

NB, is really a sonic_stream_stunnel_info() wrapper

Tags:

  • return - true on success and false on failure

Parameters:

  • string $stl_file - full location to stunnel log file
  • array &$server_client - array with returned information requested by filter
  • integer $tail_lines - total amount of _most recently entered_ log lines to parse
  • array $filter - option flags, (integer) time, (string) server

[ Top ]

sonic_stream_thread_main

mixed sonic_stream_thread_main( )

[line 312]

threaded stream main (wrapper)

call this function instead of calling sonic_stream_main() directly to fork the process and set internal pid numbers.

Tags:

  • return - will exit with return value from sonic_stream_main()

Parameters:

[ Top ]

_sonic_stream_socket_accept_sighandler

void _sonic_stream_socket_accept_sighandler( [integer $sig = NULL])

[line 466]

_polling_ signal handler for socket_accept()

socket_accept by nature will hang process flow and ignore any other signals accept SIGALRM

using this will allow other signals to be processed without interruption

Parameters:

  • integer $sig - posix process signal

[ Top ]


Class Constants


Documentation generated on Fri, 12 Sep 2008 19:19:02 +1000 by phpDocumentor 1.4.1