Merge commit 'b8d18f32a1676f05d73bc9d94eadeaf5cc43c9a5'

This commit is contained in:
Sylvain Munaut 2012-10-14 19:02:15 +02:00
commit a4924a33b0
20 changed files with 440 additions and 93 deletions

View File

@ -31,6 +31,16 @@ Doxyfile.gsm
Doxyfile.vty
Doxyfile.codec
debian/autoreconf.after
debian/autoreconf.before
debian/files
debian/libosmocore-dev/
debian/libosmocore*.log
debian/tmp/
debian/libosmocore*.substvars
debian/libosmocore/
debian/libosmocore.post*.debhelper
.tarball-version
.version
@ -55,6 +65,9 @@ tests/auth/milenage_test
tests/conv/conv_test
tests/lapd/lapd_test
tests/gsm0808/gsm0808_test
tests/gb/bssgp_fc_test
tests/gsm0408/gsm0408_test
tests/logging/logging_test
utils/osmo-arfcn
utils/osmo-auc-gen

View File

@ -1 +1,2 @@
usr/lib/lib*.so.*
usr/share/doc/libosmocore/*

View File

@ -31,6 +31,7 @@ nobase_include_HEADERS = \
osmocom/crypt/auth.h \
osmocom/crypt/gprs_cipher.h \
osmocom/gprs/gprs_bssgp.h \
osmocom/gprs/gprs_bssgp_bss.h \
osmocom/gprs/gprs_msgb.h \
osmocom/gprs/gprs_ns.h \
osmocom/gprs/gprs_ns_frgre.h \
@ -99,5 +100,5 @@ endif
noinst_HEADERS = osmocom/core/timer_compat.h
osmocom/core/crc%gen.h: osmocom/core/crcXXgen.h.tpl
$(AM_V_GEN)$(MKDIR_P) $(notdir $@)
$(AM_V_GEN)$(MKDIR_P) $(dir $@)
$(AM_V_GEN)sed -e's/XX/$*/g' $< > $@

View File

