[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r10080 - in openbts/branches/developers/dburgess00/ver
From: |
dburgess00 |
Subject: |
[Commit-gnuradio] r10080 - in openbts/branches/developers/dburgess00/veryearly: Control apps |
Date: |
Thu, 27 Nov 2008 21:50:26 -0700 (MST) |
Author: dburgess00
Date: 2008-11-27 21:50:23 -0700 (Thu, 27 Nov 2008)
New Revision: 10080
Added:
openbts/branches/developers/dburgess00/veryearly/Control/DCCHDispatch.cpp
Removed:
openbts/branches/developers/dburgess00/veryearly/Control/FACCHDispatch.cpp
openbts/branches/developers/dburgess00/veryearly/Control/SDCCHDispatch.cpp
Modified:
openbts/branches/developers/dburgess00/veryearly/Control/ControlCommon.h
openbts/branches/developers/dburgess00/veryearly/Control/Makefile.am
openbts/branches/developers/dburgess00/veryearly/Control/MobilityManagement.cpp
openbts/branches/developers/dburgess00/veryearly/Control/RadioResource.cpp
openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS850.cpp
openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS900.cpp
Log:
Unify SDCCHDispatch and FACCHDispatch into a single
DCCHDispatch finction.
This is another step on the way to #316.
Modified:
openbts/branches/developers/dburgess00/veryearly/Control/ControlCommon.h
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/Control/ControlCommon.h
2008-11-28 00:34:51 UTC (rev 10079)
+++ openbts/branches/developers/dburgess00/veryearly/Control/ControlCommon.h
2008-11-28 04:50:23 UTC (rev 10080)
@@ -47,6 +47,7 @@
#include <GSML3CommonElements.h>
#include <GSML3MMElements.h>
#include <GSML3CCElements.h>
+#include <GSML3RRMessages.h>
#include <SIPEngine.h>
@@ -142,7 +143,7 @@
/address@hidden Functions for mobility manangement operations. */
//@{
-void CMServiceResponder(const GSM::L3CMServiceRequest* cmsrq,
GSM::SDCCHLogicalChannel* SDCCH);
+void CMServiceResponder(const GSM::L3CMServiceRequest* cmsrq,
GSM::LogicalChannel* DCCH);
void IMSIDetachController(const GSM::L3IMSIDetachIndication* idi,
GSM::SDCCHLogicalChannel* SDCCH);
void LocationUpdatingController(const GSM::L3LocationUpdatingRequest* lur,
GSM::SDCCHLogicalChannel* SDCCH);
//@}
@@ -152,7 +153,9 @@
/** Decode RACH bits and send an immediate assignment. */
void AccessGrantResponder(unsigned requestReference, const GSM::Time& when);
/** Find and compelte the in-process transaction associated with a paging
repsonse. */
-void PagingResponseHandler(const GSM::L3PagingResponse*,
GSM::SDCCHLogicalChannel*);
+void PagingResponseHandler(const GSM::L3PagingResponse*, GSM::LogicalChannel*);
+/** Find and compelte the in-process transaction associated with a completed
assignment. */
+void AssignmentCompleteHandler(const GSM::L3AssignmentComplete*,
GSM::TCHFACCHLogicalChannel*);
//@}
/address@hidden Functions for call control operations. */
Added: openbts/branches/developers/dburgess00/veryearly/Control/DCCHDispatch.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/Control/DCCHDispatch.cpp
(rev 0)
+++ openbts/branches/developers/dburgess00/veryearly/Control/DCCHDispatch.cpp
2008-11-28 04:50:23 UTC (rev 10080)
@@ -0,0 +1,179 @@
+/address@hidden Idle-mode dispatcher for dedicated control channels. */
+
+/*
+* Copyright 2008 Free Software Foundation, Inc.
+*
+* This software is distributed under the terms of the GNU Public License.
+* See the COPYING file in the main directory for details.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU 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 General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+
+
+#include "ControlCommon.h"
+#include <GSMLogicalChannel.h>
+#include <GSML3MMMessages.h>
+#include <GSML3RRMessages.h>
+#include <SIPUtility.h>
+#include <SIPInterface.h>
+
+using namespace std;
+using namespace GSM;
+using namespace Control;
+
+
+
+
+/**
+ Dispatch the appropriate controller for a Mobility Management message.
+ @param req A pointer to the initial message.
+ @param DCCH A pointer to the logical channel for the transaction.
+*/
+void DCCHDispatchMM(const L3MMMessage* req, LogicalChannel *DCCH)
+{
+ assert(req);
+ L3MMMessage::MessageType MTI = (L3MMMessage::MessageType)req->MTI();
+ switch (MTI) {
+ case L3MMMessage::LocationUpdatingRequest:
+ LocationUpdatingController(dynamic_cast<const
L3LocationUpdatingRequest*>(req),
+
dynamic_cast<SDCCHLogicalChannel*>(DCCH));
+ break;
+ case L3MMMessage::IMSIDetachIndication:
+ IMSIDetachController(dynamic_cast<const
L3IMSIDetachIndication*>(req),
+
dynamic_cast<SDCCHLogicalChannel*>(DCCH));
+ break;
+ case L3MMMessage::CMServiceRequest:
+ CMServiceResponder(dynamic_cast<const
L3CMServiceRequest*>(req),DCCH);
+ break;
+ default:
+ CERR("NOTICE -- (ControlLayer) unhandled MM message "
<< MTI << " on " << DCCH->type());
+ throw UnsupportedMessage();
+ }
+}
+
+
+/**
+ Dispatch the appropriate controller for a Radio Resource message.
+ @param req A pointer to the initial message.
+ @param DCCH A pointer to the logical channel for the transaction.
+*/
+void DCCHDispatchRR(const L3RRMessage* req, LogicalChannel *DCCH)
+{
+ CLDCOUT("DCCHDispatchRR: cheking MTI"<<
(L3RRMessage::MessageType)req->MTI() )
+
+ assert(req);
+ L3RRMessage::MessageType MTI = (L3RRMessage::MessageType)req->MTI();
+ switch (MTI) {
+ case L3RRMessage::PagingResponse:
+ PagingResponseHandler(dynamic_cast<const
L3PagingResponse*>(req),DCCH);
+ break;
+ case L3RRMessage::AssignmentComplete:
+ AssignmentCompleteHandler(dynamic_cast<const
L3AssignmentComplete*>(req),
+
dynamic_cast<TCHFACCHLogicalChannel*>(DCCH));
+ break;
+ default:
+ CERR("NOTICE -- (ControlLayer) unhandled RR message "
<< MTI << " on " << DCCH->type());
+ throw UnsupportedMessage();
+ }
+}
+
+
+
+
+
+
+/** Example of a closed-loop, persistent-thread control function for the DCCH.
*/
+void Control::DCCHDispatcher(LogicalChannel *DCCH)
+{
+ while (1) {
+ try {
+ // Wait for a transaction to start.
+ CLDCOUT("DCCHDisptacher waiting for " << DCCH->type()
<< " ESTABLISH");
+ while (!waitForPrimitive(DCCH,ESTABLISH)) {}
+ // Pull the first message and dispatch a new
transaction.
+ const L3Message *message = getMessage(DCCH);
+ CLDCOUT("DCCHDispatcher got " << *message);
+ // Each protocol has it's own sub-dispatcher.
+ switch (message->PD()) {
+ case L3MobilityManagementPD:
+ DCCHDispatchMM(dynamic_cast<const
L3MMMessage*>(message),DCCH);
+ break;
+ case L3RadioResourcePD:
+ DCCHDispatchRR(dynamic_cast<const
L3RRMessage*>(message),DCCH);
+ break;
+ default:
+ CERR("NOTICE -- (ControlLayer)
unhandled protocol "
+ << message->PD() << " on DCCH");
+ throw UnsupportedMessage();
+ }
+ delete message;
+ }
+
+ // Catch the various error cases.
+
+ catch (ChannelReadTimeout except) {
+ clearTransactionHistory(except.transactionID());
+ CERR("NOTICE -- ChannelReadTimeout");
+ // Cause 0x03 means "abnormal release, timer expired".
+ DCCH->send(L3ChannelRelease(0x03));
+ }
+ catch (UnexpectedPrimitive except) {
+ clearTransactionHistory(except.transactionID());
+ CERR("NOTICE -- UnexpectedPrimitive");
+ // Cause 0x62 means "message type not not compatible
with protocol state".
+ DCCH->send(L3ChannelRelease(0x62));
+ }
+ catch (UnexpectedMessage except) {
+ clearTransactionHistory(except.transactionID());
+ CERR("NOTICE -- UnexpectedMessage");
+ // Cause 0x62 means "message type not not compatible
with protocol state".
+ DCCH->send(L3ChannelRelease(0x62));
+ }
+ catch (UnsupportedMessage except) {
+ clearTransactionHistory(except.transactionID());
+ CERR("NOTICE -- UnsupportedMessage");
+ // Cause 0x61 means "message type not implemented".
+ DCCH->send(L3ChannelRelease(0x61));
+ }
+ catch (Q931TimerExpired except) {
+ clearTransactionHistory(except.transactionID());
+ CERR("NOTICE -- Q.931 T3xx timer expired");
+ // Cause 0x03 means "abnormal release, timer expired".
+ DCCH->send(L3ChannelRelease(0x03));
+ }
+ catch (SIP::SIPTimeout) {
+ CERR("NOTICE -- Uncaught SIP Timeout");
+ // Cause 0x03 means "abnormal release, timer expired".
+ DCCH->send(L3ChannelRelease(0x03));
+ }
+ catch (SIP::SIPError) {
+ CERR("NOTICE -- Uncaught SIP Error");
+ // Cause 0x01 means "abnormal release, unspecified".
+ DCCH->send(L3ChannelRelease(0x01));
+ }
+
+ CLDCOUT("DCCHDisptacher waiting for " << DCCH->type() << "
RELEASE");
+ //FIXME -- What's the GSM 04.08 Txxx value for this?
+ // Probably N200 * T200
+ waitForPrimitive(DCCH,RELEASE,20000);
+ }
+}
+
+
+
+
+// vim: ts=4 sw=4
Deleted:
openbts/branches/developers/dburgess00/veryearly/Control/FACCHDispatch.cpp
Modified: openbts/branches/developers/dburgess00/veryearly/Control/Makefile.am
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/Control/Makefile.am
2008-11-28 00:34:51 UTC (rev 10079)
+++ openbts/branches/developers/dburgess00/veryearly/Control/Makefile.am
2008-11-28 04:50:23 UTC (rev 10080)
@@ -31,10 +31,9 @@
libcontrol_la_SOURCES = \
CallControl.cpp \
ControlCommon.cpp \
- FACCHDispatch.cpp \
MobilityManagement.cpp \
RadioResource.cpp \
- SDCCHDispatch.cpp
+ DCCHDispatch.cpp
PagerTest_SOURCES = PagerTest.cpp
PagerTest_LDADD = \
Modified:
openbts/branches/developers/dburgess00/veryearly/Control/MobilityManagement.cpp
===================================================================
---
openbts/branches/developers/dburgess00/veryearly/Control/MobilityManagement.cpp
2008-11-28 00:34:51 UTC (rev 10079)
+++
openbts/branches/developers/dburgess00/veryearly/Control/MobilityManagement.cpp
2008-11-28 04:50:23 UTC (rev 10080)
@@ -52,24 +52,24 @@
/** Controller for CM Service requests, dispatches out to multiple possible
transaction controllers. */
-void Control::CMServiceResponder(const L3CMServiceRequest* cmsrq,
SDCCHLogicalChannel* SDCCH)
+void Control::CMServiceResponder(const L3CMServiceRequest* cmsrq,
LogicalChannel* DCCH)
{
assert(cmsrq);
CLDCOUT("CMServiceResponder " << *cmsrq);
switch (cmsrq->serviceType().type()) {
case L3CMServiceType::MobileOriginatedCall:
- MOCStarter(cmsrq,SDCCH);
+ MOCStarter(cmsrq,DCCH);
break;
#ifdef SMS
case L3CMServiceType::ShortMessage:
- ShortMessageServiceStarter(cmsrq, SDCCH);
+ ShortMessageServiceStarter(cmsrq,
dynamic_cast<SDCCHLogicalChannel*>(SDCCH));
break;
#endif
default:
CLDCOUT("CMServiceResponder service not supported");
// Cause 0x20 means "serivce not supported".
- SDCCH->send(L3CMServiceReject(0x20));
- SDCCH->send(L3ChannelRelease());
+ DCCH->send(L3CMServiceReject(0x20));
+ DCCH->send(L3ChannelRelease());
}
}
Modified:
openbts/branches/developers/dburgess00/veryearly/Control/RadioResource.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/Control/RadioResource.cpp
2008-11-28 00:34:51 UTC (rev 10079)
+++ openbts/branches/developers/dburgess00/veryearly/Control/RadioResource.cpp
2008-11-28 04:50:23 UTC (rev 10080)
@@ -178,8 +178,10 @@
-void Control::PagingResponseHandler(const L3PagingResponse* resp,
SDCCHLogicalChannel* SDCCH)
+void Control::PagingResponseHandler(const L3PagingResponse* resp,
LogicalChannel* DCCH)
{
+ assert(resp);
+ assert(DCCH);
CLDCOUT("PagingResponseHandler " << *resp);
// FIXME -- Delete the Mobile ID from the paging list to free up CCCH
bandwidth.
@@ -191,7 +193,7 @@
#ifndef PAGERTEST
// For now, assume MTC.
- MTCStarter(resp, SDCCH);
+ MTCStarter(resp, DCCH);
#else
COUT("starting MTC...");
#endif
@@ -199,11 +201,41 @@
+void Control::AssignmentCompleteHandler(const L3AssignmentComplete *confirm,
TCHFACCHLogicalChannel *TCH)
+{
+ assert(TCH);
+ assert(confirm);
+ // Check the transaction table to know what to do next.
+ TransactionEntry transaction;
+ if (!gTransactionTable.find(TCH->transactionID(),transaction)) {
+ CLDCOUT("NOTICE -- Assignment Complete from channel with no
transaction");
+ throw UnexpectedMessage();
+ }
+ CLDCOUT("AssignmentCompleteHandler
service="<<transaction.service().type());
+ // These "controller" functions don't return until the call is cleared.
+ switch (transaction.service().type()) {
+ case L3CMServiceType::MobileOriginatedCall:
+ MOCController(transaction,TCH);
+ break;
+ case L3CMServiceType::MobileTerminatedCall:
+ MTCController(transaction,TCH);
+ break;
+ default:
+ CLDCOUT("NOTICE -- request for unsupported service " <<
transaction.service());
+ throw UnsupportedMessage();
+ }
+ // If we got here, the call is cleared.
+ clearTransactionHistory(TCH->transactionID());
+}
+
+
+
+
void Pager::addID(const L3MobileIdentity& newID, ChannelType chanType,
unsigned wLife)
{
// Add a mobile ID to the paging list for a given lifetime.
Deleted:
openbts/branches/developers/dburgess00/veryearly/Control/SDCCHDispatch.cpp
Modified: openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS850.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS850.cpp
2008-11-28 00:34:51 UTC (rev 10079)
+++ openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS850.cpp
2008-11-28 04:50:23 UTC (rev 10080)
@@ -116,7 +116,7 @@
SDCCH[i].downstream(radio);
SDCCH[i].open();
gBTS.addSDCCH(&SDCCH[i]);
-
SDCCHControlThread[i].start((void*(*)(void*))Control::SDCCHDispatcher,&SDCCH[i]);
+
SDCCHControlThread[i].start((void*(*)(void*))Control::DCCHDispatcher,&SDCCH[i]);
}
// TCHs
@@ -134,7 +134,7 @@
TCH[i].downstream(radio);
TCH[i].open();
gBTS.addTCH(&TCH[i]);
-
TCHControlThread[i].start((void*(*)(void*))Control::FACCHDispatcher,&TCH[i]);
+
TCHControlThread[i].start((void*(*)(void*))Control::DCCHDispatcher,&TCH[i]);
}
// Set up the pager.
Modified: openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS900.cpp
===================================================================
--- openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS900.cpp
2008-11-28 00:34:51 UTC (rev 10079)
+++ openbts/branches/developers/dburgess00/veryearly/apps/OpenBTS900.cpp
2008-11-28 04:50:23 UTC (rev 10080)
@@ -114,7 +114,7 @@
Thread SDCCHControlThread[4];
for (int i=0; i<4; i++) {
SDCCH[i].downstream(radio);
-
SDCCHControlThread[i].start((void*(*)(void*))Control::SDCCHDispatcher,&SDCCH[i]);
+
SDCCHControlThread[i].start((void*(*)(void*))Control::DCCHDispatcher,&SDCCH[i]);
SDCCH[i].open();
gBTS.addSDCCH(&SDCCH[i]);
}
@@ -132,7 +132,7 @@
Thread TCHControlThread[7];
for (int i=0; i<7; i++) {
TCH[i].downstream(radio);
-
TCHControlThread[i].start((void*(*)(void*))Control::FACCHDispatcher,&TCH[i]);
+
TCHControlThread[i].start((void*(*)(void*))Control::DCCHDispatcher,&TCH[i]);
TCH[i].open();
gBTS.addTCH(&TCH[i]);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r10080 - in openbts/branches/developers/dburgess00/veryearly: Control apps,
dburgess00 <=