dict

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2019 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDeviceEntry

func AddDeviceEntry(key net.HardwareAddr, field string, value interface{}) error

AddDeviceEntry adds a field/value entry for the supplied mac key in the device table This is a convenience wrapper for AddEntry

func AddEntry

func AddEntry(table string, key interface{}, field string, value interface{}) error

AddEntry adds a field/value entry for the supplied key in the supplied table

func AddHostEntry

func AddHostEntry(key net.IP, field string, value interface{}) error

AddHostEntry adds a field/value entry for the supplied ip key in the host table This is a convenience wrapper for AddEntry

func AddSessionEntry

func AddSessionEntry(key uint32, field string, value interface{}) error

AddSessionEntry adds a field/value entry for the supplied int key in the session table This is a convenience wrapper for AddEntry

func AddUserEntry

func AddUserEntry(key string, field string, value interface{}) error

AddUserEntry adds a field/value entry for the supplied string key in the user table This is a convenience wrapper for AddEntry

func DeleteDevice

func DeleteDevice(key net.HardwareAddr) error

DeleteDevice removes a dictionary from the device table This is a convenience wrapper for DeleteDictionary

func DeleteDictionary

func DeleteDictionary(table string, key interface{}) error

DeleteDictionary removes a dictionary with the supplied key in the supplied table

func DeleteHost

func DeleteHost(key net.IP) error

DeleteHost removes a dictionary from the host table This is a convenience wrapper for DeleteDictionary

func DeleteSession

func DeleteSession(key uint32) error

DeleteSession removes a dictionary from the session table This is a convenience wrapper for DeleteDictionary

func DeleteUser

func DeleteUser(key string) error

DeleteUser removes a dictionary from the user table This is a convenience wrapper for DeleteDictionary

func Disable

func Disable()

Disable disable dict writing

func GetSessions added in v0.1.2

func GetSessions() (map[uint32]map[string]interface{}, error)

GetSessions returns the session table

func Shutdown

func Shutdown()

Shutdown dict service

func Startup

func Startup()

Startup dict service

Types

type Entry

type Entry struct {
	Table string
	Key   interface{}
	Field string
	Value interface{}
}

Entry holds a dictionary entry Table is the string name of the table the entry's dictionary is in Key is the key of this entry's dictionary in the table Field is the string name of the field for this entry in the dictionary Value is the value for this field stored in the dictionary

func GetAllEntries

func GetAllEntries() ([]Entry, error)

GetAllEntries gets all of entries for all known dictionaries This function returns an error if it cannot open or read /proc/net/dict/all

func GetDeviceEntry

func GetDeviceEntry(key net.HardwareAddr, field string) (Entry, error)

GetDeviceEntry gets the dictionary entry from the device table with the specified key and field This is a convenience wrapper for GetEntry

func GetDictionary

func GetDictionary(table string, key interface{}) ([]Entry, error)

GetDictionary gets all of the dictionary entries for the supplied key This function will return an error if it cannot open or read /proc/net/dict/read

func GetEntry

func GetEntry(table string, key interface{}, field string) (Entry, error)

GetEntry gets the dictionary entry for the specified table, key and field This function returns an error if the requested entry cannot be found

func GetHostEntry

func GetHostEntry(key net.IP, field string) (Entry, error)

GetHostEntry gets the dictionary entry from the host table with the specified key and field This is a convenience wrapper for GetEntry

func GetSessionEntry

func GetSessionEntry(key uint32, field string) (Entry, error)

GetSessionEntry gets the dictionary entry from the session table with the specified key and field This is a convenience wrapper for GetEntry

func GetTable added in v0.1.2

func GetTable(table string) ([]Entry, error)

GetTable gets all of the dictionary entries in the supplied table This function will return an error if it cannot open or read /proc/net/dict/read

func GetUserEntry

func GetUserEntry(key string, field string) (Entry, error)

GetUserEntry gets the dictionary entry from the user table with the specified key and field This is a convenience wrapper for GetEntry

func (Entry) GetBool

func (p Entry) GetBool() (bool, error)

GetBool gets an entry's bool value Given a dictionary Entry, return the entry's value field as a bool. If the entry's value is not a bool, return an error

func (Entry) GetIP

func (p Entry) GetIP() (net.IP, error)

GetIP gets an entry's IP value Given a dictionary Entry, return the entry's value field as a IP address. If the entry's value is not a IP address, return an error

func (Entry) GetInt

func (p Entry) GetInt() (uint32, error)

GetInt gets an entry's integer value Given a dictionary Entry, return the entry's value field as a 32bit integer. If the entry's value is not a 32bit integer, return an error

func (Entry) GetInt64

func (p Entry) GetInt64() (uint64, error)

GetInt64 gets an entry's 64 bit integer value Given a dictionary Entry, return the entry's value field as a 64bit integer. If the entry's value is not a 64bit integer, return an error

func (Entry) GetMac

func (p Entry) GetMac() (net.HardwareAddr, error)

GetMac gets an entry's mac value Given a dictionary Entry, return the entry's value field as a MAC address. If the entry's value is not a MAC address, return an error

func (Entry) GetString

func (p Entry) GetString() (string, error)

GetString gets an entry's string value Given a dictionary Entry, return the entry's value field as a string. If the entry's value is not a string, return an error

func (Entry) GetValue

func (p Entry) GetValue() interface{}

GetValue gets an entry's value Given a dictionary Entry, return the entry's value field

func (Entry) Print

func (p Entry) Print()

Print an Entry Given a dictionary Entry, print (log) the Entry table, key, field, and value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL