1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/apfree-xfrp

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Клонировать/Скачать
proxy_tcp.c 1 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
KerwinKoo Отправлено 07.07.2017 05:31 a668a6d
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#include <syslog.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include <event2/listener.h>
#include <event2/event.h>
#include "debug.h"
#include "uthash.h"
#include "common.h"
#include "proxy.h"
// read from client-working host port
void tcp_proxy_c2s_cb(struct bufferevent *bev, void *ctx)
{
struct proxy *p = (struct proxy *)ctx;
struct bufferevent *partner = p?p->bev:NULL;
struct evbuffer *src, *dst;
size_t len;
src = bufferevent_get_input(bev);
len = evbuffer_get_length(src);
if (len > 0) {
dst = bufferevent_get_output(partner);
evbuffer_add_buffer(dst, src);
}
}
void tcp_proxy_s2c_cb(struct bufferevent *bev, void *ctx)
{
struct proxy *p = (struct proxy *)ctx;
struct bufferevent *partner = p?p->bev:NULL;
struct evbuffer *src, *dst;
src = bufferevent_get_input(bev);
dst = bufferevent_get_output(partner);
evbuffer_add_buffer(dst, src);
}

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/apfree-xfrp.git
git@api.gitlife.ru:oschina-mirror/apfree-xfrp.git
oschina-mirror
apfree-xfrp
apfree-xfrp
master