@ -101,7 +101,7 @@ struct log_info {
log_filter *filter_fn;
/*! \brief per-category information */
struct log_info_cat *cat;
const struct log_info_cat *cat;
/*! \brief total number of categories */
unsigned int num_cat;
/*! \brief total number of user categories (not library) */
@ -134,6 +134,8 @@ struct log_target {
unsigned int use_color:1;
/*! \brief should log messages be prefixed with a timestamp? */
unsigned int print_timestamp:1;
/*! \brief should log messages be prefixed with a filename? */
unsigned int print_filename:1;
/*! \brief the type of this log taget */
enum log_target_type type;
@ -179,6 +181,7 @@ void log_set_all_filter(struct log_target *target, int);
void log_set_use_color(struct log_target *target, int);
void log_set_print_timestamp(struct log_target *target, int);
void log_set_print_filename(struct log_target *target, int);
void log_set_log_level(struct log_target *target, int log_level);
void log_parse_category_mask(struct log_target *target, const char* mask);
int log_parse_level(const char *lvl);

View File

@ -0,0 +1,75 @@
#ifndef _BSSGP_BSS_H
#define _BSSGP_BSS_H
#include <osmocom/core/msgb.h>
#include <osmocom/gprs/gprs_bssgp.h>
/* GPRS BSSGP protocol implementation as per 3GPP TS 08.18 */
/* (C) 2009-2012 by Harald Welte <laforge@gnumonks.org>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
uint8_t *bssgp_msgb_tlli_put(struct msgb *msg, uint32_t tlli);
int bssgp_tx_suspend(uint16_t nsei, uint32_t tlli,
const struct gprs_ra_id *ra_id);
int bssgp_tx_resume(uint16_t nsei, uint32_t tlli,
const struct gprs_ra_id *ra_id, uint8_t suspend_ref);
int bssgp_tx_ra_capa_upd(struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag);
int bssgp_tx_radio_status_tlli(struct bssgp_bvc_ctx *bctx, uint8_t cause,
uint32_t tlli);
int bssgp_tx_radio_status_tmsi(struct bssgp_bvc_ctx *bctx, uint8_t cause,
uint32_t tmsi);
int bssgp_tx_radio_status_imsi(struct bssgp_bvc_ctx *bctx, uint8_t cause,
const char *imsi);
int bssgp_tx_flush_ll_ack(struct bssgp_bvc_ctx *bctx, uint32_t tlli,
uint8_t action, uint16_t bvci_new,
uint32_t num_octets);
int bssgp_tx_llc_discarded(struct bssgp_bvc_ctx *bctx, uint32_t tlli,
uint8_t num_frames, uint32_t num_octets);
int bssgp_tx_bvc_block(struct bssgp_bvc_ctx *bctx, uint8_t cause);
int bssgp_tx_bvc_unblock(struct bssgp_bvc_ctx *bctx);
int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause);
int bssgp_tx_ul_ud(struct bssgp_bvc_ctx *bctx, uint32_t tlli,
const uint8_t *qos_profile, struct msgb *llc_pdu);
int bssgp_rx_paging(struct bssgp_paging_info *pinfo,
struct msgb *msg);
int bssgp_tx_fc_bvc(struct bssgp_bvc_ctx *bctx, uint8_t tag,
uint32_t bucket_size, uint32_t bucket_leak_rate,
uint16_t bmax_default_ms, uint32_t r_default_ms,
uint8_t *bucket_full_ratio, uint32_t *queue_delay_ms);
int bssgp_tx_fc_ms(struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag,
uint32_t ms_bucket_size, uint32_t bucket_leak_rate,
uint8_t *bucket_full_ratio);
#endif

View File

@ -3,6 +3,7 @@
#include <osmocom/vty/vty.h>
#include <osmocom/core/rate_ctr.h>
#include <osmocom/core/utils.h>
#define VTY_DO_LOWER 1
char *vty_cmd_string_from_valstr(void *ctx, const struct value_string *vals,

View File

@ -29,6 +29,7 @@
#include <osmocom/gsm/tlv.h>
#include <osmocom/core/talloc.h>
#include <osmocom/gprs/gprs_bssgp.h>
#include <osmocom/gprs/gprs_bssgp_bss.h>
#include <osmocom/gprs/gprs_ns.h>
#include "common_vty.h"
@ -302,21 +303,151 @@ int bssgp_tx_bvc_reset(struct bssgp_bvc_ctx *bctx, uint16_t bvci, uint8_t cause)
return gprs_ns_sendmsg(bssgp_nsi, msg);
}
/*! \brief Transmit a FLOW_CONTROL-BVC (Chapter 10.4.4)
* \param[in] bctx BVC Context
* \param[in] tag Additional tag to identify acknowledge
* \param[in] bucket_size Maximum bucket size in octets
* \param[in] bucket_leak_rate Bucket leak rate in octets/sec
* \param[in] bmax_default_ms Maximum bucket size default for MS
* \param[in] r_default_ms Bucket leak rate default for MS in octets/sec
* \param[in] bucket_full_ratio Ratio (in percent) of queue filling
* \param[in] queue_delay_ms Average queuing delay in milliseconds
*/
int bssgp_tx_fc_bvc(struct bssgp_bvc_ctx *bctx, uint8_t tag,
uint32_t bucket_size, uint32_t bucket_leak_rate,
uint16_t bmax_default_ms, uint32_t r_default_ms,
uint8_t *bucket_full_ratio, uint32_t *queue_delay_ms)
{
struct msgb *msg;
struct bssgp_normal_hdr *bgph;
uint16_t e_bucket_size, e_leak_rate, e_bmax_default_ms, e_r_default_ms;
uint16_t e_queue_delay = 0; /* to make gcc happy */
/*! \brief RL-UL-UNITDATA.req (Chapter 10.2.2) */
if ((bucket_size / 100) > 0xffff)
return -EINVAL;
e_bucket_size = bucket_size / 100;
if ((bucket_leak_rate * 8 / 100) > 0xffff)
return -EINVAL;
e_leak_rate = (bucket_leak_rate * 8) / 100;
if ((bmax_default_ms / 100) > 0xffff)
return -EINVAL;
e_bmax_default_ms = bmax_default_ms / 100;
if ((r_default_ms * 8 / 100) > 0xffff)
return -EINVAL;
e_r_default_ms = (r_default_ms * 8) / 100;
if (queue_delay_ms) {
if ((*queue_delay_ms / 10) > 60000)
return -EINVAL;
else if (*queue_delay_ms == 0xFFFFFFFF)
e_queue_delay = 0xFFFF;
else
e_queue_delay = *queue_delay_ms / 10;
}
msg = bssgp_msgb_alloc();
bgph = (struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
msgb_nsei(msg) = bctx->nsei;
msgb_bvci(msg) = bctx->bvci;
bgph->pdu_type = BSSGP_PDUT_FLOW_CONTROL_BVC;
msgb_tvlv_put(msg, BSSGP_IE_TAG, sizeof(tag), (uint8_t *)&tag);
msgb_tvlv_put(msg, BSSGP_IE_BVC_BUCKET_SIZE,
sizeof(e_bucket_size), (uint8_t *) &e_bucket_size);
msgb_tvlv_put(msg, BSSGP_IE_BUCKET_LEAK_RATE,
sizeof(e_leak_rate), (uint8_t *) &e_leak_rate);
msgb_tvlv_put(msg, BSSGP_IE_BMAX_DEFAULT_MS,
sizeof(e_bmax_default_ms),
(uint8_t *) &e_bmax_default_ms);
msgb_tvlv_put(msg, BSSGP_IE_R_DEFAULT_MS,
sizeof(e_r_default_ms), (uint8_t *) &e_r_default_ms);
if (bucket_full_ratio)
msgb_tvlv_put(msg, BSSGP_IE_BUCKET_FULL_RATIO,
1, bucket_full_ratio);
if (queue_delay_ms)
msgb_tvlv_put(msg, BSSGP_IE_BVC_MEASUREMENT,
sizeof(e_queue_delay),
(uint8_t *) &e_queue_delay);
return gprs_ns_sendmsg(bssgp_nsi, msg);
}
/*! \brief Transmit a FLOW_CONTROL-MS (Chapter 10.4.6)
* \param[in] bctx BVC Context
* \param[in] tlli TLLI to identify MS
* \param[in] tag Additional tag to identify acknowledge
* \param[in] ms_bucket_size Maximum bucket size in octets
* \param[in] bucket_leak_rate Bucket leak rate in octets/sec
* \param[in] bucket_full_ratio Ratio (in percent) of queue filling
*/
int bssgp_tx_fc_ms(struct bssgp_bvc_ctx *bctx, uint32_t tlli, uint8_t tag,
uint32_t ms_bucket_size, uint32_t bucket_leak_rate,
uint8_t *bucket_full_ratio)
{
struct msgb *msg;
struct bssgp_normal_hdr *bgph;
uint16_t e_bucket_size, e_leak_rate;
uint32_t e_tlli;
if ((ms_bucket_size / 100) > 0xffff)
return -EINVAL;
e_bucket_size = ms_bucket_size / 100;
if ((bucket_leak_rate * 8 / 100) > 0xffff)
return -EINVAL;
e_leak_rate = (bucket_leak_rate * 8) / 100;
msg = bssgp_msgb_alloc();
bgph = (struct bssgp_normal_hdr *) msgb_put(msg, sizeof(*bgph));
msgb_nsei(msg) = bctx->nsei;
msgb_bvci(msg) = bctx->bvci;
bgph->pdu_type = BSSGP_PDUT_FLOW_CONTROL_MS;
e_tlli = htonl(tlli);
msgb_tvlv_put(msg, BSSGP_IE_TLLI, sizeof(e_tlli), (uint8_t *)&e_tlli);
msgb_tvlv_put(msg, BSSGP_IE_TAG, sizeof(tag), (uint8_t *)&tag);
msgb_tvlv_put(msg, BSSGP_IE_MS_BUCKET_SIZE,
sizeof(e_bucket_size), (uint8_t *) &e_bucket_size);
msgb_tvlv_put(msg, BSSGP_IE_BUCKET_LEAK_RATE,
sizeof(e_leak_rate), (uint8_t *) &e_leak_rate);
if (bucket_full_ratio)
msgb_tvlv_put(msg, BSSGP_IE_BUCKET_FULL_RATIO,
1, bucket_full_ratio);
return gprs_ns_sendmsg(bssgp_nsi, msg);
}
/*! \brief RL-UL-UNITDATA.req (Chapter 10.2.2)
* \param[in] bctx BVC Context
* \param[in] tlli TLLI to identify MS
* \param[in] qos_profile Pointer to three octests of QoS profile
* \param[in] llc_pdu msgb pointer containing UL Unitdata IE payload
*/
int bssgp_tx_ul_ud(struct bssgp_bvc_ctx *bctx, uint32_t tlli,
const uint8_t *qos_profile, struct msgb *llc_pdu)
{
struct msgb *msg = llc_pdu;
uint8_t bssgp_cid[8];
uint8_t bssgp_align[3] = {0, 0, 0};
struct bssgp_ud_hdr *budh;
/* FIXME: First push alignment octets, if rqd */
int align = sizeof(*budh);
/* FIXME: Optional LSA Identifier List, PFI */
/* Cell Identifier */
bssgp_create_cell_id(bssgp_cid, &bctx->ra_id, bctx->cell_id);
align += 2; /* add T+L */
align += sizeof(bssgp_cid);
/* First push alignment IE */
align += 2; /* add T+L */
align = (4 - align) & 3; /* how many octest are required to align? */
msgb_tvlv_push(msg, BSSGP_IE_ALIGNMENT, align, bssgp_align);
/* Push other IEs */
msgb_tvlv_push(msg, BSSGP_IE_CELL_ID, sizeof(bssgp_cid), bssgp_cid);
/* User Data Header */

View File

@ -920,14 +920,24 @@ struct gprs_ns_inst *gprs_ns_instantiate(gprs_ns_cb_t *cb, void *ctx)
/*! \brief Destroy an entire NS instance
* \param nsi gprs_ns_inst that is to be destroyed
*
* This function SHOULD release all resources associated with the
* NS-instance but is actually not completely implemented!
* This function releases all resources associated with the
* NS-instance.
*/
void gprs_ns_destroy(struct gprs_ns_inst *nsi)
{
/* FIXME: clear all timers */
struct gprs_nsvc *nsvc, *nsvc2;
/* recursively free the NSI and all its NSVCs */
/* delete all NSVCs and clear their timers */
llist_for_each_entry_safe(nsvc, nsvc2, &nsi->gprs_nsvcs, list)
gprs_nsvc_delete(nsvc);
/* close socket and unregister */
if (nsi->nsip.fd.data) {
close(nsi->nsip.fd.fd);
osmo_fd_unregister(&nsi->nsip.fd);
}
/* free the NSI */
talloc_free(nsi);
}

View File

@ -11,6 +11,8 @@ bssgp_parse_cell_id;
bssgp_tx_bvc_block;
bssgp_tx_bvc_reset;
bssgp_tx_bvc_unblock;
bssgp_tx_fc_bvc;
bssgp_tx_fc_ms;
bssgp_tx_flush_ll_ack;
bssgp_tx_llc_discarded;
bssgp_tx_ra_capa_upd;

View File

@ -2,7 +2,7 @@
* (C) 2008 by Daniel Willmann <daniel@totalueberwachung.de>
* (C) 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
* (C) 2009-2010 by Harald Welte <laforge@gnumonks.org>
* (C) 2010 by Nico Golde <nico@ngolde.de>
* (C) 2010-2012 by Nico Golde <nico@ngolde.de>
*
* All Rights Reserved
*
@ -127,9 +127,8 @@ int gsm_7bit_decode_hdr(char *text, const uint8_t *user_data, uint8_t septet_l,
{
int i = 0;
int shift = 0;
uint8_t *rtext = calloc(septet_l, sizeof(uint8_t));
uint8_t tmp;
uint8_t c;
uint8_t next_is_ext = 0;
/* skip the user data header */
if (ud_hdr_ind) {
@ -141,29 +140,29 @@ int gsm_7bit_decode_hdr(char *text, const uint8_t *user_data, uint8_t septet_l,
}
for (i = 0; i < septet_l; i++) {
rtext[i] =
c =
((user_data[((i + shift) * 7 + 7) >> 3] <<
(7 - (((i + shift) * 7 + 7) & 7))) |
(user_data[((i + shift) * 7) >> 3] >>
(((i + shift) * 7) & 7))) & 0x7f;
}
for (i = 0; i < septet_l; i++) {
/* this is an extension character */
if(rtext[i] == 0x1b && i + 1 < septet_l){
tmp = rtext[i+1];
*(text++) = gsm_7bit_alphabet[0x7f + tmp];
i++;
if (next_is_ext) {
next_is_ext = 0;
*(text++) = gsm_7bit_alphabet[0x7f + c];
continue;
}
*(text++) = gsm_septet_lookup(rtext[i]);
if (c == 0x1b && i + 1 < septet_l) {
next_is_ext = 1;
} else {
*(text++) = gsm_septet_lookup(c);
}
}
if (ud_hdr_ind)
i += shift;
*text = '\0';
free(rtext);
return i;
}
@ -250,16 +249,17 @@ int gsm_septets2octets(uint8_t *result, uint8_t *rdata, uint8_t septet_len, uint
/* GSM 03.38 6.2.1 Character packing */
int gsm_7bit_encode(uint8_t *result, const char *data)
{
int y = 0, z = 0;
int y = 0;
/* prepare for the worst case, every character expanding to two bytes */
uint8_t *rdata = calloc(strlen(data) * 2, sizeof(uint8_t));
y = gsm_septet_encode(rdata, data);
z = gsm_septets2octets(result, rdata, y, 0);
gsm_septets2octets(result, rdata, y, 0);
free(rdata);
/*
* We don't care about the number of octets (z), because they are not
* We don't care about the number of octets, because they are not
* unique. E.g.:
* 1.) 46 non-extension characters + 1 extension character
* => (46 * 7 bit + (1 * (2 * 7 bit))) / 8 bit = 42 octets

View File

@ -175,17 +175,19 @@ void log_parse_category_mask(struct log_target* target, const char *_mask)
category_token = strtok(mask, ":");
do {
for (i = 0; i < osmo_log_info->num_cat; ++i) {
size_t length, cat_length;
char* colon = strstr(category_token, ",");
int length = strlen(category_token);
int cat_length = strlen(osmo_log_info->cat[i].name);
if (!osmo_log_info->cat[i].name)
continue;
length = strlen(category_token);
cat_length = strlen(osmo_log_info->cat[i].name);
/* Use longest length not to match subocurrences. */
if (cat_length > length)
length = cat_length;
if (!osmo_log_info->cat[i].name)
continue;
if (colon)
length = colon - category_token;
@ -242,11 +244,13 @@ static void _output(struct log_target *target, unsigned int subsys,
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
}
ret = snprintf(buf + offset, rem, "<%4.4x> %s:%d ",
subsys, file, line);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
if (target->print_filename) {
ret = snprintf(buf + offset, rem, "<%4.4x> %s:%d ",
subsys, file, line);
if (ret < 0)
goto err;
OSMO_SNPRINTF_RET(ret, rem, offset, len);
}
}
ret = vsnprintf(buf + offset, rem, format, ap);
if (ret < 0)
@ -409,6 +413,15 @@ void log_set_print_timestamp(struct log_target *target, int print_timestamp)
target->print_timestamp = print_timestamp;
}
/*! \brief Enable or disable printing of the filename while logging
* \param[in] target Log target to be affected
* \param[in] print_filename Enable (1) or disable (0) filenames
*/
void log_set_print_filename(struct log_target *target, int print_filename)
{
target->print_filename = print_filename;
}
/*! \brief Set the global log level for a given log target
* \param[in] target Log target to be affected
* \param[in] log_level New global log level
@ -464,6 +477,7 @@ struct log_target *log_target_create(void)
/* global settings */
target->use_color = 1;
target->print_timestamp = 0;
target->print_filename = 1;
/* global log level */
target->loglevel = 0;
@ -740,14 +754,15 @@ int log_init(const struct log_info *inf, void *ctx)
/* copy over the user part */
for (i = 0; i < inf->num_cat; i++) {
memcpy(&osmo_log_info->cat[i], &inf->cat[i],
memcpy((struct log_info_cat *) &osmo_log_info->cat[i],
&inf->cat[i],
sizeof(struct log_info_cat));
}
/* copy over the library part */
for (i = 0; i < ARRAY_SIZE(internal_cat); i++) {
unsigned int cn = osmo_log_info->num_cat_user + i;
memcpy(&osmo_log_info->cat[cn],
memcpy((struct log_info_cat *) &osmo_log_info->cat[cn],
&internal_cat[i], sizeof(struct log_info_cat));
}

View File

@ -23,6 +23,7 @@
#include <stdint.h>
#include <inttypes.h>
#include <string.h>
#include <ctype.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/talloc.h>

View File

@ -291,7 +291,7 @@ int vty_out(struct vty *vty, const char *format, ...)
/*! \brief print a newline on the given VTY */
int vty_out_newline(struct vty *vty)
{
char *p = vty_newline(vty);
const char *p = vty_newline(vty);
buffer_put(vty->obuf, p, strlen(p));
return 0;
}

View File

@ -4,7 +4,7 @@ check_PROGRAMS = timer/timer_test sms/sms_test ussd/ussd_test \
smscb/smscb_test bits/bitrev_test a5/a5_test \
conv/conv_test auth/milenage_test lapd/lapd_test \
gsm0808/gsm0808_test gsm0408/gsm0408_test \
gb/bssgp_fc_test
gb/bssgp_fc_test logging/logging_test
if ENABLE_MSGFILE
check_PROGRAMS += msgfile/msgfile_test
endif
@ -48,6 +48,9 @@ ussd_ussd_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gs
gb_bssgp_fc_test_SOURCES = gb/bssgp_fc_test.c
gb_bssgp_fc_test_LDADD = $(top_builddir)/src/libosmocore.la $(top_builddir)/src/gb/libosmogb.la
logging_logging_test_SOURCES = logging/logging_test.c
logging_logging_test_LDADD = $(top_builddir)/src/libosmocore.la
# The `:;' works around a Bash 3.2 bug when the output is not writeable.
$(srcdir)/package.m4: $(top_srcdir)/configure.ac
:;{ \
@ -71,8 +74,11 @@ EXTRA_DIST = testsuite.at $(srcdir)/package.m4 $(TESTSUITE) \
smscb/smscb_test.ok bits/bitrev_test.ok a5/a5_test.ok \
conv/conv_test.ok auth/milenage_test.ok \
lapd/lapd_test.ok gsm0408/gsm0408_test.ok \
gsm0808/gsm0808_test.ok \
msgfile/msgfile_test.ok msgfile/msgconfig.cfg
gsm0808/gsm0808_test.ok gb/bssgp_fc_tests.err \
gb/bssgp_fc_tests.ok gb/bssgp_fc_tests.sh \
msgfile/msgfile_test.ok msgfile/msgconfig.cfg \
logging/logging_test.ok logging/logging_test.err
TESTSUITE = $(srcdir)/testsuite
check-local: atconfig $(TESTSUITE)

View File

@ -8,6 +8,7 @@
#include <string.h>
#include <getopt.h>
#include <osmocom/core/application.h>
#include <osmocom/core/utils.h>
#include <osmocom/core/logging.h>
#include <osmocom/core/talloc.h>
@ -121,6 +122,8 @@ int main(int argc, char **argv)
};
osmo_init_logging(&info);
log_set_use_color(osmo_stderr_target, 0);
log_set_print_filename(osmo_stderr_target, 0);
while ((c = getopt_long(argc, argv, "s:r:d:l:c:",
long_options, NULL)) != -1) {

View File

@ -1,51 +1,50 @@
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:699 Single PDU (size=1000) is larger than maximum bucket size (100)!
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
<0000> gprs_bssgp.c:556 BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes

BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
Single PDU (size=1000) is larger than maximum bucket size (100)!
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes
BSSGP-FC: fc_timer_cb() but still not able to send PDU of 10 bytes

View File

@ -0,0 +1,76 @@
/* simple test for the debug interface */
/*
* (C) 2008, 2009 by Holger Hans Peter Freyther <zecke@selfish.org>
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include <osmocom/core/logging.h>
#include <osmocom/core/utils.h>
enum {
DRLL,
DCC,
DMM,
};
static const struct log_info_cat default_categories[] = {
[DRLL] = {
.name = "DRLL",
.description = "A-bis Radio Link Layer (RLL)",
.color = "\033[1;31m",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
[DCC] = {
.name = "DCC",
.description = "Layer3 Call Control (CC)",
.color = "\033[1;32m",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
[DMM] = {
.name = NULL,
.description = "Layer3 Mobility Management (MM)",
.color = "\033[1;33m",
.enabled = 1, .loglevel = LOGL_NOTICE,
},
};
const struct log_info log_info = {
.cat = default_categories,
.num_cat = ARRAY_SIZE(default_categories),
};
int main(int argc, char **argv)
{
struct log_target *stderr_target;
log_init(&log_info, NULL);
stderr_target = log_target_create_stderr();
log_add_target(stderr_target);
log_set_all_filter(stderr_target, 1);
log_set_print_filename(stderr_target, 0);
log_parse_category_mask(stderr_target, "DRLL:DCC");
log_parse_category_mask(stderr_target, "DRLL");
DEBUGP(DCC, "You should not see this\n");
log_parse_category_mask(stderr_target, "DRLL:DCC");
DEBUGP(DRLL, "You should see this\n");
DEBUGP(DCC, "You should see this\n");
DEBUGP(DMM, "You should not see this\n");
return 0;
}

View File

@ -0,0 +1,3 @@
You should see this
You should see this


View File

@ -13,7 +13,7 @@ AT_SETUP([bssgp-fc])
AT_KEYWORDS([bssgp-fc])
cat $abs_srcdir/gb/bssgp_fc_tests.ok > expout
cat $abs_srcdir/gb/bssgp_fc_tests.err > experr
AT_CHECK([$abs_top_builddir/tests/gb/bssgp_fc_tests.sh $abs_top_builddir/tests/gb], [], [expout], [experr])
AT_CHECK([$abs_top_srcdir/tests/gb/bssgp_fc_tests.sh $abs_top_builddir/tests/gb], [], [expout], [experr])
AT_CLEANUP
AT_SETUP([bits])
@ -84,3 +84,10 @@ AT_KEYWORDS([gsm0408])
cat $abs_srcdir/gsm0408/gsm0408_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/gsm0408/gsm0408_test], [], [expout], [ignore])
AT_CLEANUP
AT_SETUP([logging])
AT_KEYWORDS([logging])
cat $abs_srcdir/logging/logging_test.ok > expout
cat $abs_srcdir/logging/logging_test.err > experr
AT_CHECK([$abs_top_builddir/tests/logging/logging_test], [], [expout], [experr])
AT_CLEANUP