コード例 #1
0
void L2SAPMux::sapWriteFromL1(const L2Frame& frame)
{
	OBJLOG(DEBUG) << frame;
	unsigned sap;

	// (pat) Add switch to validate upstream primitives.  The upstream only generates a few primitives;
	// the rest are created in L2LAPDm.
	switch (frame.primitive()) {
		case L2_DATA:
			sap = frame.SAPI();	
			assert(sap == SAPI0 || sap == SAPI3);
			if (mL2[sap]) {
				mL2[sap]->l2dlWriteLowSide(frame);
			} else {
				LOG(WARNING) << "received DATA for unsupported"<<LOGVAR(sap);
			}
			return;
		case PH_CONNECT:
			// All this does is fully reset LAPDm; copy it out to every SAP.
			for (int s = 0; s <= 3; s++) {
				if (mL2[s]) mL2[s]->l2dlWriteLowSide(frame);	// Note: the frame may have the wrong SAP in it, but LAPDm doesnt care.
			}
			return;
		default:
			// If you get this assertion, make SURE you know what will happen upstream to that primitive.
			devassert(0);
			return;		// make g++ happy.
	}
}
コード例 #2
0
ファイル: GSMSAPMux.cpp プロジェクト: 12019/openbts-p2.8
void SAPMux::writeLowSide(const L2Frame& frame)
{
	OBJLOG(DEBUG) << frame.SAPI() << " " << frame;
	unsigned SAPI = frame.SAPI();	
	bool data = frame.primitive()==DATA;
	if (data && (!mUpstream[SAPI])) {
		LOG(WARNING) << "received DATA for unsupported SAP " << SAPI;
		return;
	}
	if (data) {
		mUpstream[SAPI]->writeLowSide(frame);
	} else {
		// If this is a non-data primitive, copy it out to every SAP.
		for (int i=0; i<4; i++) {
			if (mUpstream[i]) mUpstream[i]->writeLowSide(frame);
		}
	}
}
コード例 #3
0
ファイル: GSMSAPMux.cpp プロジェクト: 12019/openbts-p2.8
void LoopbackSAPMux::writeHighSide(const L2Frame& frame)
{
	OBJLOG(DEBUG) << "Loopback " << frame;
	// Substitute primitive
	L2Frame newFrame(frame);
	unsigned SAPI = frame.SAPI();	
	switch (frame.primitive()) {
		case ERROR: SAPI=0; break;
		case RELEASE: return;
		default: break;
	}
	// Because this is a test fixture, as assert here.
	// If this were not a text fixture, we would print a warning
	// and ignore the frame.
	assert(mUpstream[SAPI]);
	ScopedLock lock(mLock);
	mUpstream[SAPI]->writeLowSide(newFrame);
}