Commit Graph

5123 Commits

Author SHA1 Message Date
Harald Welte b49248bf48 move allocating new transaction_ids to transaction.c 2009-07-23 21:39:00 +02:00
Harald Welte 78283ef151 move allocating new transaction_ids to transaction.c 2009-07-23 21:36:44 +02:00
Harald Welte c072ad6e29 add missing files to git 2009-07-23 21:25:48 +02:00
Harald Welte 9ee4825bbf add missing files to git 2009-07-23 21:25:08 +02:00
Harald Welte 88f0425197 Merge branch 'master' into sms 2009-07-23 21:24:28 +02:00
Harald Welte 6f5aee07e5 trans->transaction_id now reflects the actual (unshifted) value 2009-07-23 21:21:14 +02:00
Harald Welte 39e2eadc99 centralize the code that needs to deal with transaction_id
There were many places in the code where we had to explicitly
reference the transaction_id and put it into a packet.  By introducing
and optional gsm_trans parameter to gsm48_sendmsg(), we can implement
this code once rather than dozens of time.
2009-07-23 21:13:03 +02:00
Harald Welte 761e944182 make sure subscr->net is always set
since a subscriber is an element of the gsm_network, we have to ensure
subscr->net is always set correctly.  We do this by using gsm_network
as an argument to all functions that resolve or create a subscriber.
2009-07-23 19:21:02 +02:00
Harald Welte b3c3faee94 remove bogus 'network' member of 'struct gsm_transaction'
Since a transaction is associated to a gsm_subscriber, and the subsciber
is part of a network, we don't need to have a dedicated transaction->network
pointer.
2009-07-23 19:10:19 +02:00
Harald Welte aa0b29c265 gms_transactions data model reorganization
This changeset factors out gsm_transaction as something independent
of call control in preparation to re-use the code from SMS.  A
transaction is uniquely identified by either its callref, or by
a tuple of (transaction_id, protocol, subscriber).
2009-07-23 19:10:12 +02:00
Harald Welte 596fed40f0 remove bogus 'network' member of 'struct gsm_transaction'
Since a transaction is associated to a gsm_subscriber, and the subsciber
is part of a network, we don't need to have a dedicated transaction->network
pointer.
2009-07-23 19:06:52 +02:00
Harald Welte dcaf5654db gms_transactions data model reorganization
This changeset factors out gsm_transaction as something independent
of call control in preparation to re-use the code from SMS.  A
transaction is uniquely identified by either its callref, or by
a tuple of (transaction_id, protocol, subscriber).
2009-07-23 18:56:43 +02:00
Harald Welte 9176bd46e3 make sure subscr->net is always set
since a subscriber is an element of the gsm_network, we have to ensure
subscr->net is always set correctly.  We do this by using gsm_network
as an argument to all functions that resolve or create a subscriber.
2009-07-23 18:46:00 +02:00
Harald Welte f8d536def9 allow user to set BSIC and TSC from command line 2009-07-21 22:13:36 +02:00
Harald Welte 814c4b7984 use actual bts->tsc rather than hard-coded value 2009-07-21 22:13:28 +02:00
Harald Welte e6c22d9db7 use the TSC that is configured in bts->tsc rather than hardcoded value 2009-07-21 22:13:22 +02:00
Harald Welte 9f93c7d61b allow user to set BSIC and TSC from command line 2009-07-21 22:12:23 +02:00
Harald Welte 66ae83b0c9 use actual bts->tsc rather than hard-coded value 2009-07-21 20:55:56 +02:00
Harald Welte fe6a45a228 use the TSC that is configured in bts->tsc rather than hardcoded value 2009-07-21 20:40:05 +02:00
Harald Welte ae05d247af Merge branch 'master' into sms 2009-07-19 18:49:15 +02:00
Harald Welte ae0f2362bb send DEACTIVATE SACCH when sending RR CHANEL RELEASE
As per specification, we first send the RR CHANNEL RELEASE to the MS,
and then tell the BTS to disable the SACCH on that channel.
2009-07-19 18:36:49 +02:00
Harald Welte 7543eb72d0 fix copy+paste mistake in ecnoding short net name in mm info 2009-07-19 17:51:36 +02:00
Harald Welte 565547171c some more comments for BS11 attributes 2009-07-18 16:18:11 +02:00
Holger Hans Peter Freyther 03582a8bdc bsc_hack.c: Make adding of (nano)BTS to the network dynamic
Fix the FIXME and replace the hardcoded site_id's of the
nanoBTS with a command line option. You can use -i DEVICE_X
for every BTS you want to handle.
2009-07-16 15:27:09 +02:00
Harald Welte a1f0ac7eb3 yet again some more ip.access RSL definitions + parsing 2009-07-12 21:59:04 +02:00
Harald Welte 0427a9f31a add some more ip.access RTP related definitions 2009-07-12 11:17:16 +02:00
Harald Welte d83a127bb3 add more ipaccess 12.21 object classes, NSVC only exists once 2009-07-12 10:56:06 +02:00
Harald Welte ab46d7455b more ip.access RSL TLV parser definitions 2009-07-12 09:56:39 +02:00
Harald Welte 20855547bf rename ip.access structure field members and variables
to reflect that we now know their true names/meanings
2009-07-12 09:50:35 +02:00
Harald Welte 86c162dce8 give ip.access RSL IE's their proper names 2009-07-12 09:45:05 +02:00
Harald Welte 0efe9b7006 more ip.access abis_nm attributes
we also rename some existing attributes to reflect reality
2009-07-12 09:33:54 +02:00
Harald Welte 539bc608bd Merge branch 'master' into sms 2009-07-09 23:54:34 +02:00
Harald Welte 3e0f6173f1 some more comments 2009-07-09 23:52:59 +02:00
Holger Hans Peter Freyther 3d57183910 abis_rsl.c: Clarify from which specification this table comes from
It appears to be the table of TS 05.02.
2009-07-09 20:43:16 +02:00
Holger Hans Peter Freyther a7cd9fc0d1 ipacess-config: Handle NVATTR NACKs in ipaccess-config
Currently we send the attribute changes in a send and forget
fashion. But sometimes the nanoBTS is sending us a NACK, e.g
with a invalid unit id. Start handling the NACK and provide
an error message to the user. The error message is not yet
describing the cause of the error but this is a slight progress
to the previous silent failure.
2009-07-08 23:13:58 +02:00
Harald Welte d5651d5ced Merge commit 'origin/master' 2009-07-05 14:19:06 +02:00
Harald Welte f0465bd6cb Merge branch 'master' into sms 2009-07-05 14:10:01 +02:00
Harald Welte c2e302dc84 Store classmark1/2/3 in equipment SQL table
For further evaluation/analysis, this patch stores the classmark 1, 2 and 3
values of every equipment in the SQL database.  We can use this non-volatile
data to determine the supported features for each handset that we've ever
seen on our network.
2009-07-05 14:08:13 +02:00
Harald Welte be3e3784dc further SMS work
* implement ID based lookup of gsm_subscriber from database
* look-up recipient and sender subscribers from database
2009-07-05 14:06:41 +02:00
Harald Welte 51cda55981 remove unused variable 2009-07-05 14:05:30 +02:00
Harald Welte b9c758b2ac more SMS improvements
* describe data structures in gsm_04_11.h
* increae LCHAN RELEASE TIMEOUT for case of long SMS
* convert header field in sql table from NUMERIC to BLOB
* initial handling for validity period
* send RP ERROR messages with meaningful RP CAUSE in case of error
2009-07-05 14:02:46 +02:00
Harald Welte 53833f6fd8 remove SI3 and SI4 rest octets
As Dieter has pointed out, we currently send incorrect information
in the rest octets, particularly about our GPRS capability.  Since
the format of the rest octets is highly complex, and we don't
actually need any of those features yet, we might just fill them
with padding.
2009-07-05 13:41:40 +02:00
Harald Welte 5a691b5290 fix measurement report parsing of MEAS VALID logic
As Dieter points out, the logic level is inverted. 0 means valid.
2009-07-05 04:05:44 +02:00
Harald Welte 87f5d637c5 more layering /abstraction of sms protocol 2009-07-04 17:39:00 +02:00
Holger Hans Peter Freyther 42b40072dc ipaccess-config: Add --help to the ipaccess-config
Just a beginning...
2009-07-04 11:53:10 +02:00
Harald Welte 6c1a21367b Merge branch 'master' into sms 2009-07-04 10:38:11 +02:00
Harald Welte 24516ea2d6 make sure we always schedule a location updating reject
IT sems that if a MS uses the TMSI of a previous network, we did not start
the reject timer.  Thanks to Andreas Eversberg.
2009-07-04 10:18:00 +02:00
Harald Welte 4a3464c565 remove bogus extra check for data->imsi[0] in mncc_send
As Andreas points out, we already check for this condition some 10 lines
below, no need to check twice.
2009-07-04 10:11:24 +02:00
Harald Welte 73be3aafec remove superfluous check for lchan->use > 0
If we receive one of those strange BS-11 "Cause 22" errors,  we don't need
to check if the lchan use counter is > 0.  If it was 0, the lchan gets
released anyway.
2009-07-04 10:05:51 +02:00
Harald Welte 81543bcdd2 release channel on ERROR INDICATION
This was proposed by Andreas Eversberg.  I made it conditional on the T200
timer expired cause, as I'm not sure if we really should give up that quickly
on other errors such as just simply receiving an unsolicited response.
2009-07-04 09:40:05 +02:00
Harald Welte 1a5c6bd88c gsm48 lchan signal handling: use correct pointer
As Andreas Eversberg has pointed out, we need to use signal_data
rather than handler_data.
2009-07-04 09:35:21 +02:00
Harald Welte dd2b434b20 make sure misdn plugin handles DL_UNITDATA_IND
This reportedly fixes the problem that we didn't see MEASurement REPort
messages from the BS-11.
2009-07-04 09:28:00 +02:00
Harald Welte 8a396b73e1 Merge branch 'master' into sms 2009-07-04 09:21:47 +02:00
Harald Welte a0c0b57c28 add more TLV parser definitiosn for IPA NM attributes 2009-07-03 12:46:27 +02:00
Harald Welte 684b1a875a add code to ipaccess-config set nanoBST NVRAM attributes 2009-07-03 11:26:45 +02:00
Harald Welte 89cdce2ec0 Merge branch 'master' into sms 2009-07-01 16:57:39 +02:00
Harald Welte 1a9913060f Merge branch 'master' of gitosis@bs11-abis.gnumonks.org:openbsc 2009-07-01 11:24:18 +02:00
Harald Welte 9446d329f0 ip.access test numbers 2009-07-01 11:03:54 +02:00
Harald Welte d2f11f2923 add more ipaccess 12.21 OML extension definitions 2009-07-01 09:56:21 +02:00
Andreas Eversberg 8226fa7016 the pointer "tall_bsc_ctx" belongs to the gsm_data.c file not to include file. 2009-06-29 15:19:38 +02:00
Harald Welte 7b98d1336e Merge branch 'master' of gitosis@bs11-abis.gnumonks.org:openbsc 2009-06-29 13:07:06 +02:00
Harald Welte 042401c627 ipaccess-find: remove compile-time specified local ip address 2009-06-29 10:43:04 +02:00
Harald Welte eab33356d0 fix various RSL msgb memory leaks in error paths 2009-06-27 03:09:53 +02:00
Harald Welte a0368540ab cosmetic cleanup of LOCATION UPDATE REQ print-out 2009-06-27 03:09:45 +02:00
Harald Welte 10d0e67e2c add new DMEAS debug category for measurement reporting
disable it by default
2009-06-27 03:09:38 +02:00
Harald Welte a39c689f96 fix various RSL msgb memory leaks in error paths 2009-06-27 03:09:08 +02:00
Harald Welte dd1ae39641 cosmetic cleanup of LOCATION UPDATE REQ print-out 2009-06-27 02:58:43 +02:00
Harald Welte dfeaf18472 add new DMEAS debug category for measurement reporting
disable it by default
2009-06-27 02:53:10 +02:00
Harald Welte 53888bfd6c Merge branch 'master' into sms
Conflicts:
	openbsc/include/openbsc/gsm_data.h
	openbsc/src/bsc_hack.c
	openbsc/src/vty_interface.c
