File: auto_test_support.h

package info (click to toggle)
libtoxcore 0.2.22-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,992 kB
  • sloc: ansic: 70,235; cpp: 14,770; sh: 1,576; python: 649; makefile: 255; perl: 39
file content (60 lines) | stat: -rw-r--r-- 1,563 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef RUN_AUTO_TEST_H
#define RUN_AUTO_TEST_H

#include <stdlib.h>  // calloc, free

#include "check_compat.h"
#include "../testing/misc_tools.h"
#include "../toxcore/Messenger.h"
#include "../toxcore/mono_time.h"
#include "../toxcore/tox_dispatch.h"
#include "../toxcore/net_crypto.h"

typedef struct AutoTox {
    Tox *tox;
    Tox_Dispatch *dispatch;

    uint32_t index;
    uint64_t clock;

    size_t save_size;
    uint8_t *save_state;
    bool alive;
    bool events;

    void *state;
} AutoTox;






typedef enum Graph_Type {
    GRAPH_COMPLETE = 0,
    GRAPH_LINEAR,
} Graph_Type;

typedef struct Run_Auto_Options {
    Graph_Type graph;
    void (*init_autotox)(AutoTox *autotox, uint32_t n);
    uint16_t tcp_port;
    bool events;
} Run_Auto_Options;

void bootstrap_tox_live_network(Tox *tox, bool enable_tcp);

// Use this function when setting the log callback on a Tox* object
void print_debug_log(Tox *m, Tox_Log_Level level, const char *file, uint32_t line, const char *func,
                     const char *message, void *user_data);

// Use this function when setting the log callback on a Logger object
void print_debug_logger(void *context, Logger_Level level, const char *file, uint32_t line,
                        const char *func, const char *message, void *userdata);

Tox *tox_new_log(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data);
Tox *tox_new_log_lan(struct Tox_Options *options, Tox_Err_New *err, void *log_user_data, bool lan_discovery);

extern const Net_Crypto_DHT_Funcs auto_test_dht_funcs;

#endif