Documentation ¶
Index ¶
- Variables
- func AlignAttr(len int) int
- func AlignMsg(len int) int
- func Bytes2Str(b []byte) string
- func Hbo() binary.ByteOrder
- func HostByteOrder() (res binary.ByteOrder)
- func Str2Bytes(s string) []byte
- type Attr
- func (a Attr) GetData() []byte
- func (a Attr) GetDataAttrs() (attrs []Attr, err error)
- func (a Attr) GetDataDump() string
- func (a Attr) GetDataString() string
- func (a Attr) GetDataUint16() uint16
- func (a Attr) GetDataUint32() uint32
- func (a Attr) GetDataUint8() uint8
- func (a *Attr) MarshalBinary() (data []byte, err error)
- func (a *Attr) SetData(data []byte) (err error)
- func (a *Attr) UnmarshalBinary(data []byte) (err error)
- type Client
- func (c *Client) AddGroupMembership(groupid int) (err error)
- func (c *Client) Close() (err error)
- func (c *Client) DropGroupMembership(groupid int) (err error)
- func (c *Client) Open() (err error)
- func (c *Client) Read() (res []byte)
- func (c *Client) Receive() (msgs []Message, err error)
- func (c *Client) Send(msg Message) (err error)
- func (c *Client) Sendmsg(p, oob []byte, to unix.Sockaddr, flags int) (err error)
- type Message
- func (m Message) GetData() []byte
- func (m Message) GetErrNo() error
- func (m Message) HasFlagAck() bool
- func (m Message) HasFlagDump() bool
- func (m Message) HasFlagMulti() bool
- func (m Message) IsTypeDone() bool
- func (m Message) IsTypeError() bool
- func (m Message) IsTypeNoop() bool
- func (m *Message) MarshalBinary() (data []byte, err error)
- func (m *Message) SetData(data []byte) (err error)
- func (m *Message) UnmarshalBinary(src []byte) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
EInvalidAttribute = errors.New("Invalid netlink attribute")
)
View Source
var (
EInvalidMessage = errors.New("Invalid netlink message")
)
Functions ¶
func HostByteOrder ¶
Detect host byteorder (used by netlink)
Types ¶
type Attr ¶
func (Attr) GetDataAttrs ¶
func (Attr) GetDataDump ¶
func (Attr) GetDataString ¶
func (Attr) GetDataUint16 ¶
func (Attr) GetDataUint32 ¶
func (Attr) GetDataUint8 ¶
func (*Attr) MarshalBinary ¶
func (*Attr) UnmarshalBinary ¶
type Client ¶
type Client struct { Family int // contains filtered or unexported fields }
func (*Client) AddGroupMembership ¶
func (*Client) DropGroupMembership ¶
func (*Client) Read ¶
func (c *Client) Receive2() (msgs []Message, err error) { for { //fmt.Println("Reading") raw_in := c.Read() msg := Message{} msg.UnmarshalBinary(raw_in) if msg.IsTypeError() { return nil,errors.New(fmt.Sprintf("Error response: %+v %+v", msg.GetData(), msg.GetErrNo())) } msgs = append(msgs, msg) fmt.Printf("Received raw: \n%v\n", hex.Dump(raw_in)) fmt.Printf("Received %+v\nData:\n%+v\n", msg, hex.Dump(msg.data)) // check if last message if msg.IsTypeDone() || !msg.HasFlagMulti() { break } } return }
type Message ¶
type Message struct { Len uint32 Type uint16 Flags uint16 Seq uint32 Pid uint32 // contains filtered or unexported fields }
func (Message) HasFlagAck ¶
func (Message) HasFlagDump ¶
func (Message) HasFlagMulti ¶
func (Message) IsTypeDone ¶
func (Message) IsTypeError ¶
func (Message) IsTypeNoop ¶
func (*Message) MarshalBinary ¶
func (*Message) UnmarshalBinary ¶
Click to show internal directories.
Click to hide internal directories.