本文整理汇总了C++中TRACEPRINTF函数的典型用法代码示例。如果您正苦于以下问题:C++ TRACEPRINTF函数的具体用法?C++ TRACEPRINTF怎么用?C++ TRACEPRINTF使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了TRACEPRINTF函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Server
InetServer::InetServer (Layer3 * la3, Trace * tr, int port):
Server (la3, tr)
{
struct sockaddr_in addr;
int reuse = 1;
TRACEPRINTF (tr, 8, this, "OpenInetSocket %d", port);
memset (&addr, 0, sizeof (addr));
addr.sin_family = AF_INET;
addr.sin_port = htons (port);
addr.sin_addr.s_addr = htonl (INADDR_ANY);
fd = socket (AF_INET, SOCK_STREAM, 0);
if (fd == -1)
return;
setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof (reuse));
if (bind (fd, (struct sockaddr *) &addr, sizeof (addr)) == -1)
{
close (fd);
fd = -1;
return;
}
if (listen (fd, 10) == -1)
{
close (fd);
fd = -1;
return;
}
TRACEPRINTF (tr, 8, this, "InetSocket opened");
Start ();
}
示例2: TRACEPRINTF
bool
Layer3::registerBusmonitor (L_Busmonitor_CallBack * c)
{
TRACEPRINTF (t, 3, this, "registerBusmontior %08X", c);
if (individual ())
return 0;
if (group ())
return 0;
if (broadcast ())
return 0;
if (mode == 0)
{
layer2->Close ();
if (!layer2->enterBusmonitor ())
{
layer2->Open ();
return 0;
}
}
mode = 1;
busmonitor.resize (busmonitor () + 1);
busmonitor[busmonitor () - 1].cb = c;
TRACEPRINTF (t, 3, this, "registerBusmontior %08X = 1", c);
return 1;
}
示例3: pth_sem_init
FT12LowLevelDriver::FT12LowLevelDriver (const char *dev, Trace * tr)
{
struct termios t1;
t = tr;
pth_sem_init (&in_signal);
pth_sem_init (&out_signal);
pth_sem_init (&send_empty);
pth_sem_set_value (&send_empty, 1);
getwait = pth_event (PTH_EVENT_SEM, &out_signal);
TRACEPRINTF (t, 1, this, "Open");
fd = open (dev, O_RDWR | O_NOCTTY | O_NDELAY | O_SYNC);
if (fd == -1)
return;
set_low_latency (fd, &sold);
close (fd);
fd = open (dev, O_RDWR | O_NOCTTY);
if (fd == -1)
return;
if (tcgetattr (fd, &old))
{
restore_low_latency (fd, &sold);
close (fd);
fd = -1;
return;
}
if (tcgetattr (fd, &t1))
{
restore_low_latency (fd, &sold);
close (fd);
fd = -1;
return;
}
t1.c_cflag = CS8 | PARENB | CLOCAL | CREAD;
t1.c_iflag = IGNBRK | INPCK | ISIG;
t1.c_oflag = 0;
t1.c_lflag = 0;
t1.c_cc[VTIME] = 1;
t1.c_cc[VMIN] = 0;
cfsetospeed (&t1, B19200);
cfsetispeed (&t1, 0);
if (tcsetattr (fd, TCSAFLUSH, &t1))
{
restore_low_latency (fd, &sold);
close (fd);
fd = -1;
return;
}
sendflag = 0;
recvflag = 0;
repeatcount = 0;
mode = 0;
Start ();
TRACEPRINTF (t, 1, this, "Opened");
}
示例4: TRACEPRINTF
bool
Layer3::deregisterIndividualCallBack (L_Data_CallBack * c, eibaddr_t src,
eibaddr_t dest)
{
unsigned i;
for (i = 0; i < individual (); i++)
if (individual[i].cb == c && individual[i].src == src
&& individual[i].dest == dest)
{
individual[i] = individual[individual () - 1];
individual.resize (individual () - 1);
TRACEPRINTF (t, 3, this, "deregisterIndividual %08X = 1", c);
for (i = 0; i < individual (); i++)
{
if (individual[i].dest == dest)
return 1;
}
if (dest)
for (i = 0; i < layer2 (); i++)
layer2[i].l2->removeAddress (dest);
return 1;
}
TRACEPRINTF (t, 3, this, "deregisterIndividual %08X = 0", c);
return 0;
}
示例5: pth_event
void
EIBNetIPRouter::Run (pth_sem_t * stop1)
{
pth_event_t stop = pth_event (PTH_EVENT_SEM, stop1);
while (pth_event_status (stop) != PTH_STATUS_OCCURRED)
{
EIBNetIPPacket *p = sock->Get (stop);
if (p)
{
if (p->service != ROUTING_INDICATION)
{
delete p;
continue;
}
if (p->data () < 2 || p->data[0] != 0x29)
{
if (p->data () < 2)
{
TRACEPRINTF (t, 2, this, "No payload (%d)", p->data ());
}
else
{
TRACEPRINTF (t, 2, this, "Payload not L_Data.ind (%02x)", p->data[0]);
}
delete p;
continue;
}
const CArray data = p->data;
delete p;
L_Data_PDU *c = CEMI_to_L_Data (data, this);
if (c)
{
TRACEPRINTF (t, 2, this, "Recv %s", c->Decode ()());
if (mode & BUSMODE_UP)
{
if (mode == BUSMODE_VMONITOR)
{
L_Busmonitor_PDU *l2 = new L_Busmonitor_PDU (this);
l2->pdu.set (c->ToPacket ());
l3->recv_L_Data (l2);
}
l3->recv_L_Data (c);
continue;
}
L_Busmonitor_PDU *p1 = new L_Busmonitor_PDU (this);
p1->pdu = c->ToPacket ();
delete c;
l3->recv_L_Data (p1);
continue;
}
}
}
pth_event_free (stop, PTH_FREE_THIS);
}
示例6: TRACEPRINTF
Layer7_Broadcast::Layer7_Broadcast (Layer3 * l3, Trace * tr)
{
t = tr;
TRACEPRINTF (t, 5, this, "L7Broadcast Open");
l4 = new T_Broadcast (l3, tr, 0);
if (!l4->init ())
{
TRACEPRINTF (t, 5, this, "L7Broadcast init bad");
delete l4;
l4 = 0;
}
}
示例7: TRACEPRINTF
void
Layer3::deregisterServer (BaseServer * s)
{
unsigned i;
for (i = 0; i < servers (); i++)
if (servers[i] == s)
{
servers[i] = servers[servers () - 1];
servers.resize (servers () - 1);
TRACEPRINTF (t, 3, this, "deregisterServer %08X = 1", s);
return;
}
TRACEPRINTF (t, 3, this, "deregisterServer %08X = 0", s);
}
示例8: TRACEPRINTF
EIBNetIPTunnel::EIBNetIPTunnel (const char *dest, int port, int sport,
const char *srcip, int Dataport, int flags,
Trace * tr)
{
t = tr;
TRACEPRINTF (t, 2, this, "Open");
pth_sem_init (&insignal);
pth_sem_init (&outsignal);
getwait = pth_event (PTH_EVENT_SEM, &outsignal);
noqueue = flags & FLAG_B_TUNNEL_NOQUEUE;
sock = 0;
if (!GetHostIP (&caddr, dest))
return;
caddr.sin_port = htons (port);
if (!GetSourceAddress (&caddr, &raddr))
return;
raddr.sin_port = htons (sport);
NAT = false;
dataport = Dataport;
sock = new EIBNetIPSocket (raddr, 0, t);
if (!sock->init ())
{
delete sock;
sock = 0;
return;
}
if (srcip)
{
if (!GetHostIP (&saddr, srcip))
{
delete sock;
sock = 0;
return;
}
saddr.sin_port = htons (sport);
NAT = true;
}
else
saddr = raddr;
sock->sendaddr = caddr;
sock->recvaddr = caddr;
sock->recvall = 0;
mode = 0;
vmode = 0;
support_busmonitor = 1;
connect_busmonitor = 0;
Start ();
TRACEPRINTF (t, 2, this, "Opened");
}
示例9: pth_event
void Layer2Runner::Run(pth_sem_t * stop1)
{
pth_event_t stop = pth_event (PTH_EVENT_SEM, stop1);
unsigned i;
TRACEPRINTF (l2->t, 3, this, "L2r running: %08X", l2);
while (pth_event_status (stop) != PTH_STATUS_OCCURRED)
{
LPDU *l = l2->Get_L_Data (stop);
if (!l)
continue;
l3->recv_L_Data(l);
}
TRACEPRINTF (l2->t, 3, this, "L2r stopped: %08X", l2);
}
示例10: TRACEPRINTF
void
TPUARTLayer2Driver::Send_L_Data (LPDU * l)
{
TRACEPRINTF (t, 2, this, "Send %s", l->Decode ()());
inqueue.put (l);
pth_sem_inc (&in_signal, 1);
}
示例11: TRACEPRINTF
USBLoop::USBLoop (libusb_context * c, Trace * tr)
{
t = tr;
context = c;
TRACEPRINTF (t, 10, this, "USBLoop-Create");
Start ();
}
示例12: TRACEPRINTF
EIBNetIPRouter::~EIBNetIPRouter ()
{
TRACEPRINTF (t, 2, this, "Destroy");
Stop ();
if (sock)
delete sock;
}
示例13: Layer2
USBLayer2::USBLayer2 (LowLevelDriver * i, Layer3 * l3,
L2options *opt) : Layer2 (l3, opt)
{
emi = 0;
LowLevelDriver *iface = initUSBDriver (i, t);
if (!iface)
return;
switch (iface->getEMIVer ())
{
case LowLevelDriver::vEMI1:
emi = new EMI1Layer2 (iface, l3, opt);
break;
case LowLevelDriver::vEMI2:
emi = new EMI2Layer2 (iface, l3, opt);
break;
case LowLevelDriver::vCEMI:
emi = new CEMILayer2 (iface, l3, opt);
break;
default:
TRACEPRINTF (t, 2, this, "Unsupported EMI");
delete iface;
return;
}
}
示例14: TRACEPRINTF
TPUARTwrap::~TPUARTwrap ()
{
TRACEPRINTF (t, 2, "Close");
timer.stop();
sendtimer.stop();
}
示例15: TRACEPRINTF
GroupCache::~GroupCache ()
{
TRACEPRINTF (t, 4, this, "GroupCacheDestroy");
if (enable)
layer3->deregisterGroupCallBack (this, 0);
Clear ();
}