2009-06-26 20:34:09 +02:00
Harald Welte 6bfda782b9 make tests compile again after talloc branch changes 2009-06-26 20:30:46 +02:00
Harald Welte 470ec29b0d use taloc_zero() rather than talloc() and explisit memset() 2009-06-26 20:25:23 +02:00
Harald Welte c05677b036 fix two segfaults
* when paging callback is called, we need to consider a failed paging
  operation (i.e. lchan == NULL)
* we have to zero-initialize every transaction that is allocated
2009-06-26 20:17:06 +02:00
Harald Welte 9b11e8741d zero-initialize some more memory that we allocate 2009-06-26 19:42:28 +02:00
Harald Welte 678bdeac1f add FIXME about memory leak every time we close telnet 2009-06-26 19:42:14 +02:00
Harald Welte 316c825fcd fix MNCC memory leak
after passing the mncc structure (contained in msgb) to the mncc layer,
we have to release its memory.  This leak was discovered as a direct result of
using talloc.
2009-06-26 19:40:48 +02:00
Harald Welte 966636f39f use named variant when allocating msgb's
when we generate a talloc report (SIGUSR1), we can now see which system
allocated a given msgb, this helps memory leak debugging
2009-06-26 19:39:35 +02:00
Harald Welte f16571635a Merge branch 'master' into talloc 2009-06-26 18:19:53 +02:00
Harald Welte 560982b5d6 fix typos 2009-06-26 13:21:57 +02:00
Harald Welte 244b94b1de abis_nm.h: Fix various typos 2009-06-25 08:23:19 +02:00
Harald Welte c8fb714aa8 Add parsing of 'L1 information' IE of MEASUREMENT RESULT 2009-06-22 01:43:12 +02:00
Harald Welte fe9af26c3e Add parsing of 'L1 information' IE of MEASUREMENT RESULT 2009-06-22 01:37:50 +02:00
Harald Welte a4ffea9505 fix various talloc / dynamic bts/trx related bugs
Prior to this patch, nanobts was not able to operate after recent changes
2009-06-22 01:36:25 +02:00
Harald Welte e441d9c361 switch to dynamically allocated BTS and TRX data structures
This makes it much easier to do run-time configuration using the vty
interface.
2009-06-21 16:17:15 +02:00
Harald Welte fa457b1c00 fix setfault during registration of VTY TRX function 2009-06-20 22:37:07 +02:00
Harald Welte 2cf161be08 introduce talloc all over OpenBSC 2009-06-20 22:36:41 +02:00
Harald Welte 879dc971ff fix setfault during registration of VTY TRX function 2009-06-20 22:36:12 +02:00
Harald Welte 93e9d17b05 replace 'struct gsm_attr' by 'struct tlv_parsed'
This is where we will store the 12.21 / NM attributes for the given
object.
2009-06-20 19:22:24 +02:00
Harald Welte fcd2445d05 Introduce BS and MS power control related functions
* add bts->band field plus corresponding VTY and commandline argument
* add trx->nominal_power and trx->max_power_red fields
* add rsl_chan_bs_power_ctrl() to control TRX RF power for a given TS
* add rsl_chan_ms_power_ctrl() to control MS RF power for a given lchan.
2009-06-20 19:22:18 +02:00
Harald Welte a865f1b0c9 BS11: use abis_nm_set_{bts,radio}_attr()
BS11 should only use the raw message sending function if there is no
standard alternative.  For TRX and BTS attributes, we have the standard
variant.
2009-06-20 19:22:11 +02:00
Harald Welte 8ddb2cc8e2 replace 'struct gsm_attr' by 'struct tlv_parsed'
This is where we will store the 12.21 / NM attributes for the given
object.
2009-06-20 19:04:31 +02:00
Harald Welte d05559ea18 Add parsing of 'L1 information' IE of MEASUREMENT RESULT 2009-06-20 18:44:35 +02:00
Harald Welte a8f0c578c0 Introduce BS and MS power control related functions
* add bts->band field plus corresponding VTY and commandline argument
* add trx->nominal_power and trx->max_power_red fields
* add rsl_chan_bs_power_ctrl() to control TRX RF power for a given TS
* add rsl_chan_ms_power_ctrl() to control MS RF power for a given lchan.
2009-06-20 18:15:19 +02:00
Harald Welte 14d8e16de0 BS11: use abis_nm_set_{bts,radio}_attr()
BS11 should only use the raw message sending function if there is no
standard alternative.  For TRX and BTS attributes, we have the standard
variant.
2009-06-20 10:42:17 +02:00
Andreas Eversberg c079be4d38 mncc: Add IMSI to gsm_mncc
This allows us to do subscriber lookups based on IMSI and e.g. establish
MT calls to subscribers with no assigned extension.
2009-06-15 23:22:09 +02:00
Harald Welte 4acc2321f4 add GSM 4.11 SMS CP and RP cause values as enum 2009-06-15 17:47:55 +08:00
Harald Welte a717d5de8e Merge branch 'mncc-harald' 2009-06-14 22:15:37 +08:00
Harald Welte ff87157b65 Merge branch 'master' of gitosis@bs11-abis.gnumonks.org:openbsc 2009-06-14 22:15:32 +08:00
Andreas Eversberg 7563ac97c4 Use correct cause value and cause location
Fixed indication of cause value and location.
Replaced plain cause numbers by definitions from header file.
diff --git a/openbsc/src/gsm_04_08.c b/openbsc/src/gsm_04_08.c
index f323a2a..39e7b1f 100644
--- a/openbsc/src/gsm_04_08.c
+++ b/openbsc/src/gsm_04_08.c
@@ -1865,8 +1865,7 @@ int mncc_release_ind(struct gsm_network *net, struct gsm_trans *trans,

 	memset(&rel, 0, sizeof(rel));
 	rel.callref = callref;
-	mncc_set_cause(&rel, GSM48_CAUSE_LOC_PRN_S_LU,
-		       GSM48_CC_CAUSE_UNASSIGNED_NR);
+	mncc_set_cause(&rel, location, value);
 	return mncc_recvmsg(net, trans, MNCC_REL_IND, &rel);
 }

@@ -1879,7 +1878,9 @@ void free_trans(struct gsm_trans *trans)
 	/* send release to L4, if callref still exists */
 	if (trans->callref) {
 		/* Ressource unavailable */
-		mncc_release_ind(trans->network, trans, trans->callref, 1, 47);
+		mncc_release_ind(trans->network, trans, trans->callref,
+			GSM48_CAUSE_LOC_PRN_S_LU,
+			GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
 		if (trans->state != GSM_CSTATE_NULL)
 			new_cc_state(trans, GSM_CSTATE_NULL);
 	}
@@ -1960,7 +1961,7 @@ static int setup_trig_pag_evt(unsigned int hooknum, unsigned int event,
 				subscr->extension);
 			/* Temporarily out of order */
 			mncc_release_ind(transt->network, transt, transt->callref,
-					 1, 27);
+					 1, GSM48_CC_CAUSE_DEST_OOO);
 			transt->callref = 0;
 			free_trans(transt);
 			break;
@@ -2270,7 +2271,8 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
 			"This is not allowed!\n");
 		/* Temporarily out of order */
 		rc = mncc_release_ind(trans->network, trans, trans->callref,
-				      1, 47);
+				      GSM48_CAUSE_LOC_PRN_S_LU,
+				      GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
 		trans->callref = 0;
 		free_trans(trans);
 		return rc;
