libzrtp  1.2.0
ZRTP VoIP security
zrtp_iface.h
Go to the documentation of this file.
1 /*
2  * libZRTP SDK library, implements the ZRTP secure VoIP protocol.
3  * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved.
4  * Contact: http://philzimmermann.com
5  * For licensing and other legal details, see the file zrtp_legal.c.
6  *
7  * Viktor Krykun <v.krikun at zfoneproject.com>
8  */
9 
10 
11 
17 #ifndef __ZRTP_IFACE_H__
18 #define __ZRTP_IFACE_H__
19 
20 #include "zrtp_config.h"
21 #include "zrtp_base.h"
22 #include "zrtp_string.h"
23 #include "zrtp_error.h"
24 #include "zrtp_iface_system.h"
25 
26 
27 #if defined(__cplusplus)
28 extern "C"
29 {
30 #endif
31 
32 /*======================================================================*/
33 /* libzrtp interface: Scheduler */
34 /*======================================================================*/
35 
49 typedef void (*zrtp_call_callback_t)(zrtp_stream_t*, zrtp_retry_task_t*);
50 
55 {
58 
61 
68  void* usr_data;
69 
70 
71  // TODO: hide these elements
80  uint8_t _is_enabled;
81 
90  uint32_t _retrys;
91 
102  uint8_t _is_busy;
103 };
104 
109 {
118  zrtp_status_t (*on_init)(zrtp_global_t* zrtp);
119 
126  void (*on_down)();
127 
139  void (*on_call_later)(zrtp_stream_t *stream, zrtp_retry_task_t* task);
140 
154  void (*on_cancel_call_later)(zrtp_stream_t* ctx, zrtp_retry_task_t* task);
155 
170  void (*on_wait_call_later)(zrtp_stream_t* stream);
172 
175 /*======================================================================*/
176 /* libzrtp interface: Protocol */
177 /*======================================================================*/
178 
194 {
197 
200 
203 
206 
209 
216 
230 
239 
247 
256 
265 
277 
286 
293 
302 
313 
314  ZRTP_EVENT_COUNT
315 
317 
324 {
331  ZRTP_EVENT_PROTOCOL_ERROR = ZRTP_EVENT_COUNT,
332 
345 
357 
370 
377 typedef struct zrtp_callback_event_t
378 {
388  void (*on_zrtp_protocol_event)(zrtp_stream_t *stream, zrtp_protocol_event_t event);
389 
400  void (*on_zrtp_security_event)(zrtp_stream_t *stream, zrtp_security_event_t event);
401 
413  void (*on_zrtp_secure)(zrtp_stream_t *stream);
414 
426  void (*on_zrtp_not_secure)(zrtp_stream_t *stream);
428 
431 /*======================================================================*/
432 /* libzrtp interface: Misc */
433 /*======================================================================*/
434 
444 typedef struct zrtp_callback_misc_t
445 {
459  int (*on_send_packet)(const zrtp_stream_t* stream, char* packet, unsigned int length);
461 
468 typedef struct zrtp_callback_t
469 {
477 
478 
479 #if defined(__cplusplus)
480 }
481 #endif
482 
483 #endif /*__ZRTP_IFACE_H__*/
Delay Call wrapper.
Definition: zrtp_iface.h:54
zrtp_status_t
libzrtp functions statuses.
Definition: zrtp_error.h:72
zrtp_protocol_event_t
ZRTP Protocol events.
Definition: zrtp_iface.h:193
zrtp_callback_scheduler_t sched_cb
ZRTP Delay Calls routine.
Definition: zrtp_iface.h:473
Switching to CLEAR state.
Definition: zrtp_iface.h:199
Switching to PENDING_CLEAR state.
Definition: zrtp_iface.h:208
void * usr_data
User data pointer.
Definition: zrtp_iface.h:68
Callbacks definitions.
Definition: zrtp_iface.h:377
struct zrtp_callback_misc_t zrtp_callback_misc_t
Miscellaneous Functions.
SAS value and/or rendering scheme was updated.
Definition: zrtp_iface.h:276
Indicates DRM restriction. Stream can't go Secure.
Definition: zrtp_iface.h:312
void(* zrtp_call_callback_t)(zrtp_stream_t *, zrtp_retry_task_t *)
ZRTP Delays Calls signature.
Definition: zrtp_iface.h:49
struct zrtp_callback_t zrtp_callback_t
ZRTP feedback interface and application dependent routine.
New user has already registered with the MiTM.
Definition: zrtp_iface.h:255
Switching to INITIATING_SECURE state.
Definition: zrtp_iface.h:202
struct zrtp_callback_event_t zrtp_callback_event_t
Callbacks definitions.
First N Hello packet undelivered - probably, no ZRTP endpoint and other end.
Definition: zrtp_iface.h:229
uint8_t _is_busy
Task Busy flag.
Definition: zrtp_iface.h:102
struct zrtp_callback_scheduler_t zrtp_callback_scheduler_t
Delay Calls callbacks.
zrtp_callback_event_t event_cb
ZRTP Protocol Feedback.
Definition: zrtp_iface.h:471
uint8_t _is_enabled
Task activity flag.
Definition: zrtp_iface.h:80
void(* on_zrtp_protocol_event)(zrtp_stream_t *stream, zrtp_protocol_event_t event)
ZRTP Protocol events notification.
Definition: zrtp_iface.h:388
zrtp_callback_misc_t misc_cb
Miscellaneous functions.
Definition: zrtp_iface.h:475
void(* on_call_later)(zrtp_stream_t *stream, zrtp_retry_task_t *task)
Interface for performing delay call.
Definition: zrtp_iface.h:139
Switching to PENDING_SECURE state.
Definition: zrtp_iface.h:205
Delay Calls callbacks.
Definition: zrtp_iface.h:108
New user has registered to the MitM.
Definition: zrtp_iface.h:246
SAS transfer was accepted by the remote side.
Definition: zrtp_iface.h:285
Swishing to SECURE state is finished.
Definition: zrtp_iface.h:301
Switching to NO_ZRTP state.
Definition: zrtp_iface.h:215
void(* on_zrtp_security_event)(zrtp_stream_t *stream, zrtp_security_event_t event)
ZRTP Security events notification.
Definition: zrtp_iface.h:400
zrtp_security_event_t
ZRTP Protocol Errors and Warnings.
Definition: zrtp_iface.h:323
int(* on_send_packet)(const zrtp_stream_t *stream, char *packet, unsigned int length)
RTP packet sending function.
Definition: zrtp_iface.h:459
libzrtp errors definitions
zrtp_status_t(* on_init)(zrtp_global_t *zrtp)
Delay Calls initialization.
Definition: zrtp_iface.h:118
Hello Hash is different from that received in signaling.
Definition: zrtp_iface.h:344
void(* on_down)()
Delay Calls deinitialization.
Definition: zrtp_iface.h:126
libzrtp platform-dependent routine
Retain secret was found in the cache but it doesn't match with the remote one.
Definition: zrtp_iface.h:368
void(* on_wait_call_later)(zrtp_stream_t *stream)
Interface for waiting for scheduling tasks is finished.
Definition: zrtp_iface.h:170
User has cancelled registration.
Definition: zrtp_iface.h:264
void(* on_cancel_call_later)(zrtp_stream_t *ctx, zrtp_retry_task_t *task)
Interface for canceling a delay calls.
Definition: zrtp_iface.h:154
void(* on_zrtp_not_secure)(zrtp_stream_t *stream)
Indicates switching to NOT SECURE state.
Definition: zrtp_iface.h:426
Switching to ERROR state.
Definition: zrtp_iface.h:331
Hmac of the received packet is different from the hmac value earlier received.
Definition: zrtp_iface.h:356
Swishing to SECURE state.
Definition: zrtp_iface.h:292
MiTM Enrollment with MiTM endpoint.
Definition: zrtp_iface.h:238
Miscellaneous Functions.
Definition: zrtp_iface.h:444
ZRTP feedback interface and application dependent routine.
Definition: zrtp_iface.h:468
Just a stub for error detection.
Definition: zrtp_iface.h:196
uint64_t zrtp_time_t
Time in miliseconds.
Definition: zrtp_iface_system.h:50
void(* on_zrtp_secure)(zrtp_stream_t *stream)
Indicates switching to SECURE state.
Definition: zrtp_iface.h:413
uint32_t _retrys
Number of task retries.
Definition: zrtp_iface.h:90
zrtp_call_callback_t callback
Task action callback.
Definition: zrtp_iface.h:57
zrtp_time_t timeout
Timeout before call in milliseconds.
Definition: zrtp_iface.h:60