ZRTP Connections
[API]

Collaboration diagram for ZRTP Connections:

Data Structures

struct  zrtp_stream_info_t
 zrtp stream information structure

libzrtp, since v0.80 takes data incapsulating approach and hides all private date inside zrtp_stream_t structure. Developers shouldn't access them directly. zrtp_stream_get() should be used instead to fill zrtp_stream_info_t structure. zrtp_stream_info_t contains all needed information in safe and easy to use form. More...

struct  zrtp_session_info_t
 zrtp session information structure

libzrtp, since v0.80 takes data incapsulating approach and hides all private date inside zrtp_session_t structure. Developers shouldn't access them directly. zrtp_session_get() should be used instead to fill zrtp_session_info_t structure. zrtp_session_info_t contains all needed information in safe and easy to use form. More...


Functions

zrtp_status_t zrtp_session_init (zrtp_global_t *zrtp, zrtp_profile_t *profile, zrtp_zid_t zid, uint8_t is_initiator, zrtp_session_t **session)
 ZRTP Session Initialization.
void zrtp_session_down (zrtp_session_t *session)
 ZRTP Session context deinitialization.
zrtp_status_t zrtp_session_get (zrtp_session_t *session, zrtp_session_info_t *info)
 Obtain information about ZRTP session.
void zrtp_session_set_userdata (zrtp_session_t *session, void *udata)
 Allow user to associate some data with current zrtp session.
void * zrtp_session_get_userdata (zrtp_session_t *session)
 Return user data associated with the zrtp session.
zrtp_status_t zrtp_stream_attach (zrtp_session_t *session, zrtp_stream_t **stream)
 Attaching a new stream to the session.
zrtp_status_t zrtp_stream_start (zrtp_stream_t *stream, uint32_t ssrc)
 Starting a ZRTP stream.
zrtp_status_t zrtp_stream_stop (zrtp_stream_t *stream)
 ZRTP protocol stopping.
zrtp_status_t zrtp_stream_clear (zrtp_stream_t *stream)
 Initiating an interruption of the secure connection.
zrtp_status_t zrtp_stream_secure (zrtp_stream_t *stream)
 Initiating a secure connection setup.
zrtp_status_t zrtp_stream_get (zrtp_stream_t *stream, zrtp_stream_info_t *info)
 Obtain information about zrtp stream.
void zrtp_stream_set_userdata (zrtp_stream_t *stream, void *udata)
 Allow user to associate some data with zrtp stream.
void * zrtp_stream_get_userdata (const zrtp_stream_t *stream)
 Return user data associated with the zrtp stream.

Function Documentation

void zrtp_session_down ( zrtp_session_t *  session  ) 

ZRTP Session context deinitialization.

This function releases all resources allocated for internal context operations by zrtp_init().

Warning:
Don't call zrtp_session_init() in parallel with other operations on this session.
Parameters:
session - session for deinitialization.
See also:
zrtp_session_init()

zrtp_status_t zrtp_session_get ( zrtp_session_t *  session,
zrtp_session_info_t info 
)

Obtain information about ZRTP session.

Function initialize and fills all fields of zrtp_session_info_t structure accordint to current state of ZRTP session.

Parameters:
session - zrtp session which parameters should be extracted;
info - out structure to be initialized.
Returns:
  • zrtp_status_ok in case of success.
  • zrtp_status_fail if an error occurs.

void* zrtp_session_get_userdata ( zrtp_session_t *  session  ) 

Return user data associated with the zrtp session.

Parameters:
session - zrtp session to extract user data.
Returns:
See also:
zrtp_session_set_userdata()

zrtp_status_t zrtp_session_init ( zrtp_global_t *  zrtp,
zrtp_profile_t profile,
zrtp_zid_t  zid,
uint8_t  is_initiator,
zrtp_session_t **  session 
)

ZRTP Session Initialization.

This function allocates and initializes the internal session context data. The given context is associated with the specified ZRTP identifier. Only after initialization does the session contain ZRTP_MAX_STREAMS_PER_SESSION streams ready to be used.

After successfully initialization, configuration will be done according to the relevant profile profile. Profile will be applyed to every stream allocated within this session. Before using the profile, call zrtp_profile_check() function to make sure that the profile you are applying is correct.

Warning:
Don't call zrtp_session_init() in parallel with other operations on this session.
Parameters:
zrtp - global libzrtp context;
profile - the session configuration profile. If value of this parameter is NULL, default profile will be used. NULL profile usage is equivalent to calling zrtp_profile_defaults().
zid - ZRTP peer identificator.
is_initiator - identifies if the endpoint was the signaling initiator of the call. Used to provide Passive Mode options to the developer. If your application doesn't control signaling or you don't want to support Passive Mode features - set this flag to 1. Check XXX for more information.
session - allocated session structure.
Returns:
  • zrtp_status_ok if initialization is successful;
  • zrtp_status_fail if an error occurs.
See also:
zrtp_session_down()

void zrtp_session_set_userdata ( zrtp_session_t *  session,
void *  udata 
)

