Logo Search packages:      
Sourcecode: libnl2 version File versions  Download package

char* rtnl_tc_handle2str ( uint32_t  handle,
char *  buf,
size_t  len 
)

Convert a traffic control handle to a character string (Reentrant).

  • handle traffic control handle
  • buf destination buffer
  • len buffer length
Converts a tarffic control handle to a character string in the form of MAJ:MIN and stores it in the specified destination buffer.

Returns:
The destination buffer or the type encoded in hexidecimal form if no match was found.

Definition at line 485 of file tc.c.

{
      if (TC_H_ROOT == handle)
            snprintf(buf, len, "root");
      else if (TC_H_UNSPEC == handle)
            snprintf(buf, len, "none");
      else if (0 == TC_H_MAJ(handle))
            snprintf(buf, len, ":%02x", TC_H_MIN(handle));
      else if (0 == TC_H_MIN(handle))
            snprintf(buf, len, "%02x:", TC_H_MAJ(handle) >> 16);
      else
            snprintf(buf, len, "%02x:%02x",
                  TC_H_MAJ(handle) >> 16, TC_H_MIN(handle));

      return buf;
}


Generated by  Doxygen 1.6.0   Back to index