Current section

Files

Jump to
ex_libsrtp c_src ex_libsrtp _generated nif srtp.h
Raw

c_src/ex_libsrtp/_generated/nif/srtp.h

#pragma once
#include "../../srtp.h"
#include <erl_nif.h>
#include <stdint.h>
#include <stdio.h>
#include <unifex/payload.h>
#include <unifex/unifex.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Functions that manage lib and state lifecycle
* Functions with 'unifex_' prefix are generated automatically,
* the user have to implement rest of them.
*/
typedef State UnifexState;
/**
* Allocates the state struct. Have to be paired with 'unifex_release_state'
* call
*/
UnifexState *unifex_alloc_state(UnifexEnv *env);
/**
* Removes a reference to the state object.
* The state is destructed when the last reference is removed.
* Each call to 'unifex_release_state' must correspond to a previous
* call to 'unifex_alloc_state' or 'unifex_keep_state'.
*/
void unifex_release_state(UnifexEnv *env, UnifexState *state);
/**
* Increases reference count of state object.
* Each call has to be balanced by 'unifex_release_state' call
*/
void unifex_keep_state(UnifexEnv *env, UnifexState *state);
/**
* Callback called when the state struct is destroyed. It should
* be responsible for releasing any resources kept inside state.
*/
void handle_destroy_state(UnifexEnv *env, UnifexState *state);
/*
* Declaration of native functions for module Elixir.ExLibSRTP.Native.
* The implementation have to be provided by the user.
*/
UNIFEX_TERM create(UnifexEnv *env);
UNIFEX_TERM add_stream(UnifexEnv *env, UnifexState *state, int ssrc_type,
unsigned int ssrc, UnifexPayload **keys,
unsigned int keys_length, UnifexPayload **keys_mkis,
unsigned int keys_mkis_length, char *rtp_crypto_profile,
char *rtcp_crypto_profile, unsigned int window_size,
int allow_repeat_tx);
UNIFEX_TERM remove_stream(UnifexEnv *env, UnifexState *state,
unsigned int ssrc);
UNIFEX_TERM update(UnifexEnv *env, UnifexState *state, int ssrc_type,
unsigned int ssrc, UnifexPayload **keys,
unsigned int keys_length, UnifexPayload **keys_mkis,
unsigned int keys_mkis_length, char *rtp_crypto_profile,
char *rtcp_crypto_profile, unsigned int window_size,
int allow_repeat_tx);
UNIFEX_TERM protect(UnifexEnv *env, UnifexState *state, char *what,
UnifexPayload *payload, int use_mki,
unsigned int mki_index);
UNIFEX_TERM unprotect(UnifexEnv *env, UnifexState *state, char *what,
UnifexPayload *payload, int use_mki);
/*
* Callbacks for nif lifecycle hooks.
* Have to be implemented by user.
*/
int on_load(UnifexEnv *env, void **priv_data);
void on_unload(UnifexEnv *env, void *priv_data);
/*
* Functions that create the defined output from Nif.
* They are automatically generated and don't need to be implemented.
*/
UNIFEX_TERM create_result(UnifexEnv *env, UnifexState *state);
UNIFEX_TERM add_stream_result_ok(UnifexEnv *env);
UNIFEX_TERM remove_stream_result_ok(UnifexEnv *env);
UNIFEX_TERM update_result_ok(UnifexEnv *env);
UNIFEX_TERM protect_result_ok(UnifexEnv *env, UnifexPayload *payload);
UNIFEX_TERM unprotect_result_ok(UnifexEnv *env, UnifexPayload *payload);
UNIFEX_TERM unprotect_result_error_auth_fail(UnifexEnv *env);
UNIFEX_TERM unprotect_result_error_replay_fail(UnifexEnv *env);
UNIFEX_TERM unprotect_result_error_bad_mki(UnifexEnv *env);
/*
* Functions that send the defined messages from Nif.
* They are automatically generated and don't need to be implemented.
*/
#ifdef __cplusplus
}
#endif