umka/vnet.h

38 lines
735 B
C
Raw Normal View History

2022-06-27 19:36:56 +02: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 19:36:56 +02:00
*/
2020-05-06 23:33:32 +02:00
#ifndef VNET_H_INCLUDED
#define VNET_H_INCLUDED
#include <stdatomic.h>
#include "umka.h"
2020-05-06 23:33:32 +02:00
#define VNET_BUFIN_CAP (NET_BUFFER_SIZE - offsetof(net_buff_t, data))
enum vnet_type {
VNET_DEVTYPE_NULL,
VNET_DEVTYPE_FILE,
VNET_DEVTYPE_TAP,
};
struct vnet {
2023-02-02 01:37:11 +01:00
struct eth_device eth;
uint8_t bufin[VNET_BUFIN_CAP];
size_t bufin_len;
int fdin;
int fdout;
int input_processed;
const atomic_int *running;
};
struct vnet *
vnet_init(enum vnet_type type, const atomic_int *running);
2020-05-06 23:33:32 +02:00
#endif // VNET_H_INCLUDED