@@ -2287,7 +2289,8 @@ static int gsm48_cc_tx_setup(struct gsm_trans *trans, void *arg)
 	if ((trans_id_mask & 0x007f) == 0x7f) {
 		/* no free transaction ID */
 		rc = mncc_release_ind(trans->network, trans, trans->callref,
-				      1, 47);
+				      GSM48_CAUSE_LOC_PRN_S_LU,
+				      GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
 		trans->callref = 0;
 		free_trans(trans);
 		return rc;
@@ -3373,14 +3376,18 @@ int mncc_send(struct gsm_network *net, int msg_type, void *arg)
 				"unknown callref %d\n", data->called.number,
 				get_mncc_name(msg_type), data->callref);
 			/* Invalid call reference */
-			return mncc_release_ind(net, NULL, data->callref, 1, 81);
+			return mncc_release_ind(net, NULL, data->callref,
+				GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_INVAL_TRANS_ID);
 		}
 		if (!data->called.number[0] && !data->called.imsi[0]) {
 			DEBUGP(DCC, "(bts - trx - ts - ti) "
 				"Received '%s' from MNCC with "
 				"no number or IMSI\n", get_mncc_name(msg_type));
 			/* Invalid number */
-			return mncc_release_ind(net, NULL, data->callref, 1, 28);
+			return mncc_release_ind(net, NULL, data->callref,
+				GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_INV_NR_FORMAT);
 		}
 		/* New transaction due to setup, find subscriber */
 		if (data->called.number[0])
