00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00017 #ifndef __ZRTP_IFACE_H__
00018 #define __ZRTP_IFACE_H__
00019
00020 #include "zrtp_config.h"
00021 #include "zrtp_base.h"
00022 #include "zrtp_string.h"
00023 #include "zrtp_error.h"
00024 #include "zrtp_iface_system.h"
00025
00026
00027 #if defined(__cplusplus)
00028 extern "C"
00029 {
00030 #endif
00031
00032
00033
00034
00035
00060 typedef struct zrtp_callback_cache_t
00061 {
00070 zrtp_status_t (*on_init)(zrtp_global_t* zrtp);
00071
00078 void (*on_down)();
00079
00099 zrtp_status_t (*on_put)( const zrtp_stringn_t* one_zid,
00100 const zrtp_stringn_t* another_zid,
00101 zrtp_shared_secret_t *rss);
00102
00122 zrtp_status_t (*on_get)( const zrtp_stringn_t* one_zid,
00123 const zrtp_stringn_t* another_zid,
00124 zrtp_shared_secret_t *rss,
00125 int prev_requested);
00126
00143 zrtp_status_t (*on_set_verified)( const zrtp_stringn_t* one_zid,
00144 const zrtp_stringn_t* another_zid,
00145 uint32_t verified);
00146
00160 zrtp_status_t (*on_get_verified)( const zrtp_stringn_t* one_zid,
00161 const zrtp_stringn_t* another_zid,
00162 uint32_t* verified);
00163
00175 zrtp_status_t (*on_reset_since)( const zrtp_stringn_t* one_zid,
00176 const zrtp_stringn_t* another_zid);
00177
00185 zrtp_status_t (*on_put_mitm)( const zrtp_stringn_t* one_zid,
00186 const zrtp_stringn_t* another_zid,
00187 zrtp_shared_secret_t *rss);
00188
00196 zrtp_status_t (*on_get_mitm)( const zrtp_stringn_t* one_zid,
00197 const zrtp_stringn_t* another_zid,
00198 zrtp_shared_secret_t *rss);
00199
00213 zrtp_status_t (*on_presh_counter_get)( const zrtp_stringn_t* one_zid,
00214 const zrtp_stringn_t* another_zid,
00215 uint32_t* counter);
00216
00231 zrtp_status_t (*on_presh_counter_set)( const zrtp_stringn_t* one_zid,
00232 const zrtp_stringn_t* another_zid,
00233 uint32_t counter);
00234 } zrtp_callback_cache_t;
00235
00236
00239
00240
00241
00242
00256 typedef void (*zrtp_call_callback_t)(zrtp_stream_t*, zrtp_retry_task_t*);
00257
00261 struct zrtp_retry_task_t
00262 {
00264 zrtp_call_callback_t callback;
00265
00267 zrtp_time_t timeout;
00268
00275 void* usr_data;
00276
00277
00278
00287 uint8_t _is_enabled;
00288
00297 uint32_t _retrys;
00298
00309 uint8_t _is_busy;
00310 };
00311
00315 typedef struct zrtp_callback_scheduler_t
00316 {
00325 zrtp_status_t (*on_init)(zrtp_global_t* zrtp);
00326
00333 void (*on_down)();
00334
00346 void (*on_call_later)(zrtp_stream_t *stream, zrtp_retry_task_t* task);
00347
00361 void (*on_cancel_call_later)(zrtp_stream_t* ctx, zrtp_retry_task_t* task);
00362
00377 void (*on_wait_call_later)(zrtp_stream_t* stream);
00378 } zrtp_callback_scheduler_t;
00379
00382
00383
00384
00385
00400 typedef enum zrtp_protocol_event_t
00401 {
00403 ZRTP_EVENT_UNSUPPORTED = 0,
00404
00406 ZRTP_EVENT_IS_CLEAR,
00407
00409 ZRTP_EVENT_IS_INITIATINGSECURE,
00410
00412 ZRTP_EVENT_IS_PENDINGSECURE,
00413
00415 ZRTP_EVENT_IS_PENDINGCLEAR,
00416
00422 ZRTP_EVENT_NO_ZRTP,
00423
00436 ZRTP_EVENT_NO_ZRTP_QUICK,
00437
00445 ZRTP_EVENT_IS_CLIENT_ENROLLMENT,
00446
00453 ZRTP_EVENT_NEW_USER_ENROLLED,
00454
00462 ZRTP_EVENT_USER_ALREADY_ENROLLED,
00463
00471 ZRTP_EVENT_USER_UNENROLLED,
00472
00483 ZRTP_EVENT_LOCAL_SAS_UPDATED,
00484
00492 ZRTP_EVENT_REMOTE_SAS_UPDATED,
00493
00499 ZRTP_EVENT_IS_SECURE,
00500
00508 ZRTP_EVENT_IS_SECURE_DONE,
00509
00519 ZRTP_EVENT_IS_PASSIVE_RESTRICTION,
00520
00521 ZRTP_EVENT_COUNT
00522
00523 } zrtp_protocol_event_t;
00524
00530 typedef enum zrtp_security_event_t
00531 {
00538 ZRTP_EVENT_PROTOCOL_ERROR = ZRTP_EVENT_COUNT,
00539
00551 ZRTP_EVENT_WRONG_SIGNALING_HASH,
00552
00563 ZRTP_EVENT_WRONG_MESSAGE_HMAC,
00564
00575 ZRTP_EVENT_MITM_WARNING
00576 } zrtp_security_event_t;
00577
00584 typedef struct zrtp_callback_event_t
00585 {
00595 void (*on_zrtp_protocol_event)(zrtp_stream_t *stream, zrtp_protocol_event_t event);
00596
00607 void (*on_zrtp_security_event)(zrtp_stream_t *stream, zrtp_security_event_t event);
00608
00620 void (*on_zrtp_secure)(zrtp_stream_t *stream);
00621
00633 void (*on_zrtp_not_secure)(zrtp_stream_t *stream);
00634 } zrtp_callback_event_t;
00635
00638
00639
00640
00641
00651 typedef struct zrtp_callback_misc_t
00652 {
00666 int (*on_send_packet)(const zrtp_stream_t* stream, char* packet, unsigned int length);
00667 } zrtp_callback_misc_t;
00668
00675 typedef struct zrtp_callback_t
00676 {
00678 zrtp_callback_event_t event_cb;
00680 zrtp_callback_scheduler_t sched_cb;
00682 zrtp_callback_cache_t cache_cb;
00684 zrtp_callback_misc_t misc_cb;
00685 } zrtp_callback_t;
00686
00687
00688 #if defined(__cplusplus)
00689 }
00690 #endif
00691
00692 #endif