예제 #1
0
파일: testpart.cpp 프로젝트: chrizzoy/yate
void SS7Testing::setParams(const NamedList& params, bool setSeq)
{
    if (!m_timer.interval() || params.getParam(YSTRING("interval")))
	m_timer.interval(params,"interval",20,1000,true);
    m_len = params.getIntValue(YSTRING("length"),m_len);
    m_sharing = params.getBoolValue(YSTRING("sharing"),m_sharing);
    if (m_len > 1024)
	m_len = 1024;
    if (setSeq || !m_seq)
	m_seq = params.getIntValue(YSTRING("sequence"),m_seq);
    const String* lbl = params.getParam(YSTRING("address"));
    if (!TelEngine::null(lbl)) {
	// TYPE,opc,dpc,sls,spare
	SS7PointCode::Type t = SS7PointCode::Other;
	ObjList* l = lbl->split(',');
	const GenObject* o = l->at(0);
	if (o) {
	    t = SS7PointCode::lookup(o->toString());
	    if (t == SS7PointCode::Other)
		t = m_lbl.type();
	}
	if (t != SS7PointCode::Other) {
	    o = l->at(1);
	    if (o) {
		SS7PointCode c(m_lbl.opc());
		if (c.assign(o->toString(),t))
		    m_lbl.assign(t,m_lbl.dpc(),c,m_lbl.sls(),m_lbl.spare());
	    }
	    o = l->at(2);
	    if (o) {
		SS7PointCode c(m_lbl.dpc());
		if (c.assign(o->toString(),t))
		    m_lbl.assign(t,c,m_lbl.opc(),m_lbl.sls(),m_lbl.spare());
	    }
	    o = l->at(3);
	    if (o) {
		int sls = o->toString().toInteger(-1);
		if (sls >= 0)
		    m_lbl.setSls(sls);
	    }
	    o = l->at(4);
	    if (o) {
		int spare = o->toString().toInteger(-1);
		if (spare >= 0)
		    m_lbl.setSpare(spare);
	    }
	}
	delete l;
    }
}
예제 #2
0
void TestThread::configure(const NamedList& conf)
{
    Lock mylock(this);
    m_serverAddr = conf.getValue("addr", "0.0.0.0");
    if(m_serverAddr == "0.0.0.0")
	m_serverAddr = "127.0.0.1";
    m_serverPort = conf.getIntValue("port", 80);
}
예제 #3
0
파일: uart.cpp 프로젝트: bastienhappe/yate
UART::UART(State state, const NamedList& params, const char* name)
    : m_modem(params,this),
    m_state(Idle),
    m_error(ENone),
    m_parity(0),
    m_expectedParity(false),
    m_accumulator(8)
{
    debugName(name);

    unsigned char dataBits = params.getIntValue("databits",8);
    if (dataBits < 1 || dataBits > 8)
	dataBits = 8;
    m_accumulator.dataBits(dataBits);

    m_parity = params.getIntValue("parity");

    reset(state);
}
예제 #4
0
unsigned char SS7Layer4::getSIO(const NamedList& params, unsigned char sif, unsigned char prio, unsigned char ni)
{
    if ((prio & 0x30) == 0)
	prio <<= 4;
    if ((ni & 0xc0) == 0)
	ni <<= 6;
    sif = params.getIntValue(YSTRING("service"),sif & 0x0f);
    prio = SS7MSU::getPriority(params.getValue(YSTRING("priority")),prio & 0x30);
    if ((prio & 0x30) == 0)
	prio <<= 4;
    ni = SS7MSU::getNetIndicator(params.getValue(YSTRING("netindicator")),ni & 0xc0);
    if ((ni & 0xc0) == 0)
	ni <<= 6;
    return (sif & 0x0f) | (prio & 0x30) | (ni & 0xc0);
}
예제 #5
0
파일: media.cpp 프로젝트: CimpianAlin/yate
// Update members from a dispatched "chan.rtp" message
void SDPMedia::update(const NamedList& msg, bool pickFormat)
{
    DDebug(DebugAll,"SDPMedia::update('%s',%s) [%p]",
	msg.c_str(),String::boolText(pickFormat),this);
    m_id = msg.getValue("rtpid",m_id);
    m_lPort = msg.getValue("localport",m_lPort);
    if (pickFormat) {
	const char* format = msg.getValue("format");
	if (format) {
	    m_format = format;
	    if ((m_formats != m_format) && (msg.getIntValue("remoteport") > 0)) {
		Debug(DebugNote,"Choosing started '%s' format '%s' [%p]",
		    c_str(),format,this);
		m_formats = m_format;
	    }
	}
    }
}