Allow user to associate some data with current zrtp session.

Parameters:
session - zrtp session to attach data to.
udata - pointer to the user-data context.
See also:
zrtp_session_get_userdata()

zrtp_status_t zrtp_stream_attach ( zrtp_session_t *  session,
zrtp_stream_t **  stream 
)

Attaching a new stream to the session.

This function call initializes a ZRTP stream and prepares it for use within the specified session. The maximum number of streams for one session is defined by the ZRTP_MAX_STREAMS_PER_SESSION variable. All newly created streams are equivalent and have ZRTP_STREAM_MODE_CLEAR mode and ZRTP_ACTIVE state. Only after attaching a stream, ZRTP protocol can be initiated.

Parameters:
session - the ZRTP session within which a new stream is to be
stream - out parameter, attached stream will be stored there
Returns:
  • zrtp_status_ok if stream was attached successfully
  • one of zrtp_status_t errors in case of failure
See also:
zrtp_stream_start() zrtp_stream_stop()

zrtp_status_t zrtp_stream_clear ( zrtp_stream_t *  stream  ) 

Initiating an interruption of the secure connection.

This function initiates the shutting down of the ZRTP connection within a stream. In other words, after successfully switching to secure mode (XXX SECURE state, fig. 1.5), calling this function begins the exchange of packets switching back to insecure (CLEAR) mode.

This function can only be implemented from the SECURE state. Attempt to call this function from any other state will end in failure. The client application is informed about protocol progress through a system of callbacks.

Parameters:
stream - ZRTP stream .
Returns:
  • zrtp_status_ok - if shutting down the connection is started successfully.
  • zrtp_status_fail - if shutting down the connection is initiated from an incorrect state.
See also:

zrtp_status_t zrtp_stream_get ( zrtp_stream_t *  stream,
zrtp_stream_info_t info 
)

Obtain information about zrtp stream.

Function initialize and fills all fields of zrtp_stream_info_t structure accordint to current state of zrtp stream.

Parameters:
stream - zrtp stream which parameters should be extracted
info - out structure to be initialized
Returns:
  • zrtp_status_ok in case of success.
  • zrtp_status_fail if an error occurs.

void* zrtp_stream_get_userdata ( const zrtp_stream_t *  stream  ) 

Return user data associated with the zrtp stream.

Returns:
See also:
zrtp_stream_set_userdata()

zrtp_status_t zrtp_stream_secure ( zrtp_stream_t *  stream  ) 

Initiating a secure connection setup.

The function initiates a ZRTP connection setup within a stream. In other words, after the protocol has started and Discovery phase have been successfully accomplished, calling this function will begin the exchange of packets for switching to SECURE mode.

This function can be successfully performed only from the CLEAR state (XXX Figure 1.6). Attempting to call this function from any other state will result in failure. The client application is informed about protocol progress through a system of callbacks.

Parameters:
stream - ZRTP stream to be secured.
Returns:
  • zrtp_status_ok - if switching to secure mode started successfully.
  • zrtp_status_fail - if switching to secure mode is initiated from a state other than CLEAR.
See also:

void zrtp_stream_set_userdata ( zrtp_stream_t *  stream,
void *  udata 
)

Allow user to associate some data with zrtp stream.

Parameters:
stream - zrtp stream to attach data to.
udata - pointer to the user-data context.
See also:
zrtp_stream_get_userdata()

zrtp_status_t zrtp_stream_start ( zrtp_stream_t *  stream,
uint32_t  ssrc 
)

Starting a ZRTP stream.

ZRTP stream setup is initiated by calling this function. Exchange of command packets begins immediately according to protocol. If the option "autosecure" is on, calling this function is the only requirement for setting up the ZRTP connection within a stream. If "autosecure" mode is not available, calling this function activates only connection within a ZRTP stream. A connection can be established manually later by calling zrtp_stream_secure().

Setup of the stream/connection takes a certain interval of time. This function just initiates this process. The system of callbacks informs the user about the progress of libzrtp protocol.

Parameters:
stream - ZRTP stream to be started.
ssrc - ssrc which will be used in ZRTP protocol messages. It should match with ssrc of appropriate RTP stream which will be encrypted by this ZRTP stream.
Returns:
  • zrtp_status_ok in case of success;
  • one of zrtp_status_t errors in case of failure
See also:

zrtp_status_t zrtp_stream_stop ( zrtp_stream_t *  stream  ) 

ZRTP protocol stopping.

This function stops all protocol operations for the specified stream, releases resources allocated on the zrtp_stream_start() and prepares the stream structure for the next use.

This function will stop the protocol at any stage: all delayed tasks are canceled, and the protocol packet exchange and encryption is stopped. After this function call it is necessary to stop processing traffic using the zrtp_process_xxx() function.

Parameters:
stream - the stream being shutdown.
Returns:
  • zrtp_status_ok in case of success;
  • one of zrtp_status_t errors in case of failure
See also:


Generated on Wed Dec 9 17:31:06 2009 for libzrtp  zfone