Debian Codegraph @

crypto-vala/vapi/libsrtp2.vapi

raw
1 [CCode (cheader_filename = "srtp2/srtp.h")]
2 namespace Srtp {
3 public const uint MAX_TRAILER_LEN;
4
5 public static ErrorStatus init();
6 public static ErrorStatus shutdown();
7
8 [Compact]
9 [CCode (cname = "srtp_ctx_t", cprefix = "srtp_", free_function = "srtp_dealloc")]
10 public class Context {
11 public static ErrorStatus create(out Context session, Policy? policy);
12
13 public ErrorStatus protect([CCode (type = "void*", array_length = false)] uint8[] rtp, ref int len);
14 public ErrorStatus unprotect([CCode (type = "void*", array_length = false)] uint8[] rtp, ref int len);
15
16 public ErrorStatus protect_rtcp([CCode (type = "void*", array_length = false)] uint8[] rtcp, ref int len);
17 public ErrorStatus unprotect_rtcp([CCode (type = "void*", array_length = false)] uint8[] rtcp, ref int len);
18
19 public ErrorStatus add_stream(ref Policy policy);
20 public ErrorStatus update_stream(ref Policy policy);
21 public ErrorStatus remove_stream(uint ssrc);
22 public ErrorStatus update(ref Policy policy);
23 }
24
25 [CCode (cname = "srtp_ssrc_t")]
26 public struct Ssrc {
27 public SsrcType type;
28 public uint value;
29 }
30
31 [CCode (cname = "srtp_ssrc_type_t", cprefix = "ssrc_")]
32 public enum SsrcType {
33 undefined, specific, any_inbound, any_outbound
34 }
35
36 [CCode (cname = "srtp_policy_t", destroy_function = "")]
37 public struct Policy {
38 public Ssrc ssrc;
39 public CryptoPolicy rtp;
40 public CryptoPolicy rtcp;
41 [CCode (array_length = false)]
42 public uint8[] key;
43 public ulong num_master_keys;
44 public ulong window_size;
45 [CCode (ctype = "int")]
46 public bool allow_repeat_tx;
47 [CCode (array_length_cname = "enc_xtn_hdr_count")]
48 public int[] enc_xtn_hdr;
49 public Policy* next;
50 }
51
52 [CCode (cname = "srtp_crypto_policy_t")]
53 public struct CryptoPolicy {
54 public CipherType cipher_type;
55 public int cipher_key_len;
56 public AuthType auth_type;
57 public int auth_key_len;
58 public int auth_tag_len;
59 public SecurityServices sec_serv;
60
61 public void set_aes_cm_128_hmac_sha1_80();
62 public void set_aes_cm_128_hmac_sha1_32();
63 public void set_aes_cm_128_null_auth();
64 public void set_aes_cm_192_hmac_sha1_32();
65 public void set_aes_cm_192_hmac_sha1_80();
66 public void set_aes_cm_192_null_auth();
67 public void set_aes_cm_256_hmac_sha1_32();
68 public void set_aes_cm_256_hmac_sha1_80();
69 public void set_aes_cm_256_null_auth();
70 public void set_aes_gcm_128_16_auth();
71 public void set_aes_gcm_128_8_auth();
72 public void set_aes_gcm_128_8_only_auth();
73 public void set_aes_gcm_256_16_auth();
74 public void set_aes_gcm_256_8_auth();
75 public void set_aes_gcm_256_8_only_auth();
76 public void set_null_cipher_hmac_null();
77 public void set_null_cipher_hmac_sha1_80();
78
79 public void set_rtp_default();
80 public void set_rtcp_default();
81
82 public void set_from_profile_for_rtp(Profile profile);
83 public void set_from_profile_for_rtcp(Profile profile);
84 }
85
86 [CCode (cname = "srtp_profile_t", cprefix = "srtp_profile_")]
87 public enum Profile {
88 reserved, aes128_cm_sha1_80, aes128_cm_sha1_32, null_sha1_80, null_sha1_32, aead_aes_128_gcm, aead_aes_256_gcm
89 }
90
91 [CCode (cname = "srtp_cipher_type_id_t")]
92 public struct CipherType : uint32 {}
93
94 [CCode (cname = "srtp_auth_type_id_t")]
95 public struct AuthType : uint32 {}
96
97 [CCode (cname = "srtp_sec_serv_t", cprefix = "sec_serv_")]
98 public enum SecurityServices {
99 none, conf, auth, conf_and_auth;
100 }
101
102 [CCode (cname = "srtp_err_status_t", cprefix = "srtp_err_status_", has_type_id = false)]
103 public enum ErrorStatus {
104 ok,
105 fail,
106 bad_param,
107 alloc_fail,
108 dealloc_fail,
109 init_fail,
110 terminus,
111 auth_fail,
112 cipher_fail,
113 replay_fail,
114 replay_old,
115
116 algo_fail,
117 no_such_op,
118 no_ctx,
119 cant_check,
120 key_expired,
121 socket_err,
122 signal_err,
123 nonce_bad,
124 read_fail,
125 write_fail,
126
127 parse_err,
128 encode_err,
129 semaphore_err,
130 pfkey_err,
131 bad_mki,
132 pkt_idx_old,
133 pkt_idx_adv
134 }
135
136 [CCode (cname = "srtp_log_level_t", cprefix = "srtp_log_level_", has_type_id = false)]
137 public enum LogLevel {
138 error, warning, info, debug
139 }
140
141 [CCode (cname = "srtp_log_handler_func_t")]
142 public delegate void LogHandler(LogLevel level, string msg);
143
144 public static ErrorStatus install_log_handler(LogHandler func);
145
146 }