aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/interceptor/linux_virtual_adapter_internal.h
blob: 72f3b0147a67191113aef9542a1902f726742d65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/* Netfilter Driver for IPSec VPN Client
 *
 * Copyright(c)   2012 Samsung Electronics
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */

/*
 *
 * linux_virtual_adapter_internal.h
 *
 * Internal declarations for linux virtual adapters.
 *
 */


#ifndef LINUX_VIRTUAL_ADAPTER_INTERNAL_H
#define LINUX_VIRTUAL_ADAPTER_INTERNAL_H

#include "virtual_adapter.h"

/* **************************** Types and Definitions ************************/

/* Maximum number of virtual adapters. */
#define SSH_LINUX_MAX_VIRTUAL_ADAPTERS 16

/* Prefix for adapter names. */
#define SSH_ADAPTER_NAME_PREFIX "vip"

/* HW address lenght. */
#define SSH_MAX_VIRTUAL_ADAPTER_HWADDR_LEN 6

/* Maximum number of configured IPv6 addresses the virtual adapter saves
   and restores on ifdown / ifup. */
#define SSH_VIRTUAL_ADAPTER_MAX_IPV6_ADDRS 2

/* Context for a virtual adapter. */
typedef struct SshVirtualAdapterRec
{
  /* Is the adapter initialized.  This is 0 until the
     ssh_virtual_adapter_create() returns. */
  SshUInt8 initialized : 1;

  /* Is the adapter destroyed. */
  SshUInt8 destroyed : 1;

  /* Is the adapter attached to engine. */
  SshUInt8 attached : 1;

  /* Packet callback. */
  SshVirtualAdapterPacketCB packet_cb;

  /* Destructor for engine-level block */
  SshVirtualAdapterDetachCB detach_cb;
  void *adapter_context;

  /* The low-level implementation of a virtual adapter. */

  /* Platform dependant low-level implementation structure. */
  struct net_device *dev;
  struct net_device_stats low_level_stats;

} SshVirtualAdapterStruct, *SshVirtualAdapter;

/* ******************************* Functions *********************************/

int ssh_interceptor_virtual_adapter_init(SshInterceptor interceptor);
int ssh_interceptor_virtual_adapter_uninit(SshInterceptor interceptor);

#endif /* LINUX_VIRTUAL_ADAPTER_INTERNAL_H */