All Files Functions Variables Enumerator Macros Groups Pages
Enumerations | Functions | Variables
netlink.c File Reference

Netlink server implementation. More...

#include <net/genetlink.h>
#include "rom.h"
#include <linux/time.h>
#include <linux/kfifo.h>

Go to the source code of this file.

Enumerations

enum  
 ATTRIBUTES.
 
enum  { ,
  ROM_C_RREQ, ROM_C_RLIFE, ROM_C_RTADD, ROM_C_RTDEL,
  ROM_C_RTDMP, ROM_C_QREL, ROM_C_QDMP, ROM_C_SETGW,
  ROM_C_RERR
}
 COMMANDS. More...
 

Functions

static LIST_HEAD (rl_list)
 
static LIST_HEAD (lb_list)
 
int send_rom_rreq (__be32 dst_addr)
 HANDLERS Route Request: broadcast RREQ message to user space.
 
int send_rom_rlife (__be32 dst_addr)
 HANDLERS Route Lifetime: broadcast Route Lifetime(RLIFE) message to user space.
 
int send_rom_rerr (__be32 dst_addr)
 Route Error: broadcast RERR message to user space (LLF)
 
static int rom_rtadd (struct sk_buff *skb, struct genl_info *info)
 Add route: add destination to our route table.
 
static int rom_rtdel (struct sk_buff *skb, struct genl_info *info)
 Delete route: delete destination to our route table.
 
static int rom_rtdmp (struct sk_buff *skb, struct genl_info *info)
 Route Table Dump: print out current route table.
 
static int rom_qrel (struct sk_buff *skb, struct genl_info *info)
 Queue Release: dequeue all packets for destination.
 
static int rom_qdmp (struct sk_buff *skb, struct genl_info *info)
 Queue Dump: print out current queue contents.
 
static int rom_setgw (struct sk_buff *skb, struct genl_info *info)
 Set GW: set gw_reachable state.
 
int netlink_init (void)
 netlink_init
 
void netlink_exit (void)
 netlink_exit
 

Variables

static u32 rom_seqnum = 1
 A sequence number counter is needed for sending netlink messages.
 
static struct nla_policy rom_genl_policy [ROM_A_MAX+1]
 ATTRIBUTE POLICY.
 
static struct genl_family rom_gnl_family
 FAMILY DEFINITION.
 
static struct genl_ops rom_gnl_ops_rtadd
 OPERATION DEFINITIONS.
 
static struct genl_ops rom_gnl_ops_rtdel
 OPERATION DEFINITIONS.
 
static struct genl_ops rom_gnl_ops_rtdmp
 OPERATION DEFINITIONS.
 
static struct genl_ops rom_gnl_ops_qrel
 OPERATION DEFINITIONS.
 
static struct genl_ops rom_gnl_ops_qdmp
 OPERATION DEFINITIONS.
 
static struct genl_ops rom_gnl_ops_setgw
 OPERATION DEFINITIONS.
 

Detailed Description

Netlink server implementation.

Authors
Carsten.Vogel | Mohamad.Sbeiti @paser.info

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For further information see file COPYING in the top level directory

This work is part of the secure wireless mesh networks framework, which is currently under development by CNI

Definition in file netlink.c.

Enumeration Type Documentation

anonymous enum

COMMANDS.

Enumerator:
ROM_C_RREQ 

Route Request.

ROM_C_RLIFE 

Route Lifetime.

ROM_C_RTADD 

Add Route.

ROM_C_RTDEL 

Delete Route.

ROM_C_RTDMP 

Dump Route Table.

ROM_C_QREL 

Queue Release.

ROM_C_QDMP 

Queue Dump.

ROM_C_SETGW 

Set gw_reachable state.

ROM_C_RERR 

Route Error (Link Layer Feedback)

Definition at line 113 of file netlink.c.

Function Documentation

static LIST_HEAD ( rl_list  )
static

defines the queue list as struct list_head

static LIST_HEAD ( lb_list  )
static

defines the queue list as struct list_head

int netlink_init ( void  )

netlink_init

Returns
-1 or 0

Definition at line 571 of file netlink.c.

References rom_gnl_family, rom_gnl_ops_qdmp, rom_gnl_ops_qrel, rom_gnl_ops_rtadd, rom_gnl_ops_rtdel, rom_gnl_ops_rtdmp, and rom_gnl_ops_setgw.

Referenced by rom_init().

static int rom_qdmp ( struct sk_buff *  skb,
struct genl_info *  info 
)
static

Queue Dump: print out current queue contents.

Parameters
skbsocket buffer
infoinfo
Returns
0

Definition at line 471 of file netlink.c.

References dump_queue_list().

static int rom_qrel ( struct sk_buff *  skb,
struct genl_info *  info 
)
static

Queue Release: dequeue all packets for destination.

Parameters
sbksocket buffer
infoinfo
Returns
-1 or 0

Definition at line 441 of file netlink.c.

References DEBUG_ROM, and release_queue_for_dst().

static int rom_rtadd ( struct sk_buff *  skb,
struct genl_info *  info 
)
static

Add route: add destination to our route table.

Parameters
skbsocket buffer
infoinfo
Returns
...

Definition at line 376 of file netlink.c.

References add_route(), DEBUG_ROM, and release_queue_for_dst().

static int rom_rtdel ( struct sk_buff *  skb,
struct genl_info *  info 
)
static

Delete route: delete destination to our route table.

Parameters
skbsocket buffer
infoinfo
Returns
...

Definition at line 403 of file netlink.c.

References DEBUG_ROM, and delete_route().

static int rom_rtdmp ( struct sk_buff *  skb,
struct genl_info *  info 
)
static

Route Table Dump: print out current route table.

Parameters
skbsocket buffer
infoinfo
Returns
0

Definition at line 427 of file netlink.c.

References dump_route_table().

static int rom_setgw ( struct sk_buff *  skb,
struct genl_info *  info 
)
static

Set GW: set gw_reachable state.

Parameters
skbsocket buffer
infoinfo
Returns
-1 or 0

Definition at line 485 of file netlink.c.

int send_rom_rerr ( __be32  dst_addr)

Route Error: broadcast RERR message to user space (LLF)

TODO Code nearly identical to above send_rom_rreq() - write a wrapper

Parameters
dst_addr
Returns
...

Definition at line 282 of file netlink.c.

References LLF_IN_SECONDS, ROM_C_RERR, rom_gnl_family, and rom_seqnum.

int send_rom_rlife ( __be32  dst_addr)

HANDLERS Route Lifetime: broadcast Route Lifetime(RLIFE) message to user space.

Parameters
dst_addrdestination address
Returns
...

Definition at line 194 of file netlink.c.

References ROM_C_RLIFE, rom_gnl_family, and rom_seqnum.

Referenced by hook_func().

int send_rom_rreq ( __be32  dst_addr)

HANDLERS Route Request: broadcast RREQ message to user space.

Parameters
dst_addrdestination address
Returns
...

Definition at line 137 of file netlink.c.

References ROM_C_RREQ, rom_gnl_family, and rom_seqnum.

Referenced by check_and_send_rreq().