From c0d17f22663ba78f1620043316ac7d374ff45b86 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 7 May 2011 12:12:48 +0200 Subject: src: use namespace prefix osmo_* for misc utils Summary of changes: s/bcd2char/osmo_bcd2char/g s/char2bcd/osmo_char2bcd/g s/hexparse/osmo_hexparse/g s/hexdump/osmo_hexdump/g s/hexdump_nospc/osmo_hexdump_nospc/g s/ubit_dump/osmo_ubit_dump/g s/static_assert/osmo_static_assert/g --- openbsc/src/gprs/gprs_gmm.c | 2 +- openbsc/src/ipaccess/ipaccess-config.c | 2 +- openbsc/src/ipaccess/ipaccess-firmware.c | 4 ++-- openbsc/src/ipaccess/ipaccess-proxy.c | 6 +++--- openbsc/src/ipaccess/network_listen.c | 6 +++--- openbsc/src/libabis/e1_input.c | 14 +++++++------- openbsc/src/libabis/input/dahdi.c | 8 ++++---- openbsc/src/libabis/input/hsl.c | 4 ++-- openbsc/src/libabis/input/ipaccess.c | 4 ++-- openbsc/src/libabis/input/misdn.c | 8 ++++---- openbsc/src/libbsc/abis_nm.c | 4 ++-- openbsc/src/libbsc/abis_om2000.c | 2 +- openbsc/src/libbsc/bsc_init.c | 2 +- openbsc/src/libbsc/bsc_vty.c | 4 ++-- openbsc/src/libbsc/gsm_04_08_utils.c | 2 +- openbsc/src/libbsc/system_information.c | 18 +++++++++--------- openbsc/src/libmgcp/mgcp_protocol.c | 6 +++--- openbsc/src/libmsc/auth.c | 4 ++-- openbsc/src/libmsc/db.c | 6 +++--- openbsc/src/libmsc/gsm_04_08.c | 8 ++++---- openbsc/src/libmsc/gsm_04_11.c | 6 +++--- openbsc/src/libmsc/vty_interface_layer3.c | 10 +++++----- openbsc/src/libtrau/trau_mux.c | 2 +- openbsc/src/osmo-bsc/osmo_bsc_bssap.c | 8 ++++---- openbsc/src/osmo-bsc/osmo_bsc_msc.c | 4 ++-- openbsc/src/osmo-bsc_nat/bsc_nat.c | 4 ++-- openbsc/src/osmo-bsc_nat/bsc_ussd.c | 2 +- openbsc/src/utils/bs11_config.c | 2 +- openbsc/src/utils/rs232.c | 4 ++-- openbsc/tests/bsc-nat/bsc_nat_test.c | 8 ++++---- openbsc/tests/gsm0408/gsm0408_test.c | 4 ++-- 31 files changed, 84 insertions(+), 84 deletions(-) diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c index a49900e15..46c49318f 100644 --- a/openbsc/src/gprs/gprs_gmm.c +++ b/openbsc/src/gprs/gprs_gmm.c @@ -463,7 +463,7 @@ static int gsm48_tx_gmm_auth_ciph_req(struct sgsn_mm_ctx *mm, uint8_t *rand, uint8_t *m_rand, *m_cksn; DEBUGP(DMM, "<- GPRS AUTH AND CIPHERING REQ (rand = %s)\n", - hexdump(rand, 16)); + osmo_hexdump(rand, 16)); mmctx2msgid(msg, mm); diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c index e84892c08..af0ea00cf 100644 --- a/openbsc/src/ipaccess/ipaccess-config.c +++ b/openbsc/src/ipaccess/ipaccess-config.c @@ -129,7 +129,7 @@ static uint16_t build_physconf(uint8_t *physconf_buf, const struct rxlev_stats * num_arfcn = ipac_rxlevstat2whitelist(whitelist, st, 0, 100); arfcnlist_size = num_arfcn * 2; *((uint16_t *) (physconf_buf+2)) = htons(arfcnlist_size); - DEBUGP(DNM, "physconf_buf (%s)\n", hexdump(physconf_buf, arfcnlist_size+4)); + DEBUGP(DNM, "physconf_buf (%s)\n", osmo_hexdump(physconf_buf, arfcnlist_size+4)); return arfcnlist_size+4; } diff --git a/openbsc/src/ipaccess/ipaccess-firmware.c b/openbsc/src/ipaccess/ipaccess-firmware.c index a01e61b40..6d391075c 100644 --- a/openbsc/src/ipaccess/ipaccess-firmware.c +++ b/openbsc/src/ipaccess/ipaccess-firmware.c @@ -29,8 +29,8 @@ #define PART_LENGTH 138 -static_assert(sizeof(struct sdp_header_entry) == 138, right_entry); -static_assert(sizeof(struct sdp_firmware) == 158, _right_header_length); +osmo_static_assert(sizeof(struct sdp_header_entry) == 138, right_entry); +osmo_static_assert(sizeof(struct sdp_firmware) == 158, _right_header_length); /* more magic, the second "int" in the header */ static char more_magic[] = { 0x10, 0x02 }; diff --git a/openbsc/src/ipaccess/ipaccess-proxy.c b/openbsc/src/ipaccess/ipaccess-proxy.c index 2717ba129..bbd5e32a1 100644 --- a/openbsc/src/ipaccess/ipaccess-proxy.c +++ b/openbsc/src/ipaccess/ipaccess-proxy.c @@ -230,7 +230,7 @@ static int handle_udp_read(struct osmo_fd *bfd) } msgb_put(msg, ret); msg->l2h = msg->data + sizeof(*hh); - DEBUGP(DMI, "UDP RX: %s\n", hexdump(msg->data, msg->len)); + DEBUGP(DMI, "UDP RX: %s\n", osmo_hexdump(msg->data, msg->len)); if (hh->len != msg->len - sizeof(*hh)) { DEBUGP(DINP, "length (%u/%u) disagrees with header(%u)\n", @@ -789,7 +789,7 @@ static int handle_tcp_read(struct osmo_fd *bfd) msgb_put(msg, ret); logp_ipbc_uid(DMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8); - DEBUGPC(DMI, "RX<-%s: %s\n", btsbsc, hexdump(msg->data, msg->len)); + DEBUGPC(DMI, "RX<-%s: %s\n", btsbsc, osmo_hexdump(msg->data, msg->len)); hh = (struct ipaccess_head *) msg->data; if (hh->proto == IPAC_PROTO_IPACCESS) { @@ -861,7 +861,7 @@ static int handle_tcp_write(struct osmo_fd *bfd) logp_ipbc_uid(DMI, LOGL_DEBUG, ipbc, bfd->priv_nr >> 8); DEBUGPC(DMI, "TX %04x: %s\n", bfd->priv_nr, - hexdump(msg->data, msg->len)); + osmo_hexdump(msg->data, msg->len)); ret = send(bfd->fd, msg->data, msg->len, 0); msgb_free(msg); diff --git a/openbsc/src/ipaccess/network_listen.c b/openbsc/src/ipaccess/network_listen.c index 27d8a1d54..a719903dd 100644 --- a/openbsc/src/ipaccess/network_listen.c +++ b/openbsc/src/ipaccess/network_listen.c @@ -191,17 +191,17 @@ static int test_rep(void *_msg) last_arfcn = binfo.arfcn; } if (binfo.info_type & IPAC_BINF_NEIGH_BA_SI2) { - DEBUGP(DNM, "BA SI2: %s\n", hexdump(binfo.ba_list_si2, sizeof(binfo.ba_list_si2))); + DEBUGP(DNM, "BA SI2: %s\n", osmo_hexdump(binfo.ba_list_si2, sizeof(binfo.ba_list_si2))); gsm48_decode_freq_list(nwl_si_freq, binfo.ba_list_si2, sizeof(binfo.ba_list_si2), 0x8c, FREQ_TYPE_NCELL_2); } if (binfo.info_type & IPAC_BINF_NEIGH_BA_SI2bis) { - DEBUGP(DNM, "BA SI2bis: %s\n", hexdump(binfo.ba_list_si2bis, sizeof(binfo.ba_list_si2bis))); + DEBUGP(DNM, "BA SI2bis: %s\n", osmo_hexdump(binfo.ba_list_si2bis, sizeof(binfo.ba_list_si2bis))); gsm48_decode_freq_list(nwl_si_freq, binfo.ba_list_si2bis, sizeof(binfo.ba_list_si2bis), 0x8e, FREQ_TYPE_NCELL_2bis); } if (binfo.info_type & IPAC_BINF_NEIGH_BA_SI2ter) { - DEBUGP(DNM, "BA SI2ter: %s\n", hexdump(binfo.ba_list_si2ter, sizeof(binfo.ba_list_si2ter))); + DEBUGP(DNM, "BA SI2ter: %s\n", osmo_hexdump(binfo.ba_list_si2ter, sizeof(binfo.ba_list_si2ter))); gsm48_decode_freq_list(nwl_si_freq, binfo.ba_list_si2ter, sizeof(binfo.ba_list_si2ter), 0x8e, FREQ_TYPE_NCELL_2ter); } diff --git a/openbsc/src/libabis/e1_input.c b/openbsc/src/libabis/e1_input.c index dd3385205..089d54455 100644 --- a/openbsc/src/libabis/e1_input.c +++ b/openbsc/src/libabis/e1_input.c @@ -107,11 +107,11 @@ struct lapd_header { uint8_t control_foo; /* fake UM's ... */ } __attribute__((packed)); -static_assert(offsetof(struct fake_linux_lapd_header, hatype) == 2, hatype_offset); -static_assert(offsetof(struct fake_linux_lapd_header, halen) == 4, halen_offset); -static_assert(offsetof(struct fake_linux_lapd_header, addr) == 6, addr_offset); -static_assert(offsetof(struct fake_linux_lapd_header, protocol) == 14, proto_offset); -static_assert(sizeof(struct fake_linux_lapd_header) == 16, lapd_header_size); +osmo_static_assert(offsetof(struct fake_linux_lapd_header, hatype) == 2, hatype_offset); +osmo_static_assert(offsetof(struct fake_linux_lapd_header, halen) == 4, halen_offset); +osmo_static_assert(offsetof(struct fake_linux_lapd_header, addr) == 6, addr_offset); +osmo_static_assert(offsetof(struct fake_linux_lapd_header, protocol) == 14, proto_offset); +osmo_static_assert(sizeof(struct fake_linux_lapd_header) == 16, lapd_header_size); static int pcap_fd = -1; @@ -229,12 +229,12 @@ int abis_rsl_sendmsg(struct msgb *msg) if (!msg->trx) { LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->trx == NULL: %s\n", - hexdump(msg->data, msg->len)); + osmo_hexdump(msg->data, msg->len)); talloc_free(msg); return -EINVAL; } else if (!msg->trx->rsl_link) { LOGP(DRSL, LOGL_ERROR, "rsl_sendmsg: msg->trx->rsl_link == NULL: %s\n", - hexdump(msg->data, msg->len)); + osmo_hexdump(msg->data, msg->len)); talloc_free(msg); return -EIO; } diff --git a/openbsc/src/libabis/input/dahdi.c b/openbsc/src/libabis/input/dahdi.c index 9b85b7dbc..6f8983763 100644 --- a/openbsc/src/libabis/input/dahdi.c +++ b/openbsc/src/libabis/input/dahdi.c @@ -147,7 +147,7 @@ static int handle_ts1_read(struct osmo_fd *bfd) msg->l2h = msg->data + 2; else msg->l2h = msg->data + 1; - DEBUGP(DMI, "RX: %s\n", hexdump(msgb_l2(msg), ret)); + DEBUGP(DMI, "RX: %s\n", osmo_hexdump(msgb_l2(msg), ret)); ret = e1inp_rx_ts(e1i_ts, msg, tei, sapi); break; default: @@ -214,7 +214,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) return 0; } - DEBUGP(DMI, "TX: %s\n", hexdump(msg->data, msg->len)); + DEBUGP(DMI, "TX: %s\n", osmo_hexdump(msg->data, msg->len)); lapd_transmit(e1i_ts->driver.dahdi.lapd, sign_link->tei, sign_link->sapi, msg->data, msg->len); msgb_free(msg); @@ -277,7 +277,7 @@ static int handle_tsX_write(struct osmo_fd *bfd) } DEBUGP(DMIB, "BCHAN TX: %s\n", - hexdump(tx_buf, D_BCHAN_TX_GRAN)); + osmo_hexdump(tx_buf, D_BCHAN_TX_GRAN)); if (invertbits) { flip_buf_bits(tx_buf, ret); @@ -318,7 +318,7 @@ static int handle_tsX_read(struct osmo_fd *bfd) msg->l2h = msg->data; DEBUGP(DMIB, "BCHAN RX: %s\n", - hexdump(msgb_l2(msg), ret)); + osmo_hexdump(msgb_l2(msg), ret)); ret = e1inp_rx_ts(e1i_ts, msg, 0, 0); /* physical layer indicates that data has been sent, * we thus can send some more data */ diff --git a/openbsc/src/libabis/input/hsl.c b/openbsc/src/libabis/input/hsl.c index af95afa3b..e842f0dec 100644 --- a/openbsc/src/libabis/input/hsl.c +++ b/openbsc/src/libabis/input/hsl.c @@ -218,7 +218,7 @@ static int handle_ts1_read(struct osmo_fd *bfd) return error; } - DEBUGP(DMI, "RX %u: %s\n", ts_nr, hexdump(msgb_l2(msg), msgb_l2len(msg))); + DEBUGP(DMI, "RX %u: %s\n", ts_nr, osmo_hexdump(msgb_l2(msg), msgb_l2len(msg))); hh = (struct ipaccess_head *) msg->data; if (hh->proto == HSL_PROTO_DEBUG) { @@ -330,7 +330,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) msg->l2h = msg->data; ipaccess_prepend_header(msg, sign_link->tei); - DEBUGP(DMI, "TX %u: %s\n", ts_nr, hexdump(msg->l2h, msgb_l2len(msg))); + DEBUGP(DMI, "TX %u: %s\n", ts_nr, osmo_hexdump(msg->l2h, msgb_l2len(msg))); ret = send(bfd->fd, msg->data, msg->len, 0); msgb_free(msg); diff --git a/openbsc/src/libabis/input/ipaccess.c b/openbsc/src/libabis/input/ipaccess.c index 13294dc1f..8080129f2 100644 --- a/openbsc/src/libabis/input/ipaccess.c +++ b/openbsc/src/libabis/input/ipaccess.c @@ -509,7 +509,7 @@ static int handle_ts1_read(struct osmo_fd *bfd) return error; } - DEBUGP(DMI, "RX %u: %s\n", ts_nr, hexdump(msgb_l2(msg), msgb_l2len(msg))); + DEBUGP(DMI, "RX %u: %s\n", ts_nr, osmo_hexdump(msgb_l2(msg), msgb_l2len(msg))); hh = (struct ipaccess_head *) msg->data; if (hh->proto == IPAC_PROTO_IPACCESS) { @@ -623,7 +623,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) msg->l2h = msg->data; ipaccess_prepend_header(msg, sign_link->tei); - DEBUGP(DMI, "TX %u: %s\n", ts_nr, hexdump(msg->l2h, msgb_l2len(msg))); + DEBUGP(DMI, "TX %u: %s\n", ts_nr, osmo_hexdump(msg->l2h, msgb_l2len(msg))); ret = send(bfd->fd, msg->data, msg->len, 0); msgb_free(msg); diff --git a/openbsc/src/libabis/input/misdn.c b/openbsc/src/libabis/input/misdn.c index d239ee75c..ab92d612f 100644 --- a/openbsc/src/libabis/input/misdn.c +++ b/openbsc/src/libabis/input/misdn.c @@ -162,7 +162,7 @@ static int handle_ts1_read(struct osmo_fd *bfd) case DL_DATA_IND: case DL_UNITDATA_IND: msg->l2h = msg->data + MISDN_HEADER_LEN; - DEBUGP(DMI, "RX: %s\n", hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN)); + DEBUGP(DMI, "RX: %s\n", osmo_hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN)); ret = e1inp_rx_ts(e1i_ts, msg, l2addr.tei, l2addr.sapi); break; case PH_ACTIVATE_IND: @@ -229,7 +229,7 @@ static int handle_ts1_write(struct osmo_fd *bfd) DEBUGP(DMI, "TX channel(%d) TEI(%d) SAPI(%d): %s\n", sign_link->driver.misdn.channel, sign_link->tei, - sign_link->sapi, hexdump(l2_data, msg->len - MISDN_HEADER_LEN)); + sign_link->sapi, osmo_hexdump(l2_data, msg->len - MISDN_HEADER_LEN)); /* construct the sockaddr */ sa.family = AF_ISDN; @@ -269,7 +269,7 @@ static int handle_tsX_write(struct osmo_fd *bfd) subchan_mux_out(mx, tx_buf+sizeof(*hh), BCHAN_TX_GRAN); DEBUGP(DMIB, "BCHAN TX: %s\n", - hexdump(tx_buf+sizeof(*hh), BCHAN_TX_GRAN)); + osmo_hexdump(tx_buf+sizeof(*hh), BCHAN_TX_GRAN)); ret = send(bfd->fd, tx_buf, sizeof(*hh) + BCHAN_TX_GRAN, 0); if (ret < sizeof(*hh) + BCHAN_TX_GRAN) @@ -311,7 +311,7 @@ static int handle_tsX_read(struct osmo_fd *bfd) case PH_DATA_IND: msg->l2h = msg->data + MISDN_HEADER_LEN; DEBUGP(DMIB, "BCHAN RX: %s\n", - hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN)); + osmo_hexdump(msgb_l2(msg), ret - MISDN_HEADER_LEN)); ret = e1inp_rx_ts(e1i_ts, msg, 0, 0); break; case PH_ACTIVATE_IND: diff --git a/openbsc/src/libbsc/abis_nm.c b/openbsc/src/libbsc/abis_nm.c index 6ca45f7d7..0d122c697 100644 --- a/openbsc/src/libbsc/abis_nm.c +++ b/openbsc/src/libbsc/abis_nm.c @@ -934,7 +934,7 @@ static int abis_nm_rx_sw_act_req(struct msgb *mb) DEBUGP(DNM, "SW config not found! Can't continue.\n"); return -EINVAL; } else { - DEBUGP(DNM, "Found SW config: %s\n", hexdump(sw_config, sw_config_len)); + DEBUGP(DNM, "Found SW config: %s\n", osmo_hexdump(sw_config, sw_config_len)); } /* Use the first SW_DESCR present in SW config */ @@ -1325,7 +1325,7 @@ static int sw_load_segment(struct abis_nm_sw *sw) len = strlen(line_buf)+2; break; case GSM_BTS_TYPE_NANOBTS: { - static_assert(sizeof(seg_buf) >= IPACC_SEGMENT_SIZE, buffer_big_enough); + osmo_static_assert(sizeof(seg_buf) >= IPACC_SEGMENT_SIZE, buffer_big_enough); len = read(sw->fd, &seg_buf, IPACC_SEGMENT_SIZE); if (len < 0) { perror("read failed"); diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c index 19d204212..fd3cf1fe3 100644 --- a/openbsc/src/libbsc/abis_om2000.c +++ b/openbsc/src/libbsc/abis_om2000.c @@ -1492,7 +1492,7 @@ int abis_om2k_rcvmsg(struct msgb *msg) DEBUGP(DNM, "Rx MO=%s %s (%s)\n", om2k_mo_name(&o2h->mo), get_value_string(om2k_msgcode_vals, msg_type), - hexdump(msg->l2h, msgb_l2len(msg))); + osmo_hexdump(msg->l2h, msgb_l2len(msg))); switch (msg_type) { case OM2K_MSGT_CAL_TIME_REQ: diff --git a/openbsc/src/libbsc/bsc_init.c b/openbsc/src/libbsc/bsc_init.c index 8e62dacc0..c173c626d 100644 --- a/openbsc/src/libbsc/bsc_init.c +++ b/openbsc/src/libbsc/bsc_init.c @@ -102,7 +102,7 @@ static int generate_and_rsl_si(struct gsm_bts_trx *trx, enum osmo_sysinfo_type i } DEBUGP(DRR, "SI%s: %s\n", gsm_sitype_name(i), - hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN)); + osmo_hexdump(GSM_BTS_SI(bts, i), GSM_MACBLOCK_LEN)); switch (i) { case SYSINFO_TYPE_5: diff --git a/openbsc/src/libbsc/bsc_vty.c b/openbsc/src/libbsc/bsc_vty.c index 4cd027f09..12f9ffd9f 100644 --- a/openbsc/src/libbsc/bsc_vty.c +++ b/openbsc/src/libbsc/bsc_vty.c @@ -495,7 +495,7 @@ static void config_write_bts_single(struct vty *vty, struct gsm_bts *bts) get_value_string(osmo_sitype_strs, i), VTY_NEWLINE); vty_out(vty, " system-information %s static %s%s", get_value_string(osmo_sitype_strs, i), - hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])), + osmo_osmo_hexdump_nospc(bts->si_buf[i], sizeof(bts->si_buf[i])), VTY_NEWLINE); } } @@ -2171,7 +2171,7 @@ DEFUN(cfg_bts_si_static, cfg_bts_si_static_cmd, memset(bts->si_buf[type], 0x2b, sizeof(bts->si_buf[type])); /* Parse the user-specified SI in hex format, [partially] overwriting padding */ - rc = hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0])); + rc = osmo_hexparse(argv[1], bts->si_buf[type], sizeof(bts->si_buf[0])); if (rc < 0 || rc > sizeof(bts->si_buf[0])) { vty_out(vty, "Error parsing HEXSTRING%s", VTY_NEWLINE); return CMD_WARNING; diff --git a/openbsc/src/libbsc/gsm_04_08_utils.c b/openbsc/src/libbsc/gsm_04_08_utils.c index 7599cea0b..4d8bdc604 100644 --- a/openbsc/src/libbsc/gsm_04_08_utils.c +++ b/openbsc/src/libbsc/gsm_04_08_utils.c @@ -134,7 +134,7 @@ static const enum gsm_chreq_reason_t reason_by_chreq[] = { }; /* verify that the two tables match */ -static_assert(sizeof(ctype_by_chreq) == +osmo_static_assert(sizeof(ctype_by_chreq) == sizeof(((struct gsm_network *) NULL)->ctype_by_chreq), assert_size); /* diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 3291bff10..926a490c7 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -39,18 +39,18 @@ /* verify the sizes of the system information type structs */ /* rest octets are not part of the struct */ -static_assert(sizeof(struct gsm48_system_information_type_header) == 3, _si_header_size); -static_assert(sizeof(struct gsm48_rach_control) == 3, _si_rach_control); -static_assert(sizeof(struct gsm48_system_information_type_1) == 22, _si1_size); -static_assert(sizeof(struct gsm48_system_information_type_2) == 23, _si2_size); -static_assert(sizeof(struct gsm48_system_information_type_3) == 19, _si3_size); -static_assert(sizeof(struct gsm48_system_information_type_4) == 13, _si4_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_header) == 3, _si_header_size); +osmo_static_assert(sizeof(struct gsm48_rach_control) == 3, _si_rach_control); +osmo_static_assert(sizeof(struct gsm48_system_information_type_1) == 22, _si1_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_2) == 23, _si2_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_3) == 19, _si3_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_4) == 13, _si4_size); /* bs11 forgot the l2 len, 0-6 rest octets */ -static_assert(sizeof(struct gsm48_system_information_type_5) == 18, _si5_size); -static_assert(sizeof(struct gsm48_system_information_type_6) == 11, _si6_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_5) == 18, _si5_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_6) == 11, _si6_size); -static_assert(sizeof(struct gsm48_system_information_type_13) == 3, _si13_size); +osmo_static_assert(sizeof(struct gsm48_system_information_type_13) == 3, _si13_size); /* Frequency Lists as per TS 04.08 10.5.2.13 */ diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index bca4b31fd..1d26850ba 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -604,7 +604,7 @@ static struct msgb *handle_create_con(struct mgcp_config *cfg, struct msgb *msg) return create_response_with_sdp(endp, "CRCX", trans_id); error: LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d\n", - hexdump(msg->l3h, msgb_l3len(msg)), + osmo_hexdump(msg->l3h, msgb_l3len(msg)), ENDPOINT_NUMBER(endp), line_start, i); return create_err_response(error_code, "CRCX", trans_id); @@ -729,7 +729,7 @@ static struct msgb *handle_modify_con(struct mgcp_config *cfg, struct msgb *msg) error: LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d %d\n", - hexdump(msg->l3h, msgb_l3len(msg)), + osmo_hexdump(msg->l3h, msgb_l3len(msg)), ENDPOINT_NUMBER(endp), line_start, i, msg->l3h[line_start]); return create_err_response(error_code, "MDCX", trans_id); @@ -818,7 +818,7 @@ static struct msgb *handle_delete_con(struct mgcp_config *cfg, struct msgb *msg) error: LOGP(DMGCP, LOGL_ERROR, "Malformed line: %s on 0x%x with: line_start: %d %d\n", - hexdump(msg->l3h, msgb_l3len(msg)), + osmo_hexdump(msg->l3h, msgb_l3len(msg)), ENDPOINT_NUMBER(endp), line_start, i); return create_err_response(error_code, "DLCX", trans_id); diff --git a/openbsc/src/libmsc/auth.c b/openbsc/src/libmsc/auth.c index 1683a5f9f..10d8edf67 100644 --- a/openbsc/src/libmsc/auth.c +++ b/openbsc/src/libmsc/auth.c @@ -38,7 +38,7 @@ _use_xor(struct gsm_auth_info *ainfo, struct gsm_auth_tuple *atuple) if ((l > A38_XOR_MAX_KEY_LEN) || (l < A38_XOR_MIN_KEY_LEN)) { LOGP(DMM, LOGL_ERROR, "Invalid XOR key (len=%d) %s\n", ainfo->a3a8_ki_len, - hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len)); + osmo_hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len)); return -1; } @@ -56,7 +56,7 @@ _use_comp128_v1(struct gsm_auth_info *ainfo, struct gsm_auth_tuple *atuple) if (ainfo->a3a8_ki_len != A38_COMP128_KEY_LEN) { LOGP(DMM, LOGL_ERROR, "Invalid COMP128v1 key (len=%d) %s\n", ainfo->a3a8_ki_len, - hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len)); + osmo_hexdump(ainfo->a3a8_ki, ainfo->a3a8_ki_len)); return -1; } diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index d25bc21be..1ddd3fdf4 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -297,7 +297,7 @@ struct gsm_subscriber *db_create_subscriber(struct gsm_network *net, char *imsi) return subscr; } -static_assert(sizeof(unsigned char) == sizeof(struct gsm48_classmark1), classmark1_size); +osmo_static_assert(sizeof(unsigned char) == sizeof(struct gsm48_classmark1), classmark1_size); static int get_equipment_by_subscr(struct gsm_subscriber *subscr) { @@ -744,10 +744,10 @@ int db_sync_equipment(struct gsm_equipment *equip) equip->imei, classmark1); if (equip->classmark2_len) DEBUGPC(DDB, ", classmark2=%s", - hexdump(equip->classmark2, equip->classmark2_len)); + osmo_hexdump(equip->classmark2, equip->classmark2_len)); if (equip->classmark3_len) DEBUGPC(DDB, ", classmark3=%s", - hexdump(equip->classmark3, equip->classmark3_len)); + osmo_hexdump(equip->classmark3, equip->classmark3_len)); DEBUGPC(DDB, "\n"); dbi_conn_quote_binary_copy(conn, equip->classmark2, diff --git a/openbsc/src/libmsc/gsm_04_08.c b/openbsc/src/libmsc/gsm_04_08.c index 6486b19f6..a6ed3e83e 100644 --- a/openbsc/src/libmsc/gsm_04_08.c +++ b/openbsc/src/libmsc/gsm_04_08.c @@ -720,7 +720,7 @@ int gsm48_tx_mm_auth_req(struct gsm_subscriber_connection *conn, uint8_t *rand, struct gsm48_hdr *gh = (struct gsm48_hdr *) msgb_put(msg, sizeof(*gh)); struct gsm48_auth_req *ar = (struct gsm48_auth_req *) msgb_put(msg, sizeof(*ar)); - DEBUGP(DMM, "-> AUTH REQ (rand = %s)\n", hexdump(rand, 16)); + DEBUGP(DMM, "-> AUTH REQ (rand = %s)\n", osmo_hexdump(rand, 16)); msg->lchan = conn->lchan; gh->proto_discr = GSM48_PDISC_MM; @@ -942,7 +942,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct struct gsm_network *net = conn->bts->network; DEBUGP(DMM, "MM AUTHENTICATION RESPONSE (sres = %s): ", - hexdump(ar->sres, 4)); + osmo_hexdump(ar->sres, 4)); /* Safety check */ if (!conn->sec_operation) { @@ -956,7 +956,7 @@ static int gsm48_rx_mm_auth_resp(struct gsm_subscriber_connection *conn, struct gsm_cbfn *cb = conn->sec_operation->cb; DEBUGPC(DMM, "Invalid (expected %s)\n", - hexdump(conn->sec_operation->atuple.sres, 4)); + osmo_hexdump(conn->sec_operation->atuple.sres, 4)); if (cb) cb(GSM_HOOK_RR_SECURITY, GSM_SECURITY_AUTH_FAILED, @@ -1145,7 +1145,7 @@ static int gsm48_rx_rr_app_info(struct gsm_subscriber_connection *conn, struct m apdu_data = gh->data+2; DEBUGP(DNM, "RX APPLICATION INFO id/flags=0x%02x apdu_len=%u apdu=%s", - apdu_id_flags, apdu_len, hexdump(apdu_data, apdu_len)); + apdu_id_flags, apdu_len, osmo_hexdump(apdu_data, apdu_len)); return db_apdu_blob_store(conn->subscr, apdu_id_flags, apdu_len, apdu_data); } diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c index 5069be7bf..ba72c37bd 100644 --- a/openbsc/src/libmsc/gsm_04_11.c +++ b/openbsc/src/libmsc/gsm_04_11.c @@ -175,7 +175,7 @@ struct msgb *gsm411_msgb_alloc(void) static int gsm411_sendmsg(struct gsm_subscriber_connection *conn, struct msgb *msg, uint8_t link_id) { - DEBUGP(DSMS, "GSM4.11 TX %s\n", hexdump(msg->data, msg->len)); + DEBUGP(DSMS, "GSM4.11 TX %s\n", osmo_hexdump(msg->data, msg->len)); msg->l3h = msg->data; return gsm0808_submit_dtap(conn, msg, link_id, 1); } @@ -645,7 +645,7 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m gsms->protocol_id, gsms->data_coding_scheme, gsms->dest_addr, gsms->user_data_len, sms_alphabet == DCS_7BIT_DEFAULT ? gsms->text : - hexdump(gsms->user_data, gsms->user_data_len)); + osmo_hexdump(gsms->user_data, gsms->user_data_len)); gsms->validity_minutes = gsm340_validity_period(sms_vpf, sms_vp); @@ -728,7 +728,7 @@ static int gsm411_rx_rp_ud(struct msgb *msg, struct gsm_trans *trans, } msg->l4h = tpdu; - DEBUGP(DSMS, "DST(%u,%s)\n", dst_len, hexdump(dst, dst_len)); + DEBUGP(DSMS, "DST(%u,%s)\n", dst_len, osmo_hexdump(dst, dst_len)); rc = gsm340_rx_tpdu(trans->conn, msg); if (rc == 0) diff --git a/openbsc/src/libmsc/vty_interface_layer3.c b/openbsc/src/libmsc/vty_interface_layer3.c index f75155558..f31f05b1c 100644 --- a/openbsc/src/libmsc/vty_interface_layer3.c +++ b/openbsc/src/libmsc/vty_interface_layer3.c @@ -74,7 +74,7 @@ static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr, vty_out(vty, " A3A8 algorithm id: %d%s", ainfo.auth_algo, VTY_NEWLINE); vty_out(vty, " A3A8 Ki: %s%s", - hexdump(ainfo.a3a8_ki, ainfo.a3a8_ki_len), + osmo_hexdump(ainfo.a3a8_ki, ainfo.a3a8_ki_len), VTY_NEWLINE); } @@ -85,13 +85,13 @@ static void subscr_dump_full_vty(struct vty *vty, struct gsm_subscriber *subscr, vty_out(vty, " seq # : %d%s", atuple.key_seq, VTY_NEWLINE); vty_out(vty, " RAND : %s%s", - hexdump(atuple.rand, sizeof(atuple.rand)), + osmo_hexdump(atuple.rand, sizeof(atuple.rand)), VTY_NEWLINE); vty_out(vty, " SRES : %s%s", - hexdump(atuple.sres, sizeof(atuple.sres)), + osmo_hexdump(atuple.sres, sizeof(atuple.sres)), VTY_NEWLINE); vty_out(vty, " Kc : %s%s", - hexdump(atuple.kc, sizeof(atuple.kc)), + osmo_hexdump(atuple.kc, sizeof(atuple.kc)), VTY_NEWLINE); } if (pending) @@ -581,7 +581,7 @@ DEFUN(ena_subscr_a3a8, } if (ki_str) { - rc = hexparse(ki_str, ainfo.a3a8_ki, sizeof(ainfo.a3a8_ki)); + rc = osmo_hexparse(ki_str, ainfo.a3a8_ki, sizeof(ainfo.a3a8_ki)); if ((rc > maxlen) || (rc < minlen)) { subscr_put(subscr); vty_out(vty, "%% Wrong Ki `%s'%s", diff --git a/openbsc/src/libtrau/trau_mux.c b/openbsc/src/libtrau/trau_mux.c index b1fd81d79..b8b90bd02 100644 --- a/openbsc/src/libtrau/trau_mux.c +++ b/openbsc/src/libtrau/trau_mux.c @@ -185,7 +185,7 @@ int trau_mux_input(struct gsm_e1_subslot *src_e1_ss, return -EINVAL; if (memcmp(tf.c_bits, c_bits_check, sizeof(c_bits_check))) DEBUGPC(DMUX, "illegal trau (C1-C5) %s\n", - hexdump(tf.c_bits, sizeof(c_bits_check))); + osmo_hexdump(tf.c_bits, sizeof(c_bits_check))); msg = msgb_alloc(sizeof(struct gsm_data_frame) + 33, "GSM-DATA"); if (!msg) diff --git a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c index 5046d8c22..a3ba2adc5 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_bssap.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_bssap.c @@ -158,7 +158,7 @@ static int bssmap_handle_paging(struct gsm_network *net, if (data_length == 3 && data[0] == CELL_IDENT_LAC) { lac = ntohs(read_data16(&data[1])); } else if (data_length > 1 || (data[0] & 0x0f) != CELL_IDENT_BSS) { - LOGP(DMSC, LOGL_ERROR, "Unsupported Cell Identifier List: %s\n", hexdump(data, data_length)); + LOGP(DMSC, LOGL_ERROR, "Unsupported Cell Identifier List: %s\n", osmo_hexdump(data, data_length)); return -1; } @@ -467,13 +467,13 @@ static int dtap_rcvmsg(struct osmo_bsc_sccp_con *conn, header = (struct dtap_header *) msg->l3h; if (sizeof(*header) >= length) { LOGP(DMSC, LOGL_ERROR, "The DTAP header does not fit. Wanted: %u got: %u\n", sizeof(*header), length); - LOGP(DMSC, LOGL_ERROR, "hex: %s\n", hexdump(msg->l3h, length)); + LOGP(DMSC, LOGL_ERROR, "hex: %s\n", osmo_hexdump(msg->l3h, length)); return -1; } if (header->length > length - sizeof(*header)) { LOGP(DMSC, LOGL_ERROR, "The DTAP l4 information does not fit: header: %u length: %u\n", header->length, length); - LOGP(DMSC, LOGL_ERROR, "hex: %s\n", hexdump(msg->l3h, length)); + LOGP(DMSC, LOGL_ERROR, "hex: %s\n", osmo_hexdump(msg->l3h, length)); return -1; } @@ -502,7 +502,7 @@ int bsc_handle_udt(struct gsm_network *network, struct bssmap_header *bs; LOGP(DMSC, LOGL_DEBUG, "Incoming SCCP message ftom MSC: %s\n", - hexdump(msgb->l3h, length)); + osmo_hexdump(msgb->l3h, length)); if (length < sizeof(*bs)) { LOGP(DMSC, LOGL_ERROR, "The header is too short.\n"); diff --git a/openbsc/src/osmo-bsc/osmo_bsc_msc.c b/openbsc/src/osmo-bsc/osmo_bsc_msc.c index 6ea8c4f5b..2a322271d 100644 --- a/openbsc/src/osmo-bsc/osmo_bsc_msc.c +++ b/openbsc/src/osmo-bsc/osmo_bsc_msc.c @@ -180,7 +180,7 @@ static int msc_alink_do_write(struct osmo_fd *fd, struct msgb *msg) int ret; LOGP(DMSC, LOGL_DEBUG, "Sending SCCP to MSC: %u\n", msgb_l2len(msg)); - LOGP(DMI, LOGL_DEBUG, "MSC TX %s\n", hexdump(msg->data, msg->len)); + LOGP(DMI, LOGL_DEBUG, "MSC TX %s\n", osmo_hexdump(msg->data, msg->len)); ret = write(fd->fd, msg->data, msg->len); if (ret < msg->len) @@ -226,7 +226,7 @@ static int ipaccess_a_fd_cb(struct osmo_fd *bfd) return -1; } - LOGP(DMSC, LOGL_DEBUG, "From MSC: %s proto: %d\n", hexdump(msg->data, msg->len), msg->l2h[0]); + LOGP(DMSC, LOGL_DEBUG, "From MSC: %s proto: %d\n", osmo_hexdump(msg->data, msg->len), msg->l2h[0]); /* handle base message handling */ hh = (struct ipaccess_head *) msg->data; diff --git a/openbsc/src/osmo-bsc_nat/bsc_nat.c b/openbsc/src/osmo-bsc_nat/bsc_nat.c index 5df4cd8a1..d97416f2a 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_nat.c +++ b/openbsc/src/osmo-bsc_nat/bsc_nat.c @@ -799,7 +799,7 @@ static int ipaccess_msc_read_cb(struct osmo_fd *bfd) return -1; } - LOGP(DNAT, LOGL_DEBUG, "MSG from MSC: %s proto: %d\n", hexdump(msg->data, msg->len), msg->l2h[0]); + LOGP(DNAT, LOGL_DEBUG, "MSG from MSC: %s proto: %d\n", osmo_hexdump(msg->data, msg->len), msg->l2h[0]); /* handle base message handling */ hh = (struct ipaccess_head *) msg->data; @@ -1169,7 +1169,7 @@ static int ipaccess_bsc_read_cb(struct osmo_fd *bfd) } - LOGP(DNAT, LOGL_DEBUG, "MSG from BSC: %s proto: %d\n", hexdump(msg->data, msg->len), msg->l2h[0]); + LOGP(DNAT, LOGL_DEBUG, "MSG from BSC: %s proto: %d\n", osmo_hexdump(msg->data, msg->len), msg->l2h[0]); /* Handle messages from the BSC */ hh = (struct ipaccess_head *) msg->data; diff --git a/openbsc/src/osmo-bsc_nat/bsc_ussd.c b/openbsc/src/osmo-bsc_nat/bsc_ussd.c index a6fcffcca..bbbeead9a 100644 --- a/openbsc/src/osmo-bsc_nat/bsc_ussd.c +++ b/openbsc/src/osmo-bsc_nat/bsc_ussd.c @@ -109,7 +109,7 @@ static int ussd_read_cb(struct osmo_fd *bfd) } LOGP(DNAT, LOGL_NOTICE, "MSG from USSD: %s proto: %d\n", - hexdump(msg->data, msg->len), msg->l2h[0]); + osmo_hexdump(msg->data, msg->len), msg->l2h[0]); hh = (struct ipaccess_head *) msg->data; if (hh->proto == IPAC_PROTO_IPACCESS) { diff --git a/openbsc/src/utils/bs11_config.c b/openbsc/src/utils/bs11_config.c index 6e821266d..878d02a71 100644 --- a/openbsc/src/utils/bs11_config.c +++ b/openbsc/src/utils/bs11_config.c @@ -688,7 +688,7 @@ int handle_serial_msg(struct msgb *rx_msg) printf("\n%sATTRIBUTES:\n", obj_name(foh)); abis_nm_tlv_parse(&tp, g_bts, foh->data, oh->length-sizeof(*foh)); rc = print_attr(&tp); - //hexdump(foh->data, oh->length-sizeof(*foh)); + //osmo_hexdump(foh->data, oh->length-sizeof(*foh)); break; case NM_MT_BS11_SET_ATTR_ACK: printf("SET ATTRIBUTE ObjClass=0x%02x ObjInst=(%d,%d,%d) ACK\n", diff --git a/openbsc/src/utils/rs232.c b/openbsc/src/utils/rs232.c index b322e8aba..4e35cb06a 100644 --- a/openbsc/src/utils/rs232.c +++ b/openbsc/src/utils/rs232.c @@ -100,7 +100,7 @@ static int handle_ser_write(struct osmo_fd *bfd) return 0; } - DEBUGP(DMI, "RS232 TX: %s\n", hexdump(msg->data, msg->len)); + DEBUGP(DMI, "RS232 TX: %s\n", osmo_hexdump(msg->data, msg->len)); /* send over serial line */ written = write(bfd->fd, msg->data, msg->len); @@ -173,7 +173,7 @@ static int handle_ser_read(struct osmo_fd *bfd) if (msg->len > LAPD_HDR_LEN) msg->l2h = msg->data + LAPD_HDR_LEN; - DEBUGP(DMI, "RS232 RX: %s\n", hexdump(msg->data, msg->len)); + DEBUGP(DMI, "RS232 RX: %s\n", osmo_hexdump(msg->data, msg->len)); rc = handle_serial_msg(msg); } } diff --git a/openbsc/tests/bsc-nat/bsc_nat_test.c b/openbsc/tests/bsc-nat/bsc_nat_test.c index 8c0abc262..ec3a532f5 100644 --- a/openbsc/tests/bsc-nat/bsc_nat_test.c +++ b/openbsc/tests/bsc-nat/bsc_nat_test.c @@ -489,7 +489,7 @@ static void test_mgcp_ass_tracking(void) if (msg->l2h[16] != 0 || msg->l2h[17] != 0x1) { fprintf(stderr, "Input is not as expected.. %s 0x%x\n", - hexdump(msg->l2h, msgb_l2len(msg)), + osmo_hexdump(msg->l2h, msgb_l2len(msg)), msg->l2h[17]); abort(); } @@ -519,7 +519,7 @@ static void test_mgcp_ass_tracking(void) uint16_t cic = htons(timeslot & 0x1f); if (memcmp(&cic, &msg->l2h[16], sizeof(cic)) != 0) { fprintf(stderr, "Message was not patched properly\n"); - fprintf(stderr, "data cic: 0x%x %s\n", cic, hexdump(msg->l2h, msgb_l2len(msg))); + fprintf(stderr, "data cic: 0x%x %s\n", cic, osmo_hexdump(msg->l2h, msgb_l2len(msg))); abort(); } @@ -908,7 +908,7 @@ static void test_setup_rewrite() if (memcmp(cc_setup_national_patched, out->data, out->len) != 0) { fprintf(stderr, "FAIL: Data is wrong.\n"); - fprintf(stderr, "Data was: %s\n", hexdump(out->data, out->len)); + fprintf(stderr, "Data was: %s\n", osmo_hexdump(out->data, out->len)); abort(); } @@ -942,7 +942,7 @@ static void test_setup_rewrite() if (memcmp(cc_setup_national_patched, out->data, out->len) != 0) { fprintf(stderr, "FAIL: Data is wrong.\n"); - fprintf(stderr, "Data was: %s\n", hexdump(out->data, out->len)); + fprintf(stderr, "Data was: %s\n", osmo_hexdump(out->data, out->len)); abort(); } diff --git a/openbsc/tests/gsm0408/gsm0408_test.c b/openbsc/tests/gsm0408/gsm0408_test.c index 46e93b838..679ce664f 100644 --- a/openbsc/tests/gsm0408/gsm0408_test.c +++ b/openbsc/tests/gsm0408/gsm0408_test.c @@ -85,12 +85,12 @@ static void test_mi_functionality(void) /* imsi code */ mi_len = gsm48_generate_mid_from_imsi(mi, imsi_odd); gsm48_mi_to_string(mi_parsed, sizeof(mi_parsed), mi + 2, mi_len -2); - printf("hex: %s\n", hexdump(mi, mi_len)); + printf("hex: %s\n", osmo_hexdump(mi, mi_len)); COMPARE_STR(mi_parsed, imsi_odd); mi_len = gsm48_generate_mid_from_imsi(mi, imsi_even); gsm48_mi_to_string(mi_parsed, sizeof(mi_parsed), mi + 2, mi_len -2); - printf("hex: %s\n", hexdump(mi, mi_len)); + printf("hex: %s\n", osmo_hexdump(mi, mi_len)); COMPARE_STR(mi_parsed, imsi_even); } -- cgit v1.2.3