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);
|
2018-08-05 18:35:57 +03:00
|
|
|
VLAN *NewTap(char *name, char *mac_address, bool create_up);
|
2014-01-04 17:00:08 +04:00
|
|
|
void FreeVLan(VLAN *v);
|
2018-08-10 22:21:19 +03:00
|
|
|
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
|
|
|
|
};
|
|
|
|
|
2018-08-05 18:35:57 +03:00
|
|
|
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();
|
2018-08-05 18:35:57 +03:00
|
|
|
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);
|
2018-08-05 18:35:57 +03:00
|
|
|
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
|
|
|
|
|