@@ -3394,7 +3401,9 @@ int mncc_send(struct gsm_network *net, int msg_type, void *arg)
 				"unknown subscriber %s\n", data->called.number,
 				get_mncc_name(msg_type), data->called.number);
 			/* Unknown subscriber */
-			return mncc_release_ind(net, NULL, data->callref, 1, 1);
+			return mncc_release_ind(net, NULL, data->callref,
+				GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_UNASSIGNED_NR);
 		}
 		/* If subscriber is not "attached" */
 		if (!subscr->lac) {
@@ -3404,14 +3413,18 @@ int mncc_send(struct gsm_network *net, int msg_type, void *arg)
 				get_mncc_name(msg_type), data->called.number);
 			subscr_put(subscr);
 			/* Temporarily out of order */
-			return mncc_release_ind(net, NULL, data->callref, 1, 27);
+			return mncc_release_ind(net, NULL, data->callref,
+				GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_DEST_OOO);
 		}
 		/* Create transaction */
 		if (!(trans = calloc(1, sizeof(struct gsm_trans)))) {
 			DEBUGP(DCC, "No memory for trans.\n");
 			subscr_put(subscr);
 			/* Ressource unavailable */
-			mncc_release_ind(net, NULL, data->callref, 1, 47);
+			mncc_release_ind(net, NULL, data->callref,
+				GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_RESOURCE_UNAVAIL);
 			return -ENOMEM;
 		}
 		trans->callref = data->callref;
