sThread
[ class tree: sThread ] [ index: sThread ] [ all elements ]

Class: sThread

Source Location: /sThread/sThread.php

Class Overview


sThread 패키지의 메인 Class


Author(s):

Copyright:

  • (c) 2018, OOPS.ORG

Variables

Constants

Methods



Class Details

[line 67]
sThread 패키지의 메인 Class

sThread package는 async 방식의 L7 layer 모니터링 에이전트 이다.

sThread package는 libevent를 이용하여 Multi session과 동시에 여러가지 protocol을 처리할 수 있도록 설계가 있다.

모듈 구조를 지원하므로, 필요한 모듈을 직접 만들어 추가할 수 있다.




Tags:

author:  JoungKyun.Kim <http://oops.org>
copyright:  (c) 2018, OOPS.ORG
link:  http://pear.oops.org/package/sThread
license:  BSD


[ Top ]


Class Variables

static $async =

[line 105]

libevent 동작을 sync로 할지 async로 할지 여부.

기본값 'false'




Tags:

access:  public

Type:   boolean


[ Top ]

static $logfile =

[line 110]

저장할 로그 파일 이름



Tags:

access:  public

Type:   string


[ Top ]

static $logformat =

[line 116]

저장할 로그 파일이름 postfix.

data function의 format으로 지정해야 한다.




Tags:

access:  public

Type:   string


[ Top ]

static $logtype =

[line 127]

로그 저장 여부

  • 0 -> 실패한 로그만 저장
  • 1 -> 모든 로그 저장
  • -1 -> 로그 저장 안함




Tags:

access:  public

Type:   int


[ Top ]

static $mod =

[line 99]

sThread_Module 패키지에서 등록한 모듈 object



Tags:

access:  public

Type:   object


[ Top ]

static $result =  false

[line 132]

실행 결과 데이터 보존 여부



Tags:

access:  public

Type:   boolean


[ Top ]



Class Methods


constructor __construct [line 159]

sThread __construct( )

OOP 스타일의 sThread Class 초기화



Tags:

access:  public


[ Top ]

method exceptionCallback [line 390]

void exceptionCallback( resource $buf, int $err)

libevent에서 exception callback

이 함수는 아무런 작동을 하지 않는다.




Parameters:

resource   $buf   libevent resource
int   $err   error code EVBUFFER_READ (1) EVBUFFER_WRITE (2) EVBUFFER_EOF (16) EVBUFFER_ERROR (32) EVBUFFER_TIMEOUT (64)

[ Top ]

method execute [line 231]

void execute( mixed $hosts, [int $tmout = 1], [string $protocol = null])

sThread를 실행한다.

실행 후 결과값은 Vari::$res 와 Vari::$sess 의 값을 확인하면 된다.




Tags:

access:  public


Parameters:

mixed   $hosts  

연결 정보.
host의 형식은 기본적으로 문자열 또는 배열을 사용할 수 있다.

주소 형식은 기본적으로 도메인이름 또는 IP주소와 PORT 번호로 구성이 된다.

  1.          $host 'test.domaint.com:80';

sThread package의 장점은 여러개의 실행을 동시에 할 수 있다는 것이므로, 여러개의 주소를 한번에 넘길 경우에는 배열을 이용한다.

  1.          $host array (
  2.              'test.domain.com:80',
  3.              'test1.domain.com:53',
  4.              'test16.domain.com:80'
  5.          );

int   $tmout   소켓 연결/읽기/쓰기 타임아웃
string   $protocol   tcp 또는 udp. 기본값 tcp.

[ Top ]

method init [line 182]

void init( [bool $mod_no_init = false])

sThread Class를 초기화 한다.



Tags:

access:  public


Parameters:

bool   $mod_no_init   (optional) true로 설정을 하면 sThread_Module class를 호출 하지 않는다. 기본값 false.

[ Top ]

method readCallback [line 454]

boolean readCallback( resource $buf, array $arg)

libevent read callback

이 메소드는 외부에서 사용할 필요가 없다. private로 지정이 되어야 하나, event_buffer_new api가 class method를 callback 함수로 사용을 하지 못하게 되어 있어, 외부 wrapper 를 통하여 호출을 하기 때문에 public으로 선언이 되었다.




Tags:

access:  public


Parameters:

resource   $buf   libevent resource
array   $arg   callback argument

[ Top ]

method writeCallback [line 564]

boolean writeCallback( resource $buf, array $arg)

libevent write callback

이 메소드는 외부에서 사용할 필요가 없다. private로 지정이 되어야 하나, event_buffer_new api가 class method를 callback 함수로 사용을 하지 못하게 되어 있어, 외부 wrapper 를 통하여 호출을 하기 때문에 public으로 선언이 되었다.




Tags:

access:  public


Parameters:

resource   $buf   libevent resource
array   $arg   callback argument

[ Top ]


Class Constants

MAJOR_VERSION =  1

[line 76]

sThread Major version 번호



Tags:

access:  public

[ Top ]

MINOR_VERSION =  0

[line 80]

sThread Minor version 번호



Tags:

access:  public

[ Top ]

PATCH_VERSION =  1

[line 84]

sThread Patch 레벨 번호



Tags:

access:  public

[ Top ]

VERSION =  '1.0.1'

[line 88]

sThread 버전



Tags:

access:  public

[ Top ]



Documentation generated on Tue, 14 May 2019 02:00:45 +0900 by phpDocumentor 1.4.4