Skip to content

Commit dfe49e8

Browse files
committed
Update the headerfile
1 parent 919de1f commit dfe49e8

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

Diff for: ios/MullvadRustRuntime/include/mullvad_rust_runtime.h

+38-20
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,53 @@
55
#include <stdint.h>
66
#include <stdlib.h>
77

8-
typedef struct HashSet_ProxyConfig HashSet_ProxyConfig;
9-
10-
typedef struct EphemeralPeerCancelToken {
11-
void *context;
12-
} EphemeralPeerCancelToken;
8+
typedef struct EncryptedDnsProxyState EncryptedDnsProxyState;
139

1410
typedef struct ProxyHandle {
1511
void *context;
1612
uint16_t port;
1713
} ProxyHandle;
1814

19-
typedef struct EncryptedDnsProxyState {
20-
struct HashSet_ProxyConfig configurations;
21-
bool has_tried_xor;
22-
struct HashSet_ProxyConfig tried_configurations;
23-
} EncryptedDnsProxyState;
15+
typedef struct EphemeralPeerCancelToken {
16+
void *context;
17+
} EphemeralPeerCancelToken;
2418

2519
extern const uint16_t CONFIG_SERVICE_PORT;
2620

21+
/**
22+
* Initializes a valid pointer to an instance of `EncryptedDnsProxyState`.
23+
*/
24+
struct EncryptedDnsProxyState *encrypted_dns_proxy_init(void);
25+
26+
/**
27+
* This must be called only once to deallocate `EncryptedDnsProxyState`.
28+
*
29+
* # Safety
30+
* `ptr` must be a valid, exclusive pointer to `EncryptedDnsProxyState`, initialized
31+
* by `encrypted_dns_proxy_init`. This function is not thread safe.
32+
*/
33+
void encrytped_dns_proxy_free(struct EncryptedDnsProxyState *ptr);
34+
35+
/**
36+
* # Safety
37+
* encrypted_dns_proxy must be a valid, exclusive pointer to `EncryptedDnsProxyState`, initialized
38+
* by `encrypted_dns_proxy_init`. This function is not thread safe.
39+
* `proxy_handle` must be pointing to a valid memory region for the size of a `ProxyHandle`
40+
*
41+
* `proxy_handle` will only contain valid values if the return value is zero. It is still valid to
42+
* deallocate the memory.
43+
*
44+
*/
45+
int32_t encrypted_dns_proxy_start(struct EncryptedDnsProxyState *encrypted_dns_proxy,
46+
struct ProxyHandle *proxy_handle);
47+
48+
/**
49+
* SAFETY:
50+
* `proxy_config` must be a valid pointer to a `ProxyHandle` as initialized by
51+
* [`encrypted_dns_proxy_start`].
52+
*/
53+
int32_t encrypted_dns_proxy_stop(struct ProxyHandle *proxy_config);
54+
2755
/**
2856
* Called by the Swift side to signal that the ephemeral peer exchange should be cancelled.
2957
* After this call, the cancel token is no longer valid.
@@ -142,16 +170,6 @@ int32_t start_shadowsocks_proxy(const uint8_t *forward_address,
142170
*/
143171
int32_t stop_shadowsocks_proxy(struct ProxyHandle *proxy_config);
144172

145-
void fetch_encrypted_dns_configs(void);
146-
147-
void free_encrypted_dns_configs(void);
148-
149-
int32_t init_proxy_configurations(struct EncryptedDnsProxyState *proxy_state);
150-
151-
int32_t start_encrypted_dns_proxy(DnsConfig *dns_config, struct ProxyHandle *proxy_config);
152-
153-
int32_t stop_encrypted_proxy(struct ProxyHandle *proxy_config);
154-
155173
int32_t start_tunnel_obfuscator_proxy(const uint8_t *peer_address,
156174
uintptr_t peer_address_len,
157175
uint16_t peer_port,

0 commit comments

Comments
 (0)