vif_config.c File Reference

Implements the virtual interface configuration storage. More...

#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "vif.h"

Go to the source code of this file.

Data Structures

struct  vif_list

Defines

#define VIF_LIST_SIZE   sizeof(vif_list)
#define MATCH_ID(id)   ((id) == list_id)

Functions

int vif_config_create (void)
int vif_config_load (void)
int vif_config_list (int, char[MAX_NUM_VIF][IFNAMSIZ+1])
vif_infovif_config_vif_info (int, const char *)
int vif_config_add (int, const char *)
int vif_config_delete (int, const char *)
int vif_config_destory (int)
void vif_config_print (int)
int vif_config_init (int flags)
int vif_config_device_index (const char *dev_name)
void vif_config_init_iwrange (iwrange *wlan_range)
void vif_config_init_wlan (const char *dev_name)
int vif_config_unload (int id)

Variables

int list_id = -1
vif_listlist = NULL
int(* vif_debug )(const char *format,...)
int(* vif_error )(const char *format,...)


Detailed Description

Implements the virtual interface configuration storage.

It defines vif_list which is used to store the device configurations. Further it provides functions to create, delete and query virtual interface configurations.

Definition in file vif_config.c.


Define Documentation

#define MATCH_ID ( id   )     ((id) == list_id)

Definition at line 43 of file vif_config.c.

#define VIF_LIST_SIZE   sizeof(vif_list)

Definition at line 42 of file vif_config.c.


Function Documentation

int vif_config_add ( int  id,
const char *  dev_name 
)

Add a new default virtual interface configuration to the list

Parameters:
id List ID
dev_name Interface device name
Returns:
0 if success, -1 else
See also:
vif_config_init_wlan

int vif_config_create ( void   ) 

Create a new empty virtual interface list

Returns:
List ID (-1 on error)

int vif_config_delete ( int  id,
const char *  dev_name 
)

Delete a specific vif configuration from the list

Parameters:
id List ID
dev_name Interface device name

int vif_config_destory ( int  id  ) 

Delete the shared memory vif list.

Parameters:
id List ID

Definition at line 325 of file vif_config.c.

int vif_config_device_index ( const char *  dev_name  ) 

Return index of given virtual interface

Definition at line 105 of file vif_config.c.

int vif_config_init ( int  flags  ) 

Initialize shared memory storage for vif_list

Parameters:
flags Shared memory flags (see: man shmget)
Returns:
List ID

Definition at line 78 of file vif_config.c.

void vif_config_init_iwrange ( iwrange wlan_range  ) 

Define driver parameter range in allusion to the ath_pci driver. Still a lot of members are uninitialized but they generally are of minor importance.

TODO: Function could be extended with driver type as argument, so we can load the range according to wlan driver

Definition at line 133 of file vif_config.c.

void vif_config_init_wlan ( const char *  dev_name  ) 

Set default wireless configuration (see iw_compat.h for struct wireless_info) Parameters are choosen as they were observed from real Atheros module loading before any configuration step. Still some values may not correspond to the kernel module initialization.

See also:
vif.h

Definition at line 167 of file vif_config.c.

int vif_config_list ( int  id,
char  vif_names[MAX_NUM_VIF][IFNAMSIZ+1] 
)

List the configured virtual interfaces

Parameters:
id List ID
vif_names Char-array to store the virtual interface names
Returns:
Number of configured virtual interfaces

int vif_config_load ( void   ) 

Load the shared memory virtual interface list

Returns:
List ID (-1 on error)

void vif_config_print ( int  id  ) 

Print vif_list to the debug output

Parameters:
id List ID

int vif_config_unload ( int  id  ) 

Unload the virtual interface list

Definition at line 306 of file vif_config.c.

vif_info* vif_config_vif_info ( int  id,
const char *  dev_name 
)

Return a virtual interface configuration from the list

Parameters:
id List ID
dev_name Interface device name
Returns:
Pointer to vif_info structure of given device


Variable Documentation

vif_list* list = NULL

Vif list shared memory pointer

Definition at line 52 of file vif_config.c.

int list_id = -1

Virtual interface list ID

Definition at line 49 of file vif_config.c.

int(* vif_debug)(const char *format,...)

Debug output function (ignored by default) can be changed with vif_set_debug_function()

int(* vif_error)(const char *format,...)

Error output function (default to stdout) can be changed with vif_set_error_function()


Generated on Mon Feb 8 14:55:05 2010 for Virtual Interface Tools by  doxygen 1.5.8