Files
umka/vnet.h
T

38 lines
735 B
C
Raw Normal View History

2022-06-27 21:36:56 +04:00
/*
SPDX-License-Identifier: GPL-2.0-or-later
UMKa - User-Mode KolibriOS developer tools
vnet - virtual network card
Copyright (C) 2020-2023 Ivan Baravy <dunkaist@gmail.com>
2022-06-27 21:36:56 +04:00
*/
2020-05-07 00:33:32 +03:00
#ifndef VNET_H_INCLUDED
#define VNET_H_INCLUDED
2023-02-06 16:01:37 +00:00
#include <stdatomic.h>
#include "umka.h"
2020-05-07 00:33:32 +03:00
#define VNET_BUFIN_CAP (NET_BUFFER_SIZE - offsetof(net_buff_t, data))
enum vnet_type {
2023-02-06 16:01:37 +00:00
VNET_DEVTYPE_NULL,
VNET_DEVTYPE_FILE,
VNET_DEVTYPE_TAP,
};
struct vnet {
2023-02-02 00:37:11 +00:00
struct eth_device eth;
uint8_t bufin[VNET_BUFIN_CAP];
size_t bufin_len;
int fdin;
int fdout;
int input_processed;
2023-02-06 16:01:37 +00:00
const atomic_int *running;
};
struct vnet *
2023-02-06 16:01:37 +00:00
vnet_init(enum vnet_type type, const atomic_int *running);
2020-05-07 00:33:32 +03:00
#endif // VNET_H_INCLUDED