1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-09-19 18:20:40 +03:00
SoftEtherVPN/src/Cedar/VLanUnix.h

67 lines
1.7 KiB
C

// SoftEther VPN Source Code - Developer Edition Master Branch
// Cedar Communication Module
// VLanUnix.h
// Header of VLanUnix.c
#ifndef VLANUNIX_H
#define VLANUNIX_H
// Constant
#define TAP_READ_BUF_SIZE 1600
#ifndef NO_VLAN
// VLAN structure
struct VLAN
{
volatile bool Halt; // Halt flag
char *InstanceName; // Instance name
int fd; // File
};
// Function prototype
VLAN *NewVLan(char *instance_name, VLAN_PARAM *param);
VLAN *NewTap(char *name, char *mac_address, bool create_up);
void FreeVLan(VLAN *v);
void FreeTap(VLAN *v);
CANCEL *VLanGetCancel(VLAN *v);
bool VLanGetNextPacket(VLAN *v, void **buf, UINT *size);
bool VLanPutPacket(VLAN *v, void *buf, UINT size);
PACKET_ADAPTER *VLanGetPacketAdapter();
bool VLanPaInit(SESSION *s);
CANCEL *VLanPaGetCancel(SESSION *s);
UINT VLanPaGetNextPacket(SESSION *s, void **data);
bool VLanPaPutPacket(SESSION *s, void *data, UINT size);
void VLanPaFree(SESSION *s);
#else // NO_VLAN
#define VLanGetPacketAdapter NullGetPacketAdapter
#endif // NO_VLAN
struct UNIX_VLAN_LIST
{
char Name[MAX_SIZE]; // Device name
int fd; // fd
};
int UnixCreateTapDevice(char *name, UCHAR *mac_address, bool create_up);
int UnixCreateTapDeviceEx(char *name, char *prefix, UCHAR *mac_address, bool create_up);
void UnixCloseTapDevice(int fd);
void UnixVLanInit();
void UnixVLanFree();
bool UnixVLanCreate(char *name, UCHAR *mac_address, bool create_up);
bool UnixVLanCreateEx(char *name, char *prefix, UCHAR *mac_address, bool create_up);
TOKEN_LIST *UnixVLanEnum();
void UnixVLanDelete(char *name);
bool UnixVLanSetState(char* name, bool state_up);
int UnixVLanGet(char *name);
int UnixCompareVLan(void *p1, void *p2);
#endif // VLANUNIX_H