本文整理汇总了C++中dmsg函数的典型用法代码示例。如果您正苦于以下问题:C++ dmsg函数的具体用法?C++ dmsg怎么用?C++ dmsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dmsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_ping_send_dowork
/*
* Should we ping the remote?
*/
void
check_ping_send_dowork (struct context *c)
{
c->c2.buf = c->c2.buffers->aux_buf;
ASSERT (buf_init (&c->c2.buf, FRAME_HEADROOM (&c->c2.frame)));
ASSERT (buf_safe (&c->c2.buf, MAX_RW_SIZE_TUN (&c->c2.frame)));
ASSERT (buf_write (&c->c2.buf, ping_string, sizeof (ping_string)));
/*
* We will treat the ping like any other outgoing packet,
* encrypt, sign, etc.
*/
encrypt_sign (c, true);
dmsg (D_PING, "SENT PING");
}
示例2: check_coarse_timers_dowork
static void
check_coarse_timers_dowork (struct context *c)
{
const struct timeval save = c->c2.timeval;
c->c2.timeval.tv_sec = BIG_TIMEOUT;
c->c2.timeval.tv_usec = 0;
process_coarse_timers (c);
c->c2.coarse_timer_wakeup = now + c->c2.timeval.tv_sec;
dmsg (D_INTERVAL, "TIMER: coarse timer wakeup %d seconds", (int) c->c2.timeval.tv_sec);
/* Is the coarse timeout NOT the earliest one? */
if (c->c2.timeval.tv_sec > save.tv_sec)
c->c2.timeval = save;
}
示例3: reliable_can_get
/* true if at least one free buffer available */
bool
reliable_can_get (const struct reliable *rel)
{
struct gc_arena gc = gc_new ();
int i;
for (i = 0; i < rel->size; ++i)
{
const struct reliable_entry *e = &rel->array[i];
if (!e->active)
return true;
}
dmsg (D_REL_LOW, "ACK no free receive buffer available: %s", reliable_print_ids (rel, &gc));
gc_free (&gc);
return false;
}
示例4: plugin_call_item
static int
plugin_call_item (const struct plugin *p,
void *per_client_context,
const int type,
const struct argv *av,
struct openvpn_plugin_string_list **retlist,
const char **envp)
{
int status = OPENVPN_PLUGIN_FUNC_SUCCESS;
/* clear return list */
if (retlist)
*retlist = NULL;
if (p->plugin_handle && (p->plugin_type_mask & OPENVPN_PLUGIN_MASK (type)))
{
struct gc_arena gc = gc_new ();
struct argv a = argv_insert_head (av, p->so_pathname);
dmsg (D_PLUGIN_DEBUG, "PLUGIN_CALL: PRE type=%s", plugin_type_name (type));
plugin_show_args_env (D_PLUGIN_DEBUG, (const char **)a.argv, envp);
/*
* Call the plugin work function
*/
if (p->func2)
status = (*p->func2)(p->plugin_handle, type, (const char **)a.argv, envp, per_client_context, retlist);
else if (p->func1)
status = (*p->func1)(p->plugin_handle, type, (const char **)a.argv, envp);
else
ASSERT (0);
msg (D_PLUGIN, "PLUGIN_CALL: POST %s/%s status=%d",
p->so_pathname,
plugin_type_name (type),
status);
if (status == OPENVPN_PLUGIN_FUNC_ERROR)
msg (M_WARN, "PLUGIN_CALL: plugin function %s failed with status %d: %s",
plugin_type_name (type),
status,
p->so_pathname);
argv_reset (&a);
gc_free (&gc);
}
return status;
}
示例5: bio_write
/*
* Write to an OpenSSL BIO in non-blocking mode.
*/
static int
bio_write (BIO *bio, const uint8_t *data, int size, const char *desc)
{
int i;
int ret = 0;
ASSERT (size >= 0);
if (size)
{
/*
* Free the L_TLS lock prior to calling BIO routines
* so that foreground thread can still call
* tls_pre_decrypt or tls_pre_encrypt,
* allowing tunnel packet forwarding to continue.
*/
#ifdef BIO_DEBUG
bio_debug_data ("write", bio, data, size, desc);
#endif
i = BIO_write (bio, data, size);
if (i < 0)
{
if (BIO_should_retry (bio))
{
;
}
else
{
msg (D_TLS_ERRORS | M_SSL, "TLS ERROR: BIO write %s error",
desc);
ret = -1;
ERR_clear_error ();
}
}
else if (i != size)
{
msg (D_TLS_ERRORS | M_SSL,
"TLS ERROR: BIO write %s incomplete %d/%d", desc, i, size);
ret = -1;
ERR_clear_error ();
}
else
{ /* successful write */
dmsg (D_HANDSHAKE_VERBOSE, "BIO write %s %d bytes", desc, i);
ret = 1;
}
}
return ret;
}
示例6: lz4v2_decompress
static void
lz4v2_decompress(struct buffer *buf, struct buffer work,
struct compress_context *compctx,
const struct frame *frame)
{
size_t zlen_max = EXPANDED_SIZE(frame);
uint8_t c; /* flag indicating whether or not our peer compressed */
if (buf->len <= 0)
{
return;
}
ASSERT(buf_init(&work, FRAME_HEADROOM(frame)));
/* do unframing/swap (assumes buf->len > 0) */
uint8_t *head = BPTR(buf);
c = *head;
/* Not compressed */
if (c != COMP_ALGV2_INDICATOR_BYTE)
{
return;
}
/* Packet to short to make sense */
if (buf->len <= 1)
{
buf->len = 0;
return;
}
c = head[1];
if (c == COMP_ALGV2_LZ4_BYTE) /* packet was compressed */
{
buf_advance(buf,2);
do_lz4_decompress(zlen_max, &work, buf, compctx);
}
else if (c == COMP_ALGV2_UNCOMPRESSED_BYTE)
{
buf_advance(buf,2);
}
else
{
dmsg(D_COMP_ERRORS, "Bad LZ4v2 decompression header byte: %d", c);
buf->len = 0;
}
}
示例7: reliable_schedule_now
/* schedule all pending packets for immediate retransmit */
void
reliable_schedule_now (struct reliable *rel)
{
int i;
dmsg (D_REL_DEBUG, "ACK reliable_schedule_now");
rel->hold = false;
for (i = 0; i < rel->size; ++i)
{
struct reliable_entry *e = &rel->array[i];
if (e->active)
{
e->next_try = now;
e->timeout = rel->initial_timeout;
}
}
}
示例8: replay_bind_cont
static void replay_bind_cont(void *st, errval_t err, struct replay_binding *b)
{
static int slavenum = 0;
struct slave *sl = &SlState.slaves[slavenum];
slavenum++;
dmsg("ENTER\n");
//printf("%s:%s MY TASKGRAPH IS %p\n", __FILE__, __FUNCTION__, &TG);
assert(err_is_ok(err));
sl->b = b;
b->rx_vtbl = replay_vtbl;
b->st = &TG;
bound = true;
/* printf("assigned binding to %p\n", sl); */
}
示例9: dmsg
/**
* @brief Order loading of a new instrument.
*
* The request will go into a queue waiting to be processed by the
* class internal task thread. This method will immediately return and
* the instrument will be loaded in the background.
*
* @param Filename - file name of the instrument
* @param uiInstrumentIndex - index of the instrument within the file
* @param pEngineChannel - engine channel on which the instrument should be loaded
*/
void InstrumentManagerThread::StartNewLoad(String Filename, uint uiInstrumentIndex, EngineChannel* pEngineChannel) {
dmsg(1,("Scheduling '%s' (Index=%d) to be loaded in background (if not loaded yet).\n",Filename.c_str(),uiInstrumentIndex));
// already tell the engine which instrument to load
pEngineChannel->PrepareLoadInstrument(Filename.c_str(), uiInstrumentIndex);
command_t cmd;
cmd.type = command_t::DIRECT_LOAD;
cmd.pEngineChannel = pEngineChannel;
mutex.Lock();
queue.push_back(cmd);
mutex.Unlock();
StartThread(); // ensure thread is running
conditionJobsLeft.Set(true); // wake up thread
}
示例10: start_threads
static void start_threads(void)
{
int i;
tinfo = calloc(nb_thread, sizeof(struct thread_info_s));
if (tinfo == NULL)
handle_error("calloc");
for( i=0; i < nb_thread; i++)
{
tinfo[i].thread_num = i;
if(pthread_create(&tinfo[i].thread_id, NULL, mr_map, &tinfo[i]))
handle_error("thread create");
dmsg("Thread number %d launched\n", i);
}
}
示例11: dmsg
void AudioThread::CacheInitialSamples(gig::Sample* pSample) {
if (!pSample || pSample->GetCache().Size) return;
if (pSample->SamplesTotal <= NUM_RAM_PRELOAD_SAMPLES) {
// Sample is too short for disk streaming, so we load the whole
// sample into RAM and place 'pAudioIO->FragmentSize << MAX_PITCH'
// number of '0' samples (silence samples) behind the official buffer
// border, to allow the interpolator do it's work even at the end of
// the sample.
gig::buffer_t buf = pSample->LoadSampleDataWithNullSamplesExtension(pAudioIO->FragmentSize << MAX_PITCH);
dmsg(("Cached %d Bytes, %d silence bytes.\n", buf.Size, buf.NullExtensionSize));
}
else { // we only cache NUM_RAM_PRELOAD_SAMPLES and stream the other sample points from disk
pSample->LoadSampleData(NUM_RAM_PRELOAD_SAMPLES);
}
if (!pSample->GetCache().Size) std::cerr << "Unable to cache sample - maybe memory full!" << std::endl << std::flush;
}
示例12: modmult
static void modmult(Bignum r1, Bignum r2, Bignum modulus, Bignum result) {
Bignum temp = newbn(modulus[0]+1);
Bignum tmp2 = newbn(modulus[0]+1);
int i;
int bit, bits, digit, smallbit;
enter((">modmult\n"));
debug(r1);
debug(r2);
debug(modulus);
for (i=1; i<=result[0]; i++)
result[i] = 0; /* result := 0 */
for (i=1; i<=temp[0]; i++)
temp[i] = (i > r2[0] ? 0 : r2[i]); /* temp := r2 */
bits = 1+msb(r1);
for (bit = 0; bit < bits; bit++) {
digit = 1 + bit / 16;
smallbit = bit % 16;
debug(temp);
if (digit <= r1[0] && (r1[digit] & (1<<smallbit))) {
dmsg(("bit %d\n", bit));
add(temp, result, tmp2);
if (ge(tmp2, modulus))
sub(tmp2, modulus, result);
else
add(tmp2, Zero, result);
debug(result);
}
add(temp, temp, tmp2);
if (ge(tmp2, modulus))
sub(tmp2, modulus, temp);
else
add(tmp2, Zero, temp);
}
freebn(temp);
freebn(tmp2);
debug(result);
leave(("<modmult\n"));
}
示例13: process_incoming_tun
void
process_incoming_tun (struct context *c)
{
struct gc_arena gc = gc_new ();
perf_push (PERF_PROC_IN_TUN);
if (c->c2.buf.len > 0)
c->c2.tun_read_bytes += c->c2.buf.len;
#ifdef LOG_RW
if (c->c2.log_rw && c->c2.buf.len > 0)
fprintf (stderr, "r");
#endif
/* Show packet content */
dmsg (D_TUN_RW, "TUN READ [%d]", BLEN (&c->c2.buf));
if (c->c2.buf.len > 0)
{
if ((c->options.mode == MODE_POINT_TO_POINT) && (!c->options.allow_recursive_routing))
drop_if_recursive_routing (c, &c->c2.buf);
/*
* The --passtos and --mssfix options require
* us to examine the IP header (IPv4 or IPv6).
*/
process_ip_header (c, PIPV4_PASSTOS|PIP_MSSFIX|PIPV4_CLIENT_NAT, &c->c2.buf);
#ifdef PACKET_TRUNCATION_CHECK
/* if (c->c2.buf.len > 1) --c->c2.buf.len; */
ipv4_packet_size_verify (BPTR (&c->c2.buf),
BLEN (&c->c2.buf),
TUNNEL_TYPE (c->c1.tuntap),
"PRE_ENCRYPT",
&c->c2.n_trunc_pre_encrypt);
#endif
encrypt_sign (c, true);
}
else
{
buf_reset (&c->c2.to_link);
}
perf_pop ();
gc_free (&gc);
}
示例14: dmsg
void DirectoryScanner::Scan(String DbDir, String FsDir, bool Flat, bool insDir, ScanProgress* pProgress) {
dmsg(2,("DirectoryScanner: Scan(DbDir=%s,FsDir=%s,Flat=%d,insDir=%d)\n", DbDir.c_str(), FsDir.c_str(), Flat, insDir));
if (DbDir.empty() || FsDir.empty()) throw Exception("Directory expected");
this->DbDir = DbDir;
this->FsDir = FsDir;
this->insDir = insDir;
if (DbDir.at(DbDir.length() - 1) != '/') {
this->DbDir.append("/");
}
if (FsDir.at(FsDir.length() - 1) != File::DirSeparator) {
this->FsDir.push_back(File::DirSeparator);
}
this->Flat = Flat;
this->pProgress = pProgress;
File::WalkDirectoryTree(FsDir, this);
}
示例15: proxy_connection_io_recv
static int
proxy_connection_io_recv (struct proxy_connection *pc)
{
/* recv data from socket */
const int status = recv (pc->sd, BPTR(&pc->buf), BCAP(&pc->buf), MSG_NOSIGNAL);
if (status < 0)
{
return (errno == EAGAIN) ? IOSTAT_EAGAIN_ON_READ : IOSTAT_READ_ERROR;
}
else
{
if (!status)
return IOSTAT_READ_ERROR;
dmsg (D_PS_PROXY_DEBUG, "PORT SHARE PROXY: read[%d] %d", (int)pc->sd, status);
pc->buf.len = status;
}
return IOSTAT_GOOD;
}