/* Convert a traffic control handle to a character string (Reentrant).  */
char* rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len)
/* Convert a traffic control handle to a character string (Reentrant).  */
char* rtnl_tc_handle2str(uint32_t handle, char *buf, size_t len)
{
	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;
}