mirror of
https://github.com/yarrick/iodine.git
synced 2024-11-25 22:46:05 +03:00
move unpack_data to encoding.c
This commit is contained in:
parent
dbfecb5be6
commit
f099a77743
@ -17,6 +17,15 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "encoding.h"
|
#include "encoding.h"
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
unpack_data(char *buf, size_t buflen, char *data, size_t datalen, struct encoder *enc)
|
||||||
|
{
|
||||||
|
if (!enc->eats_dots())
|
||||||
|
datalen = inline_undotify(data, datalen);
|
||||||
|
return enc->decode(buf, &buflen, data, datalen);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
inline_dotify(char *buf, size_t buflen)
|
inline_dotify(char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,6 @@
|
|||||||
#ifndef _ENCODING_H_
|
#ifndef _ENCODING_H_
|
||||||
#define _ENCODING_H_
|
#define _ENCODING_H_
|
||||||
|
|
||||||
int inline_dotify(char *, size_t);
|
|
||||||
int inline_undotify(char *, size_t);
|
|
||||||
|
|
||||||
struct encoder {
|
struct encoder {
|
||||||
char name[8];
|
char name[8];
|
||||||
int (*encode) (char *, size_t *, const void *, size_t);
|
int (*encode) (char *, size_t *, const void *, size_t);
|
||||||
@ -28,5 +25,9 @@ struct encoder {
|
|||||||
int (*eats_dots) (void);
|
int (*eats_dots) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _ENCODING_H_ */
|
int unpack_data(char *, size_t, char *, size_t, struct encoder *);
|
||||||
|
int inline_dotify(char *, size_t);
|
||||||
|
int inline_undotify(char *, size_t);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _ENCODING_H_ */
|
||||||
|
@ -126,14 +126,6 @@ send_version_response(int fd, version_ack_t ack, uint32_t payload, struct user *
|
|||||||
write_dns(fd, &u->q, out, sizeof(out));
|
write_dns(fd, &u->q, out, sizeof(out));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
unpack_data(char *buf, size_t buflen, char *data, size_t datalen, struct encoder *enc)
|
|
||||||
{
|
|
||||||
if (!enc->eats_dots())
|
|
||||||
datalen = inline_undotify(data, datalen);
|
|
||||||
return enc->decode(buf, &buflen, data, datalen);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
tunnel_dns(int tun_fd, int dns_fd)
|
tunnel_dns(int tun_fd, int dns_fd)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user