can-eth-gw-utils Utilities
0.1
A bidirectional CAN to Ethernet Gateway (Utilities)
|
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... | |
int ce_gw_add | ( | char * | src_name, |
char * | dst_name, | ||
uint8_t | type, | ||
uint32_t | flags | ||
) |
add a virtual ethernet device or a route
dst_name | The textual name of the device wich will be the dst. OR the name of the device, if you want to add a device. |
src_name | The textual name of the device wich will be the src. Must be NULL if you want do add a device. |
type | The Type of the route. For adding dev some settings according to the type will be set. |
flags | The Flags of the route. For adding dev some settings according to the type will be set. See netlink.h for the falgs. |
Definition at line 212 of file netlink.c.
References CE_GW_A_DST, CE_GW_A_FLAGS, CE_GW_A_MAX, CE_GW_A_SRC, CE_GW_A_TYPE, CE_GW_C_ADD, ce_gw_genl_policy, genl_fam, IFACE_VERSION, nl_sk, NO_FLAG, and USER_HDR_SIZE.
Referenced by main().
int ce_gw_del | ( | uint32_t | id, |
char * | dev_name | ||
) |
Deletes a device or a route in Kernel Module.
id | The id of the route you want to delete. param dev_name must be NULL when you want to delete a route. |
dev_name | The textual name of the virtual device you want to delete. The device must be previously added by ce_gw_add(). param id must be 0 if you want to delete a device. |
0 | on success |
<0 | on failure |
Definition at line 269 of file netlink.c.
References CE_GW_A_DST, CE_GW_A_ID, CE_GW_A_MAX, CE_GW_C_DEL, ce_gw_genl_policy, genl_fam, IFACE_VERSION, nl_sk, NO_FLAG, and USER_HDR_SIZE.
Referenced by main().
int ce_gw_echo | ( | char * | message | ) |
send a message and return the received message from Kernel. (for testing)
message | A String message you want to send. |
The | message you get from the Kernel. NULL on failure. |
Definition at line 460 of file netlink.c.
References CE_GW_A_DATA, CE_GW_A_MAX, CE_GW_C_ECHO, ce_gw_genl_policy, genl_fam, IFACE_VERSION, nl_cb_echo_answer(), nl_sk, NO_FLAG, and USER_HDR_SIZE.
Referenced by main().
int ce_gw_list | ( | uint32_t | id | ) |
Print informations of actual active routes to stdout.
id | set it to 0 if you want to list all routes. Else set it to the route id you want to print of the route for wich you want the informations printed. |
0 | on success |
<0 | on failure |
Definition at line 384 of file netlink.c.
References CE_GW_A_ID, CE_GW_A_MAX, CE_GW_C_LIST, ce_gw_genl_policy, genl_fam, IFACE_VERSION, nl_cb_general_errno(), nl_cb_list_entry(), nl_cb_list_finish(), nl_sk, NO_FLAG, and USER_HDR_SIZE.
Referenced by main().
void nl_sk_fam_exit | ( | void | ) |
freeing the alloccated memory. The Function free the memory allocated by nl_sk_fam_init().
Definition at line 559 of file netlink.c.
References genl_fam, and nl_sk.
Referenced by main().
int nl_sk_fam_init | ( | void | ) |
creakte socket and family and connect
It creates the netlink socket and connect, as well as the netlink family. This function must called once before any other netlink operation.
0 | on success, negative value on failure |
Definition at line 510 of file netlink.c.
References CE_GW_A_MAX, GE_FAMILY_NAME, GE_FAMILY_VERSION, genl_fam, nl_cb_general_errno(), nl_sk, and USER_HDR_SIZE.
Referenced by main().