2019-02-08 16:37:02 +00:00
|
|
|
#pragma once
|
|
|
|
#include "tor_os.h"
|
|
|
|
#include "net_tools.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We want to use fscanf and fprintf as these func provide a nice abstraction
|
|
|
|
* to parse text content. However, we must convert our file descriptor to a
|
|
|
|
* STREAM*. It appears that we have to create 2 streams (cf link). Moreover
|
|
|
|
* we have to disable the buffering with setbuf.
|
|
|
|
* https://ycpcs.github.io/cs365-spring2019/lectures/lecture15.html
|
|
|
|
*/
|
|
|
|
struct tor_ctl {
|
|
|
|
FILE* rsock;
|
|
|
|
FILE* wsock;
|
|
|
|
};
|
|
|
|
|
|
|
|
int tor_ctl_connect(struct tor_ctl* ctx, char* addr, char* service);
|
2019-02-11 15:23:20 +00:00
|
|
|
int tor_ctl_add_onion(struct tor_ctl* ctx, struct tor_os_str* tos, uint16_t* port);
|
2019-02-08 16:37:02 +00:00
|
|
|
void tor_ctl_close(struct tor_ctl* ctx);
|