can_eth_gw Gateway Module  0.1
A bidirectional CAN to Ethernet Gateway (Kernel Module)
 All Data Structures Files Functions Variables Enumerations Enumerator Macros Groups Pages
ce_gw_netlink.c File Reference

Control Area Network - Ethernet - Gateway - Netlink. More...

#include <linux/version.h>
#include <net/genetlink.h>
#include <net/netlink.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/netlink.h>
#include "ce_gw_main.h"
#include <uapi/linux/netlink.h>
#include <asm-generic/errno-base.h>
#include <asm-generic/errno.h>
Include dependency graph for ce_gw_netlink.c:

Go to the source code of this file.

#define CE_GW_GE_FAMILY_NAME   "CE_GW"
 
#define CE_GW_GE_FAMILY_VERSION   2
 
#define CE_GW_USER_HDR_SIZE   0
 
#define CE_GW_NO_FLAG   0
 
#define CE_GW_A_MAX   (__CE_GW_A_MAX - 1)
 
#define CE_GW_C_MAX   (__CE_GW_C_MAX - 1)
 
enum  {
  CE_GW_A_UNSPEC, CE_GW_A_DATA, CE_GW_A_SRC, CE_GW_A_DST,
  CE_GW_A_ID, CE_GW_A_FLAGS, CE_GW_A_TYPE, CE_GW_A_HNDL,
  CE_GW_A_DROP, __CE_GW_A_MAX
}
 
enum  {
  CE_GW_C_UNSPEC, CE_GW_C_ECHO, CE_GW_C_ADD, CE_GW_C_DEL,
  CE_GW_C_LIST, __CE_GW_C_MAX
}
 
static struct nla_policy ce_gw_genl_policy [CE_GW_A_MAX+1]
 Netlink Policy - Defines the Type for the Netlink Attributes. More...
 
static struct genl_family ce_gw_genl_family
 Generic Netlink Family. More...
 
struct genl_ops ce_gw_genl_ops_echo
 details of ce_gw_netlink_echo() More...
 
struct genl_ops ce_gw_genl_ops_add
 details of ce_gw_netlink_add() More...
 
struct genl_ops ce_gw_genl_ops_del
 details of ce_gw_netlink_del() More...
 
struct genl_ops ce_gw_genl_ops_list
 details of ce_gw_netlink_list() More...
 
int ce_gw_netlink_echo (struct sk_buff *skb_info, struct genl_info *info)
 Generic Netlink Command - Sends a massage back. More...
 
int ce_gw_netlink_add (struct sk_buff *skb_info, struct genl_info *info)
 add a virtual ethernet device or a route More...
 
int ce_gw_netlink_del (struct sk_buff *skb_info, struct genl_info *info)
 Deletes a device by name or a route by ID. More...
 
int ce_gw_netlink_list (struct sk_buff *skb_info, struct genl_info *info)
 Send informations of one or more routes to userspace. More...
 
int ce_gw_netlink_init (void)
 Must called once at module init. More...
 
void ce_gw_netlink_exit (void)
 Must called once at module exit. More...
 

Detailed Description

Control Area Network - Ethernet - Gateway - Netlink.

Author
Fabian Raab (fabia.nosp@m.n.ra.nosp@m.ab@tu.nosp@m.m.de)
Date
May, 2013

Definition in file ce_gw_netlink.c.

Macro Definition Documentation

#define CE_GW_A_MAX   (__CE_GW_A_MAX - 1)

Maximum Number of Attribute

Definition at line 70 of file ce_gw_netlink.c.

#define CE_GW_C_MAX   (__CE_GW_C_MAX - 1)

Maximum Number of Commands

Definition at line 117 of file ce_gw_netlink.c.

#define CE_GW_GE_FAMILY_NAME   "CE_GW"

Netlink Family Settings

Definition at line 47 of file ce_gw_netlink.c.

#define CE_GW_GE_FAMILY_VERSION   2

Definition at line 48 of file ce_gw_netlink.c.

#define CE_GW_NO_FLAG   0

Definition at line 50 of file ce_gw_netlink.c.

Referenced by ce_gw_netlink_echo(), and ce_gw_netlink_list().

#define CE_GW_USER_HDR_SIZE   0

user header size

Definition at line 49 of file ce_gw_netlink.c.

Enumeration Type Documentation

anonymous enum
Enumerator
CE_GW_A_UNSPEC 

Only a Dummy to skip index 0.

CE_GW_A_DATA 

NLA_STRING

CE_GW_A_SRC 

NLA_STRING

CE_GW_A_DST 

NLA_STRING

CE_GW_A_ID 

NLA_U32

CE_GW_A_FLAGS 

NLA_U32

CE_GW_A_TYPE 

NLA_U8

CE_GW_A_HNDL 

NLA_U32 Handled Frames

CE_GW_A_DROP 

NLA_U32 Dropped Frames

__CE_GW_A_MAX 

Maximum Number of Attribute + 1

Definition at line 58 of file ce_gw_netlink.c.

58  {
60  CE_GW_A_DATA,
61  CE_GW_A_SRC,
62  CE_GW_A_DST,
63  CE_GW_A_ID,
65  CE_GW_A_TYPE,
66  CE_GW_A_HNDL,
67  CE_GW_A_DROP,
69 };
anonymous enum
Enumerator
CE_GW_C_UNSPEC 

Only a Dummy to skip index 0.

CE_GW_C_ECHO 

Sends a message back. Calls ce_gw_nl_echo().

CE_GW_C_ADD 

Add a gateway. Calls ce_gw_netlink_add().

CE_GW_C_DEL 

Delate a gateway. Calls ce_gw_netlink_del().

CE_GW_C_LIST 

list active gateways. Calls ce_gw_netlink_list().

__CE_GW_C_MAX 

Maximum Number of Commands plus 1

Definition at line 109 of file ce_gw_netlink.c.

109  {
111  CE_GW_C_ECHO,
112  CE_GW_C_ADD,
113  CE_GW_C_DEL,
114  CE_GW_C_LIST,
116 };