2009-06-14 22:14:12 +08:00
Andreas Eversberg 71aab45bbe Fix lchan refcounting in case of IMSI DETACH
Removed lchan_put() after IMSI detach function.
We don't need to put lchan, because we don't hold a ressource.
2009-06-14 22:09:12 +08:00
Holger Hans Peter Freyther 2dceae6ab7 make btstype2str return a const char* to make gcc 4.4 happy 2009-06-12 17:39:38 +02:00
Harald Welte fab4368a78 Merge commit 'origin/master' into mncc-harald 2009-06-12 20:15:16 +08:00
Holger Hans Peter Freyther 8426a83908 [misc] Fix make distcheck by adding compat_af_isdn.h 2009-06-12 08:54:08 +02:00
Harald Welte 3cfdb22214 SMS: fix parsing of destination phone number 2009-06-12 02:42:11 +08:00
Harald Welte b89550764a Increase LCHAN_RELEASE_TIMEOUT to 10 seconds
If we release the LCHAN after the CM SERVICE ACK too early, we can no longer
receive longer SMS messages... so let's increase it to 10 secs.
2009-06-12 02:41:10 +08:00
Harald Welte 92f70c5773 04.08: Make mncc-harald branch work
This fixes two reasons for crashes due to uninitialized memory or
wrong pointer passing introduced in my own mncc modifications
2009-06-12 01:54:08 +08:00
Harald Welte a718780253 SMS: fix parsing of destination address BCD
this bug was introduced in Andreas' MNCC patches while altering
decode_bcd_number().
2009-06-12 01:53:29 +08:00
Harald Welte 5d4b1c2c33 abis_nm: fix printing of ADMinistrative state 2009-06-12 01:34:29 +08:00
Harald Welte c66b71cb76 use less magic numbers (04.08 CC cause values)
Introduce a gsm48_cc_cause enum and use it from gsm_04_08 and MNCC,
also make sure we use gsm48_cause_loc rather than plain numbers.
2009-06-11 14:23:20 +08:00
Harald Welte 4bfdfe7f70 reworked MNCC codebase
This is Harald's reworked MNCC base, slowly heading towards integration
into master.  The key changes are:
* provide much more structure to the data in gsm_mncc
* encode_* and decode_* functions now take a structure rather than tons
  of individual arguments (whose order nobody can remember)
* make sure we don't have copies of the same code everywhere by introducing
  mncc_set_cause() and mncc_release_ind()
* save horizontal screen space if possible
* make sure we break lines > 80 characters
2009-06-10 23:25:50 +08:00
Harald Welte ec44e1ff41 Merge commit 'origin/master' 2009-06-10 23:21:25 +08:00
Andreas Eversberg 20152a35e3 [pcap] Write incoming packages without the extra mISDN header
This patch fixes the PCAP logging. If frames are received from E1
interface, an 8 byte mISDN header (MISDN_HEADER_LEN) is in front of the
RSL packet. When frames are transmitted to the E1 interface, the
pcap_write_packet function will get a message buffer without the mISDN
header in front of the RSL packet. The pcap file was tested and the
output is correct.

