Fork Vasum on GitHub Official Vasum Wiki on Tizen.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
vasum::netlink::NetlinkResponse Class Reference

NetlinkResponse is used to read netlink messages. More...

#include <netlink-message.hpp>

Public Member Functions

bool hasMessage () const
 Check if theres is next message in netlink response. More...
 
void fetchNextMessage ()
 Fetch next message. More...
 
int getMessageType () const
 Get message type. More...
 
bool hasAttribute () const
 Check if there is any attribute in message. More...
 
bool isNestedAttribute () const
 Check if current attribute is nested. More...
 
void skipAttribute ()
 Skip attribute. More...
 
NetlinkResponseopenNested (int ifla)
 Start reading nested attribute. More...
 
NetlinkResponsecloseNested ()
 End reading nested attribute. More...
 
int getAttributeType () const
 Get attributie type. More...
 
int getAttributeLength () const
 Get attributie length. More...
 
template<class T >
NetlinkResponsefetch (T &value)
 Fetch data of type T. More...
 
template<class T >
NetlinkResponseskip ()
 Skip data of type T. More...
 
NetlinkResponsefetch (int ifla, std::string &value, unsigned maxLen=std::numeric_limits< unsigned >::max())
 Fetch attribute. More...
 
template<class T >
NetlinkResponsefetch (int ifla, T &value)
 

Private Member Functions

 NetlinkResponse (std::unique_ptr< std::vector< char >> &&message)
 
const char * get (int ifla, int iflasize) const
 
const char * get (int size=0) const
 
NetlinkResponsefetch (int ifla, char *data, int len)
 
NetlinkResponsefetch (char *data, int len)
 
NetlinkResponseseek (int len)
 
int size () const
 
int getHdrPosition () const
 

Private Attributes

std::unique_ptr< std::vector
< char > > 
mNlmsg
 
std::stack< int > mNested
 
nlmsghdr * mNlmsgHdr
 
int mPosition
 

Friends

NetlinkResponse send (const NetlinkMessage &msg, int pid)
 Send netlink message. More...
 

Detailed Description

NetlinkResponse is used to read netlink messages.

Constructor & Destructor Documentation

vasum::netlink::NetlinkResponse::NetlinkResponse ( std::unique_ptr< std::vector< char >> &&  message)
private

Member Function Documentation

NetlinkResponse & vasum::netlink::NetlinkResponse::closeNested ( )

End reading nested attribute.

NetlinkResponse & vasum::netlink::NetlinkResponse::fetch ( int  ifla,
std::string &  value,
unsigned  maxLen = std::numeric_limits<unsigned>::max() 
)

Fetch attribute.

template<class T >
NetlinkResponse & vasum::netlink::NetlinkResponse::fetch ( int  ifla,
T &  value 
)
template<class T >
NetlinkResponse & vasum::netlink::NetlinkResponse::fetch ( T &  value)

Fetch data of type T.

NetlinkResponse & vasum::netlink::NetlinkResponse::fetch ( int  ifla,
char *  data,
int  len 
)
private
NetlinkResponse & vasum::netlink::NetlinkResponse::fetch ( char *  data,
int  len 
)
private
void vasum::netlink::NetlinkResponse::fetchNextMessage ( )

Fetch next message.

const char * vasum::netlink::NetlinkResponse::get ( int  ifla,
int  iflasize 
) const
private
const char * vasum::netlink::NetlinkResponse::get ( int  size = 0) const
private
int vasum::netlink::NetlinkResponse::getAttributeLength ( ) const

Get attributie length.

int vasum::netlink::NetlinkResponse::getAttributeType ( ) const

Get attributie type.

int vasum::netlink::NetlinkResponse::getHdrPosition ( ) const
inlineprivate
int vasum::netlink::NetlinkResponse::getMessageType ( ) const

Get message type.

bool vasum::netlink::NetlinkResponse::hasAttribute ( ) const

Check if there is any attribute in message.

bool vasum::netlink::NetlinkResponse::hasMessage ( ) const

Check if theres is next message in netlink response.

bool vasum::netlink::NetlinkResponse::isNestedAttribute ( ) const

Check if current attribute is nested.

NetlinkResponse & vasum::netlink::NetlinkResponse::openNested ( int  ifla)

Start reading nested attribute.

NetlinkResponse & vasum::netlink::NetlinkResponse::seek ( int  len)
private
int vasum::netlink::NetlinkResponse::size ( ) const
private
template<class T >
NetlinkResponse & vasum::netlink::NetlinkResponse::skip ( )

Skip data of type T.

void vasum::netlink::NetlinkResponse::skipAttribute ( )

Skip attribute.

Friends And Related Function Documentation

NetlinkResponse send ( const NetlinkMessage msg,
int  pid 
)
friend

Send netlink message.

It is not thread safe

Parameters
msgNetlink message
pidProcess id which describes network namespace

Member Data Documentation

std::stack<int> vasum::netlink::NetlinkResponse::mNested
private
std::unique_ptr<std::vector<char> > vasum::netlink::NetlinkResponse::mNlmsg
private
nlmsghdr* vasum::netlink::NetlinkResponse::mNlmsgHdr
private
int vasum::netlink::NetlinkResponse::mPosition
private

The documentation for this class was generated from the following files: