Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
lowlevel-options-linux.c File Reference
#include <stdio.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <stdint.h>
#include <stdlib.h>
#include <linux/types.h>
#include <sys/socket.h>
#include <linux/rtnetlink.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include "Portable.h"
#include "dibbler-config.h"
+ Include dependency graph for lowlevel-options-linux.c:

Macros

#define _BSD_SOURCE
#define _POSIX_SOURCE
#define CR   0x0a
#define LF   0x0d
#define MAX_LINE_LEN   511
#define TIMEZONE_FILE_TMP   TIMEZONE_FILE".dibbler"
#define TZ_LEN   64

Functions

void add_radvd_conf (const char *ifname, const char *prefixPlain, int prefixLength, uint32_t preferred, uint32_t valid)
int cfg_file_del (const char *file, const char *keyword, const char *value)
 removes value of keyword from file.
int cfg_value_del (FILE *in, FILE *out, const char *keyword, const char *value, const char comment, int remove_empty)
 Removes an entry from a file.
void delete_radvd_conf (const char *ifname, const char *prefixPlain, int prefixLen)
int dns_add (const char *ifname, int ifaceid, const char *addrPlain)
int dns_del (const char *ifname, int ifaceid, const char *addrPlain)
int domain_add (const char *ifname, int ifaceid, const char *domain)
int domain_del (const char *ifname, int ifaceid, const char *domain)
int iproute_modify (int cmd, unsigned flags, int argc, char **argv)
int nisdomain_del (const char *ifname, int ifindex, const char *domain)
int nisdomain_set (const char *ifname, int ifindex, const char *domain)
int nisplusdomain_del (const char *ifname, int ifindex, const char *domain)
int nisplusdomain_set (const char *ifname, int ifindex, const char *domain)
int nisplusserver_add (const char *ifname, const int ifindex, const char *addrPlain)
int nisplusserver_del (const char *ifname, const int ifindex, const char *addrPlain)
int nisserver_add (const char *ifname, const int ifindex, const char *addrPlain)
int nisserver_del (const char *ifname, const int ifindex, const char *addrPlain)
int ntp_add (const char *ifname, const int ifindex, const char *addrPlain)
int ntp_del (const char *ifname, const int ifindex, const char *addrPlain)
int prefix_add (const char *ifname, int ifindex, const char *prefixPlain, int prefixLength, unsigned long preferred, unsigned long valid)
int prefix_del (const char *ifname, int ifindex, const char *prefixPlain, int prefixLength)
int prefix_update (const char *ifname, int ifindex, const char *prefixPlain, int prefixLength, unsigned long prefered, unsigned long valid)
int sipdomain_add (const char *ifname, int ifindex, const char *domain)
int sipdomain_del (const char *ifname, int ifindex, const char *domain)
int sipserver_add (const char *ifname, const int ifindex, const char *addrPlain)
int sipserver_del (const char *ifname, const int ifindex, const char *addrPlain)
int timezone_del (const char *ifname, int ifindex, const char *timezone)
int timezone_set (const char *ifname, int ifindex, const char *timezone)

Macro Definition Documentation

#define _BSD_SOURCE
#define _POSIX_SOURCE
#define CR   0x0a
#define LF   0x0d
#define MAX_LINE_LEN   511
#define TIMEZONE_FILE_TMP   TIMEZONE_FILE".dibbler"
#define TZ_LEN   64

Function Documentation

void add_radvd_conf ( const char *  ifname,
const char *  prefixPlain,
int  prefixLength,
uint32_t  preferred,
uint32_t  valid 
)
int cfg_file_del ( const char *  file,
const char *  keyword,
const char *  value 
)

removes value of keyword from file.

It tries to do its best not to corrupt the file. Returns LOWLEVEL ERROR codes

Parameters
file
keyword
value
Returns
status code (one of LOWLEVEL_* defines)
int cfg_value_del ( FILE *  in,
FILE *  out,
const char *  keyword,
const char *  value,
const char  comment,
int  remove_empty 
)

Removes an entry from a file.

Remove value of keyword from opened file in and the result is printed into opened file out. If removed_empty and keyword remains without argument, it will be removed too. Comments (starting with comment char) are respected. All values following keyword are removed on all lines (global remove).

Parameters
in
out
keyword
value
comment
remove_empty
Returns
Returns LOWLEVEL_NO_ERROR by default, LOWLEVEL_ERROR_FILE on I/O error \ (and errno is set up), LOWLEVEL_ERROR_UNSPEC if value or keyword is too long.
void delete_radvd_conf ( const char *  ifname,
const char *  prefixPlain,
int  prefixLen 
)
int dns_add ( const char *  ifname,
int  ifaceid,
const char *  addrPlain 
)
int dns_del ( const char *  ifname,
int  ifaceid,
const char *  addrPlain 
)
int domain_add ( const char *  ifname,
int  ifaceid,
const char *  domain 
)
int domain_del ( const char *  ifname,
int  ifaceid,
const char *  domain 
)
int iproute_modify ( int  cmd,
unsigned  flags,
int  argc,
char **  argv 
)
int nisdomain_del ( const char *  ifname,
int  ifindex,
const char *  domain 
)
int nisdomain_set ( const char *  ifname,
int  ifindex,
const char *  domain 
)
int nisplusdomain_del ( const char *  ifname,
int  ifindex,
const char *  domain 
)
int nisplusdomain_set ( const char *  ifname,
int  ifindex,
const char *  domain 
)
int nisplusserver_add ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int nisplusserver_del ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int nisserver_add ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int nisserver_del ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int ntp_add ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int ntp_del ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int prefix_add ( const char *  ifname,
int  ifindex,
const char *  prefixPlain,
int  prefixLength,
unsigned long  preferred,
unsigned long  valid 
)

adds prefix - if this node has IPv6 forwarding disabled, it will configure that prefix on the interface, which prefix has been received on. If the forwarding is enabled, it will be assigned to all other up, running and multicast capable interfaces. In both cases, radvd.conf file will be created.

Parameters
ifnameinterface name
ifindexinterface index
prefixPlainprefix (specified in human readable format)
prefixLengthprefix length
preferedpreferred lifetime
validvalid lifetime
Returns
negative error code or 0 if successful
Todo:
: implement this
int prefix_del ( const char *  ifname,
int  ifindex,
const char *  prefixPlain,
int  prefixLength 
)
Todo:
: implement this
int prefix_update ( const char *  ifname,
int  ifindex,
const char *  prefixPlain,
int  prefixLength,
unsigned long  prefered,
unsigned long  valid 
)
Todo:
: implement this
int sipdomain_add ( const char *  ifname,
int  ifindex,
const char *  domain 
)
int sipdomain_del ( const char *  ifname,
int  ifindex,
const char *  domain 
)
int sipserver_add ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int sipserver_del ( const char *  ifname,
const int  ifindex,
const char *  addrPlain 
)
int timezone_del ( const char *  ifname,
int  ifindex,
const char *  timezone 
)
int timezone_set ( const char *  ifname,
int  ifindex,
const char *  timezone 
)