\Horde_Imsp_Client_Socket

The Horde_Imsp_Client base class.

Copyright 2003-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
__construct()
quoteSpacedString()
logout()
capability()
send()
receive()
getServerResponseChunks()
receiveStringLiteral()
authenticate()
$host
$port
$lastRawError
$_logger
OCTET_COUNT
MUST_USE_LITERAL
MUST_QUOTE
_getNextCommandTag()
_imspOpen()
$_commandPrefix
$_commandCount
$_tag
$_lastCommandTag
$_authObj
$_stream
N/A
No private methods found
No private properties found
N/A

Constants

OCTET_COUNT

OCTET_COUNT

MUST_USE_LITERAL

MUST_USE_LITERAL

MUST_QUOTE

MUST_QUOTE

Properties

$host

$host : string

String containing name/IP address of IMSP host.

Type

string

$port

$port : string

String containing port for IMSP server.

Type

string

$lastRawError

$lastRawError : string

String buffer containing the last raw NO or BAD response from the server.

Type

string

$_logger

$_logger : \Horde_Log_Logger

Logger

Type

\Horde_Log_Logger

$_commandPrefix

$_commandPrefix : string

Current command prefix

Type

string

$_commandCount

$_commandCount : integer

Current command count

Type

integer

$_tag

$_tag : string

Currently in-use command tag

Type

string

$_lastCommandTag

$_lastCommandTag : string

Command tag last used.

Type

string

$_stream

$_stream : resource

Stream handle

Type

resource

Methods

__construct()

__construct(array  $params) 

Constructor function.

Required parameters:

 authObj    The object to handle the authentication

Optional parameters:

 server              The IMSP host
 port                The port the IMSP server listens on
 logger    The logger.

Parameters

array $params

Hash containing server parameters.

quoteSpacedString()

quoteSpacedString(string  $string) : string

Determines if a string needs to be quoted before sending to the server.

Parameters

string $string

String to be tested.

Returns

string —

Original string, quoted if needed.

logout()

logout() 

Logs out of the server and closes the IMSP stream

capability()

capability() : string

Returns the raw capability response from the server.

Throws

\Horde_Imsp_Exception

Returns

string —

The raw capability response.

send()

send(string  $commandText, boolean  $includeTag = true, boolean  $sendCRLF = true, boolean  $continuation = false) 

Attempts to send a command to the server.

Parameters

string $commandText

Text to send to the server.

boolean $includeTag

Determines if command tag is prepended.

boolean $sendCRLF

Determines if CRLF is appended.

boolean $continuation

Expect a command continuation response.

Throws

\Horde_Imsp_Exception

receive()

receive() : mixed

Receives a single CRLF terminated server response string

Throws

\Horde_Imsp_Exception

Returns

mixed —

'NO', 'BAD', 'OK', raw response.

getServerResponseChunks()

getServerResponseChunks() : array

Retrieves CRLF terminated response from server and splits it into an array delimited by a <space>.

Returns

array —

The exploded string

receiveStringLiteral()

receiveStringLiteral(integer  $length) : string

Receives fixed number of bytes from IMSP socket. Used when server returns a string literal.

Parameters

integer $length

Number of bytes to read from socket.

Returns

string —

Text of string literal.

authenticate()

authenticate(boolean  $login = true) : boolean

Attempts to login to IMSP server.

Parameters

boolean $login

Should we remain logged in after auth?

Returns

boolean

_getNextCommandTag()

_getNextCommandTag() : string

Increments the IMSP command tag token.

Returns

string —

Next command tag.

_imspOpen()

_imspOpen() 

Attempts to open an IMSP socket with the server.

Throws

\Horde_Imsp_Exception