本文整理汇总了C++中zlog函数的典型用法代码示例。如果您正苦于以下问题:C++ zlog函数的具体用法?C++ zlog怎么用?C++ zlog使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zlog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bgp_keepalive_timer
/* BGP keepalive fire ! */
static int
bgp_keepalive_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_keepalive = NULL;
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (keepalive timer expire)",
peer->host__item);
THREAD_VAL (thread) = KeepAlive_timer_expired;
bgp_event (thread); /* bgp_event unlocks peer */
return 0;
}
示例2: bgp_holdtime_timer
/* BGP holdtime timer. */
static int
bgp_holdtime_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_holdtime = NULL;
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (holdtime timer expire)",
peer->host);
THREAD_VAL (thread) = Hold_Timer_expired;
bgp_event (thread);
return 0;
}
示例3: sockunion_bind
/* Bind socket to specified address. */
int
sockunion_bind (int sock, union sockunion *su, unsigned short port,
union sockunion *su_addr)
{
int size = 0;
int ret;
if (su->sa.sa_family == AF_INET)
{
size = sizeof (struct sockaddr_in);
su->sin.sin_port = htons (port);
#ifdef HAVE_SIN_LEN
su->sin.sin_len = size;
#endif /* HAVE_SIN_LEN */
if (su_addr == NULL)
su->sin.sin_addr.s_addr = htonl (INADDR_ANY);
}
#ifdef HAVE_IPV6
else if (su->sa.sa_family == AF_INET6)
{
size = sizeof (struct sockaddr_in6);
su->sin6.sin6_port = htons (port);
#ifdef SIN6_LEN
su->sin6.sin6_len = size;
#endif /* SIN6_LEN */
if (su_addr == NULL)
{
#if defined(LINUX_IPV6) || defined(NRL)
memset (&su->sin6.sin6_addr, 0, sizeof (struct in6_addr));
#else
su->sin6.sin6_addr = in6addr_any;
#endif /* LINUX_IPV6 */
}
}
#endif /* HAVE_IPV6 */
ret = bind (sock, (struct sockaddr *)su, size);
#ifdef FOX_RIP_DEBUG
if (ret < 0)
zlog (NULL, LOG_WARNING, "can't bind socket : %s", strerror (errno));
#endif /* FOX_RIP_DEBUG */
return ret;
}
示例4: MakeLowerString
bool ZoneServer::SetZone(uint32 iZoneID, uint32 iInstanceID, bool iStaticZone) {
BootingUp = false;
const char* zn = MakeLowerString(database.GetZoneName(iZoneID));
char* longname;
if (iZoneID)
zlog(WORLD__ZONE,"Setting to '%s' (%d:%d)%s",(zn) ? zn : "",iZoneID, iInstanceID,
iStaticZone ? " (Static)" : "");
zoneID = iZoneID;
instanceID = iInstanceID;
if(iZoneID!=0)
oldZoneID = iZoneID;
if (zoneID == 0) {
client_list.CLERemoveZSRef(this);
pNumPlayers = 0;
LSSleepUpdate(GetPrevZoneID());
}
staticzone = iStaticZone;
if (zn)
{
strn0cpy(zone_name, zn, sizeof(zone_name));
if( database.GetZoneLongName( (char*)zone_name, &longname, NULL, NULL, NULL, NULL, NULL, NULL ) )
{
strn0cpy(long_name, longname, sizeof(long_name));
safe_delete_array( longname );
}
else
strcpy(long_name, "");
}
else
{
strcpy(zone_name, "");
strcpy(long_name, "");
}
client_list.ZoneBootup(this);
ls_zboot.Start();
return true;
}
示例5: ipv4_multicast_join
/* Join to the RIP version 2 multicast group. */
static int
ipv4_multicast_join (int sock,
struct in_addr group,
struct in_addr ifa,
unsigned int ifindex)
{
int ret;
ret = setsockopt_ipv4_multicast (sock,
IP_ADD_MEMBERSHIP,
group.s_addr,
ifindex);
if (ret < 0)
zlog (NULL, LOG_INFO, "can't setsockopt IP_ADD_MEMBERSHIP %s",
safe_strerror (errno));
return ret;
}
示例6: fpm_request_finished
void fpm_request_finished() /* {{{ */
{
struct fpm_scoreboard_proc_s *proc;
struct timeval now;
fpm_clock_get(&now);
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
proc->request_stage = FPM_REQUEST_FINISHED;
proc->tv = now;
memset(&proc->accepted, 0, sizeof(proc->accepted));
proc->accepted_epoch = 0;
fpm_scoreboard_proc_release(proc);
}
示例7: fpm_trace_ready
int fpm_trace_ready(pid_t pid)
{
kern_return_t kr;
kr = task_for_pid(mach_task_self(), pid, &target);
if (kr != KERN_SUCCESS) {
char *msg = "";
if (kr == KERN_FAILURE) {
msg = " It seems that master process does not have enough privileges to trace processes.";
}
zlog(ZLOG_STUFF, ZLOG_ERROR, "task_for_pid() failed: %s (%d)%s", mach_error_string(kr), kr, msg);
return -1;
}
return 0;
}
示例8: sockunion_getpeername
/* After TCP connection is established. Get remote address and port. */
union sockunion *
sockunion_getpeername (int fd)
{
int ret;
socklen_t len;
union
{
struct sockaddr sa;
struct sockaddr_in sin;
#ifdef HAVE_IPV6
struct sockaddr_in6 sin6;
#endif /* HAVE_IPV6 */
char tmp_buffer[128];
} name;
union sockunion *su;
memset (&name, 0, sizeof name);
len = sizeof name;
ret = getpeername (fd, (struct sockaddr *)&name, &len);
if (ret < 0)
{
zlog (NULL, LOG_WARNING, "Can't get remote address and port: %s",
safe_strerror (errno));
return NULL;
}
if (name.sa.sa_family == AF_INET)
{
su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
memcpy (su, &name, sizeof (struct sockaddr_in));
return su;
}
#ifdef HAVE_IPV6
if (name.sa.sa_family == AF_INET6)
{
su = XCALLOC (MTYPE_SOCKUNION, sizeof (union sockunion));
memcpy (su, &name, sizeof (struct sockaddr_in6));
sockunion_normalise_mapped (su);
return su;
}
#endif /* HAVE_IPV6 */
return NULL;
}
示例9: ospf_hello_timer
int ospf_hello_timer(struct thread *thread)
{
struct ospf_interface *oi;
oi = THREAD_ARG(thread);
oi->t_hello = NULL;
if (IS_DEBUG_OSPF(ism, ISM_TIMERS))
zlog(NULL, LOG_DEBUG, "ISM[%s]: Timer (Hello timer expire)",
IF_NAME(oi));
/* Sending hello packet. */
ospf_hello_send(oi);
/* Hello timer set. */
OSPF_HELLO_TIMER_ON(oi);
return 0;
}
示例10: fpm_event_poll_remove
/*
* Remove a FD from the fd set
*/
static int fpm_event_poll_remove(struct fpm_event_s *ev) /* {{{ */
{
int i;
/* do we have a direct access */
if (ev->index >= 0 && ev->index < npollfds && pollfds[ev->index].fd == ev->fd) {
/* remember this slot as free */
next_free_slot = ev->index;
/* clear event in pollfds */
pollfds[ev->index].fd = -1;
pollfds[ev->index].events = 0;
/* mark the event as not registered */
ev->index = -1;
return 0;
}
/* let's search */
for (i = 0; i < npollfds; i++) {
if (pollfds[i].fd != ev->fd) {
/* not found */
continue;
}
/* remember this slot as free */
next_free_slot = i;
/* clear event in pollfds */
pollfds[i].fd = -1;
pollfds[i].events = 0;
/* mark the event as not registered */
ev->index = -1;
return 0;
}
zlog(ZLOG_ERROR, "poll: unable to remove event: not found (fd=%d, index=%d)", ev->fd, ev->index);
return -1;
}
示例11: bgp_md5_set_socket
/*
* Set MD5 key for the socket, for the given IPv4 peer address.
* If the password is NULL or zero-length, the option will be disabled.
*/
static int
bgp_md5_set_socket (int socket, union sockunion *su, const char *password)
{
int ret = -1;
int en = ENOSYS;
assert (socket >= 0);
#if HAVE_DECL_TCP_MD5SIG
ret = sockopt_tcp_signature (socket, su, password);
en = errno;
#endif /* HAVE_TCP_MD5SIG */
if (ret < 0)
zlog (NULL, LOG_WARNING, "can't set TCP_MD5SIG option on socket %d: %s",
socket, safe_strerror (en));
return ret;
}
示例12: bgp_fsm_holdtime_expire
/* Hold timer expire. This is error of BGP connection. So cut the
peer and change to Idle status. */
static int
bgp_fsm_holdtime_expire (struct peer *peer)
{
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG, "%s [FSM] Hold timer expire", peer->host);
/* Send notify to remote peer. */
bgp_notify_send (peer, BGP_NOTIFY_HOLD_ERR, 0);
/* Sweep if it is temporary peer. */
if (CHECK_FLAG (peer->sflags, PEER_STATUS_ACCEPT_PEER))
{
zlog_info ("%s [Event] Accepting BGP peer is deleted", peer->host);
peer_delete (peer);
return -1;
}
return 0;
}
示例13: bgp_start_timer
/* BGP start timer. This function set BGP_Start event to thread value
and process event. */
static int
bgp_start_timer (struct thread *thread)
{
struct peer *peer;
peer = THREAD_ARG (thread);
peer->t_start = NULL;
UNSET_FLAG (peer->sflags, PEER_STATUS_CREATE_INIT);
if (BGP_DEBUG (fsm, FSM))
zlog (peer->log, LOG_DEBUG,
"%s [FSM] Timer (start timer expire).", peer->host);
THREAD_VAL (thread) = BGP_Start;
bgp_event (thread);
return 0;
}
示例14: fpm_status_handle_status
/* return 0 if it's not the request page
* return 1 if ouput has been set)
* *output unchanged: error (return 500)
* *output changed: no error (return 200)
*/
int fpm_status_handle_status(char *uri, char *query_string, char **output, char **content_type) /* {{{ */
{
struct fpm_status_s status;
if (!fpm_status_uri || !uri) {
return 0;
}
/* It's not the status page */
if (strcmp(fpm_status_uri, uri)) {
return 0;
}
if (!output || !content_type || !fpm_status_shm) {
return 1;
}
if (!fpm_status_shm->mem) {
return 1;
}
/* one shot operation */
status = *(struct fpm_status_s *)fpm_status_shm->mem;
if (status.idle < 0 || status.active < 0 || status.total < 0) {
return 1;
}
if (query_string && strstr(query_string, "html")) {
fpm_status_handle_status_html(&status, output, content_type);
} else if (query_string && strstr(query_string, "json")) {
fpm_status_handle_status_json(&status, output, content_type);
} else {
fpm_status_handle_status_txt(&status, output, content_type);
}
if (!*output || !content_type) {
zlog(ZLOG_ERROR, "[pool %s] unable to allocate status ouput buffer", fpm_status_pool);
return 1;
}
return 1;
}
示例15: fpm_request_reading_headers
void fpm_request_reading_headers() /* {{{ */
{
struct fpm_scoreboard_proc_s *proc;
struct timeval now;
clock_t now_epoch;
#ifdef HAVE_TIMES
struct tms cpu;
#endif
fpm_clock_get(&now);
now_epoch = time(NULL);
#ifdef HAVE_TIMES
times(&cpu);
#endif
proc = fpm_scoreboard_proc_acquire(NULL, -1, 0);
if (proc == NULL) {
zlog(ZLOG_WARNING, "failed to acquire proc scoreboard");
return;
}
proc->request_stage = FPM_REQUEST_READING_HEADERS;
proc->tv = now;
proc->accepted = now;
proc->accepted_epoch = now_epoch;
#ifdef HAVE_TIMES
proc->cpu_accepted = cpu;
#endif
proc->requests++;
proc->request_uri[0] = '\0';
proc->request_method[0] = '\0';
proc->script_filename[0] = '\0';
proc->query_string[0] = '\0';
proc->query_string[0] = '\0';
proc->auth_user[0] = '\0';
proc->content_length = 0;
fpm_scoreboard_proc_release(proc);
/* idle--, active++, request++ */
fpm_scoreboard_update(-1, 1, 0, 0, 1, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
}