Add osmo_ss7_pointcode_print_buf() to API

Like osmo_ss7_pointcode_print(), but prints into an user-supplied
buffer.

Change-Id: I5fc7d7746eb90a9d404b6b50bf9ded6789a1c33c
This commit is contained in:
Harald Welte 2021-02-07 12:48:51 +01:00
parent d7ecf7a150
commit 7eedb6b03c
2 changed files with 4 additions and 3 deletions

View File

@ -24,6 +24,7 @@ int osmo_ss7_find_free_rctx(struct osmo_ss7_instance *inst);
bool osmo_ss7_pc_is_local(struct osmo_ss7_instance *inst, uint32_t pc);
int osmo_ss7_pointcode_parse(struct osmo_ss7_instance *inst, const char *str);
int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in);
const char *osmo_ss7_pointcode_print_buf(char *buf, size_t buf_len, const struct osmo_ss7_instance *inst, uint32_t pc);
const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc);
const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc);

View File

@ -260,7 +260,7 @@ err:
return -EINVAL;
}
const char *_osmo_ss7_pointcode_print(char *buf, size_t len, const struct osmo_ss7_instance *inst, uint32_t pc)
const char *osmo_ss7_pointcode_print_buf(char *buf, size_t len, const struct osmo_ss7_instance *inst, uint32_t pc)
{
const struct osmo_ss7_pc_fmt *pc_fmt;
unsigned int num_comp_exp;
@ -287,7 +287,7 @@ const char *_osmo_ss7_pointcode_print(char *buf, size_t len, const struct osmo_s
const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint32_t pc)
{
static char buf[MAX_PC_STR_LEN];
return _osmo_ss7_pointcode_print(buf, sizeof(buf), inst, pc);
return osmo_ss7_pointcode_print_buf(buf, sizeof(buf), inst, pc);
}
/* same as osmo_ss7_pointcode_print() but using a separate buffer, useful for multiple point codes in the
@ -295,7 +295,7 @@ const char *osmo_ss7_pointcode_print(const struct osmo_ss7_instance *inst, uint3
const char *osmo_ss7_pointcode_print2(const struct osmo_ss7_instance *inst, uint32_t pc)
{
static char buf[MAX_PC_STR_LEN];
return _osmo_ss7_pointcode_print(buf, sizeof(buf), inst, pc);
return osmo_ss7_pointcode_print_buf(buf, sizeof(buf), inst, pc);
}
int osmo_ss7_pointcode_parse_mask_or_len(struct osmo_ss7_instance *inst, const char *in)