can-eth-gw-utils Utilities
0.1
A bidirectional CAN to Ethernet Gateway (Utilities)
|
Control Area Network - Ethernet - Gateway - Netlink (Utility) More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <netlink/netlink.h>
#include <netlink/cache.h>
#include <netlink/attr.h>
#include <netlink/addr.h>
#include <netlink/msg.h>
#include <netlink/errno.h>
#include <netlink/genl/ctrl.h>
#include <netlink/genl/family.h>
#include <netlink/genl/genl.h>
#include <netlink/genl/mngt.h>
#include "netlink.h"
Go to the source code of this file.
Data Structures | |
struct | flags |
Flags defined in netlink.h. Can used by flags2str(). More... | |
struct | enums |
Array of type "enum gw_type" in netlink.h. Can use by enum2str(). More... | |
Macros | |
#define | GE_FAMILY_NAME "CE_GW" |
#define | GE_FAMILY_VERSION 1 |
#define | USER_HDR_SIZE 0 |
#define | NO_FLAG 0 |
#define | IFACE_VERSION 0 |
#define | CE_GW_A_MAX (__CE_GW_A_MAX - 1) |
Enumerations | |
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 } |
Functions | |
char * | flags2str (uint32_t bits, const struct flags *flags, size_t size) |
Convert Flags in ist textual represenation. More... | |
char * | enum2str (int value, const struct enums *enums, size_t size, int max) |
Returns the textual representation of an numeric identifier (enum) More... | |
int | nl_cb_general_errno (struct sockaddr_nl *nla, struct nlmsgerr *nlerr, void *arg) |
A callback wich prints the errno to stderr. More... | |
int | nl_cb_list_entry (struct nl_msg *msg, void *arg) |
will be called for every multipart message and prints informations to stdout. More... | |
int | nl_cb_list_finish (struct nl_msg *msg, void *arg) |
will be called at the end of a multipart message. More... | |
int | nl_cb_echo_answer (struct nl_msg *msg, void *arg) |
Callback witch receive the message sen bach by kernel. More... | |
int | ce_gw_add (char *dst_name, char *src_name, uint8_t type, uint32_t flags) |
add a virtual ethernet device or a route More... | |
int | ce_gw_del (uint32_t id, char *dev_name) |
Deletes a device or a route in Kernel Module. More... | |
int | ce_gw_list (uint32_t id) |
Print informations of actual active routes to stdout. More... | |
int | ce_gw_echo (char *message) |
send a message and return the received message from Kernel. (for testing) More... | |
int | nl_sk_fam_init (void) |
creakte socket and family and connect More... | |
void | nl_sk_fam_exit (void) |
freeing the alloccated memory. The Function free the memory allocated by nl_sk_fam_init(). More... | |
Variables | |
static struct nla_policy | ce_gw_genl_policy [CE_GW_A_MAX+1] |
Netlink Policy - Defines the Type for the Netlink Attributes. More... | |
struct genl_family * | genl_fam |
struct nl_sock * | nl_sk |
struct flags | flags_array [] |
struct enums | type_array [] |
Control Area Network - Ethernet - Gateway - Netlink (Utility)
Definition in file netlink.c.
#define CE_GW_A_MAX (__CE_GW_A_MAX - 1) |
Maximum Number of Attribute
Definition at line 73 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), ce_gw_list(), nl_cb_list_entry(), and nl_sk_fam_init().
#define GE_FAMILY_NAME "CE_GW" |
#define GE_FAMILY_VERSION 1 |
Definition at line 51 of file netlink.c.
Referenced by nl_sk_fam_init().
#define IFACE_VERSION 0 |
Definition at line 54 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), and ce_gw_list().
#define NO_FLAG 0 |
Definition at line 53 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), and ce_gw_list().
#define USER_HDR_SIZE 0 |
user header size
Definition at line 52 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), ce_gw_list(), nl_cb_list_entry(), and nl_sk_fam_init().
anonymous enum |
Definition at line 61 of file netlink.c.
|
static |
Netlink Policy - Defines the Type for the Netlink Attributes.
Definition at line 78 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), ce_gw_list(), and nl_cb_list_entry().
struct flags flags_array[] |
Referenced by nl_cb_list_entry().
struct genl_family* genl_fam |
Generic Netlink Family
Definition at line 89 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), ce_gw_list(), nl_sk_fam_exit(), and nl_sk_fam_init().
struct nl_sock* nl_sk |
Socket to Kernel Application
Definition at line 90 of file netlink.c.
Referenced by ce_gw_add(), ce_gw_del(), ce_gw_echo(), ce_gw_list(), nl_sk_fam_exit(), and nl_sk_fam_init().
struct enums type_array[] |
Referenced by nl_cb_list_entry().