73 #define TABLE_SIZE(table) ((long)(sizeof(table) / sizeof(table[0]))) 112 #define LINEAR(name, strings) \ 113 static const struct linear_element name##_strings[] = { strings }; \ 114 static struct table name##_table; 115 #define STRING(string) { string, 0 }, 116 #define VSTRING(version, string) { string, version }, 117 #define NUMBERED(name, strings) \ 118 static const struct numbered_element name##_strings[] = { strings }; \ 119 static struct table name##_table; 120 #define ASSIGN(string, number) { string, number, 0 }, 121 #define VASSIGN(version, string, number) { string, number, version }, 125 #define LINEAR(name, strings) \ 126 Octstr *wsp_##name##_to_string(long number) { \ 127 return number_to_string(number, &name##_table); \ 132 #define LINEAR(name, strings) \ 133 unsigned char *wsp_##name##_to_cstr(long number) { \ 134 return number_to_cstr(number, &name##_table); \ 138 #define LINEAR(name, strings) \ 139 long wsp_string_to_##name(Octstr *ostr) { \ 140 return string_to_number(ostr, &name##_table); \ 144 #define LINEAR(name, strings) \ 145 long wsp_string_to_versioned_##name(Octstr *ostr, int version) { \ 146 return string_to_versioned_number(ostr, &name##_table, version); \ 219 debug(
"wsp.strings",0,
"WSP: Mapping `%s', WSP 1.%d to 0x%04lx.",
236 for (i = 0; i <
size; i++) {
253 for (i = 0; i <
size; i++) {
276 #define LINEAR(name, strings) \ 277 construct_linear_table(&name##_table, \ 278 name##_strings, TABLE_SIZE(name##_strings)); 279 #define NUMBERED(name, strings) \ 280 construct_numbered_table(&name##_table, \ 281 name##_strings, TABLE_SIZE(name##_strings)); 295 #define LINEAR(name, strings) \ 296 destroy_table(&name##_table);
gw_assert(wtls_machine->packet_to_send !=NULL)
static Octstr * number_to_string(long number, struct table *table)
#define octstr_get_cstr(ostr)
static void destroy_table(struct table *table)
Octstr * octstr_imm(const char *cstr)
#define octstr_duplicate(ostr)
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
static long string_to_number(Octstr *ostr, struct table *table)
static unsigned char * number_to_cstr(long number, struct table *table)
void wsp_strings_shutdown(void)
void wsp_strings_init(void)
static long string_to_versioned_number(Octstr *ostr, struct table *table, int version)
void debug(const char *place, int err, const char *fmt,...)
static void construct_linear_table(struct table *table, const struct linear_element *strings, long size)
static void construct_numbered_table(struct table *table, const struct numbered_element *strings, long size)