/**
 * Copyright (C) 2007 iptego GmbH
 *
 * This file is part of ser, a free SIP server.
 *
 * ser is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version
 *
 * ser is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __ASI_TID_H__
#define __ASI_TID_H__

#include "ut.h"

inline static str *tid2str(unsigned int h_index, unsigned int h_label)
{
	static char buff[2 * INT2STR_MAX_LEN + /* `:' */1 + /* 0-term */1];
	static str tid_str = {buff, sizeof(buff)};
	char *cursor, *intstr;
	int num_len;

	cursor = buff;
	intstr = int2str(h_index, &num_len);
	memcpy(cursor, intstr, num_len); cursor += num_len;
	cursor[0] = ':'; cursor += 1;
	intstr = int2str(h_label, &num_len);
	memcpy(cursor, intstr, num_len); cursor += num_len;
	cursor[0] = 0; cursor += 1;

	tid_str.len = cursor - buff;
	return &tid_str;
}

#endif /* __ASI_TID_H__ */
