1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2024-11-10 03:30:39 +03:00
SoftEtherVPN/src/Cedar/VLanUnix.h

67 lines
1.7 KiB
C
Raw Normal View History

2017-10-19 05:48:23 +03:00
// SoftEther VPN Source Code - Developer Edition Master Branch
2014-01-04 17:00:08 +04:00
// 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);
2014-01-04 17:00:08 +04:00
void FreeVLan(VLAN *v);
void FreeTap(VLAN *v);
2014-01-04 17:00:08 +04:00
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);
2014-01-04 17:00:08 +04:00
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);
2014-01-04 17:00:08 +04:00
TOKEN_LIST *UnixVLanEnum();
void UnixVLanDelete(char *name);
bool UnixVLanSetState(char* name, bool state_up);
2014-01-04 17:00:08 +04:00
int UnixVLanGet(char *name);
int UnixCompareVLan(void *p1, void *p2);
#endif // VLANUNIX_H