Follow up patches should make use the msgb->l2, make the ipaccess
code use the pcap writing too...
2009-06-10 14:47:33 +02:00
Holger Freyther 85a7b363d9 Handle and dispatch paging requests in gsm_subscriber
Implement subscr_get_channel and subscr_put_channel to
a degree that SMS Submit and phone call scheduled at the
same time will deliver both (one after the other).
2009-06-10 13:38:20 +02:00
Holger Hans Peter Freyther 800d29d798 [channel] Add a test case for the request foo in gsm_subscriber.c
This is simulating a successfull request and is causing
a segfault. The test is done with a "mock object" in this
case a minimalistic paging implementation which is enough
to show the crash.

Compare that the callback data is supposed to be the same....
2009-06-10 13:26:47 +02:00
Holger Freyther 04866d4279 Proposal for a "channel request" interface...
Reuqests for a subscriber a stored within the gsm_subscriber
datastructure and it will keep track how many channels are
allocated for this user and of which type to decide on policy...

e.g. attempt to submit SMS during a phone call and not doing
paging but a simple (immediate) assignment of the channel...
2009-06-10 13:20:39 +02:00
Holger Hans Peter Freyther fdac4cc176 [paging] Unbreak breakge when moving things into paging.c
By calling _paging_request_stop with NULL for the lchan we
have never used the paging complete callback... I didn't
spot that when moving the code over and thought it is a great
simplification to not call paging_request_stop first and then
loop... *sigh*

restore the old behaviour. Call the callback first and then
free the requests.
2009-06-10 11:49:01 +02:00
Holger Hans Peter Freyther 500f3ca19d [o&m] Dispatch a signal for nacked O&M messages
When trying to operate a nanoBTS900 on channels for 1800
or the other way around the "SET BTS ATTRIBUTES" message
will be nacked. Dispatch all nacked messages from abis_nm
via signals. Handle this in bsc_hack.c, print a small hint
and exit the application as this is considered a fatal
unrecoverable error (the exit is in the app, so a library
can be more robust).
2009-06-10 10:48:14 +02:00
Holger Hans Peter Freyther e91f57879d [bsc_hack] Sanity check for the GSM1800 nanoBTS
The GSM1800 requires us to use channels between 512-885. When
failing to provide such a channel the OML layer will fail and
no RSL connection will be opened.

Add a sanity check before creating the gsm_network and fail
when the channels are not within the allowed range.

Assume no one is operating a BS11 in the 1800 spectrum.
2009-06-10 10:27:09 +02:00
Holger Hans Peter Freyther 5c85ef9295 Remove use_lchan and put_lchan from location updating request paths
Andreas Eversberg is suspecting that some of these messages
are not balanced and we are seeing a leak here. The general location
updating request is guarded by the "location updating request" object
inside the lchan that will keep the channel open for at least five
seconds to get all the information we need.
2009-06-10 06:51:46 +02:00
Holger Hans Peter Freyther 2c45123807 Move the "finding" of the right BTS into paging.c
Move the secret of how to find the BTS in a LocationArea into
the paging layer. This allows to implement different strategies
without changing other parts. E.g. we might want to try the BTS
were the device was seen last and then try...

There should be no semantic change and things should continue
to work. It is sadly not tested though.
2009-06-10 06:40:48 +02:00
Holger Hans Peter Freyther cd1f751e4c Search for BTS's in the Location Area of the subscriber we call
Search for the MS at BTS in the location area of the
called_subscr. This makes the case work where caller and
receiver are not in the same location area. In fact this
looks like a breach of a BSC/MSC separation, I have no idea
if in true networks a BSC is managing BTS in different location
areas.
2009-06-10 06:40:47 +02:00
Harald Welte 0c3893078e introduce encoding/decoding functions for 04.08 CC
this patch implements the encoding/decoding of 04.08 call control information
elements.  It adds new functions to be used for the application interface
patch, and is basis for the application patch (currently patch 36).

Please ignore warnings about unused static functions for now.

(Andreas Eversberg)
2009-06-10 12:08:54 +08:00
Harald Welte be1431076d use gsm_bts_by_lac() function to start paging of all bts with same lac
when paging is successfull, the paging_request_stop() function is called
with the current lchan, so the callback function will be called. for all
other bts', the paging_request_stop() function is called without lchan,
so the paging is stopped, but the callback function is not called.

this ensures that only one paging result is received when paging
multiple BTS. (Andreas Eversberg)
2009-06-10 11:21:55 +08:00
Harald Welte 13e10daa33 move openbsc into its own subdirectory 2009-06-10 05:40:52 +08:00