Exemple #1
0
static void push_timer_from_row(MYSQL_ROW row, int fields) 
{
	char *rng_duration, *rng_time;
	bool rng_sub;
	if( fields < 3 ) {
		wrn_print("fields(%d) < 3",fields);
		return;
	}
	
	rng_sub = !!atoi(row[4]);
	rng_duration = row[3];
	rng_time = row[2]; 
	
	struct sigevent se;
	se.sigev_notify = SIGEV_SIGNAL;
	se.sigev_signo = fit_default_durations(rng_duration);

	if(se.sigev_signo == -1 ) {				
		se.sigev_signo = SIG_RING_CUSTOM;				
		se.sigev_value.sival_int = duration(rng_duration);
	}

	
	if( push_timer_from_string(&se, rng_time, NULL,TIMER_ABSTIME,1) == -1 ) {
		wrn_print("push_timer_from_string %s", rng_time);
		return;			
	}
	
	dbg_print("    duration: (%ss) time: (%s)",rng_duration, rng_time);	
	
	if (rng_sub || sub_bell_conf.global_enable) {
	
		struct sigevent sub_se;		
		struct timespec exp;
		time_t tm, gap; 

		sub_se.sigev_value.sival_int = sub_bell_conf.ring_for;		
		sub_se.sigev_notify = SIGEV_SIGNAL;
		sub_se.sigev_signo = SIG_RING_CUSTOM;						
				
		gap = str_to_time(sub_bell_conf.ring_before, 0);
		gap -= timezone;              
                 /* ??? what ???*/
                 
		tm = str_to_time(rng_time, 1);	
		
		exp.tv_sec = tm - gap;
		exp.tv_nsec = 0;
		
		dbg_print("Sub duartion: (%ldns) time: (%s/%ld)", 
			(long) sub_bell_conf.ring_for,str_time("%H:%M:%S",&exp.tv_sec),
			(long)exp.tv_sec);
		
		if(push_timer(&sub_se, &exp, NULL,TIMER_ABSTIME,1) == -1) {
			wrn_print("push_timer");
			return;
		} 
	}
	
}
Exemple #2
0
static void plainprpl_get_info(PurpleConnection *gc, const char *buddy_name)
{
	PurpleBuddy *buddy;
	plain_buddy_state *bstate;
	PurpleNotifyUserInfo *info;
	const char *addr_str;

	buddy = purple_find_buddy(gc->account, buddy_name);
	bstate = purple_buddy_get_protocol_data(buddy);
	info = purple_notify_user_info_new();

	if (bstate) {

		PurplePresence *presence = purple_buddy_get_presence(buddy);
		PurpleStatus *status = purple_presence_get_active_status(presence);
		const char *status_name = purple_status_get_name(status);

		purple_notify_user_info_add_pair(info, "Status", status_name);
		addr_str = purple_blist_node_get_string(PURPLE_BLIST_NODE(buddy), "addr_str");
		purple_notify_user_info_add_pair(info, "Address", addr_str);
		if (bstate->state == BUDDY_STATE_RESOLVE) {
			/* The IP address has not been resolved yet */
			purple_notify_user_info_add_pair(info, "Resolved", "Unknown");
		} else {
			purple_notify_user_info_add_pair(info, "Resolved", str_addr(&bstate->addr));
		}
		purple_notify_user_info_add_pair(info, "Last Seen", str_time(bstate->time_recv));
	} else {
		purple_notify_user_info_add_pair(info, "Info", "Missing Data");
	}

	/* Show a buddy's user info in a nice dialog box */
	purple_notify_userinfo(gc, buddy_name, info, NULL, NULL);
}
Exemple #3
0
bool dSolverNode::expandFileExpression(std::string const& expr, std::string &base_name, std::string &extension)
{
    std::vector<std::string> tokens;

    //check for extension
    tokenize(expr, tokens, ".");
    if(tokens.size() < 2) return false;
    if(tokens.back().size() != 3) return false;
    extension = tokens.back();

    std::copy(expr.begin(), expr.end() - 4, std::back_inserter(base_name));

    int time = (int) m_prevTime.value();

    std::stringstream ss;
    ss << time;
    std::string str_time(ss.str());
    //replace ${frame}
    replace(base_name, "${frame}", str_time);

    //replace ${waveFrame}
    while(str_time.size() < 4) str_time = "0" + str_time;
    replace(base_name, "${waveFrame}", str_time);

    return true;
}
/*-------------------------------------------------------------*/
void AzTimeLog::_printTime(const AzOut &out)
{
  if (out.isNull()) return; 
  time_t ltime; 
  time(&ltime); 
  AzBytArr str_time(ctime(&ltime)); 
  str_time.strip(); /* remove new line in the end */
  str_time.c(": "); 
  AzPrint::write(out, str_time); 
}
Exemple #5
0
int Send_TrcMsg_BlkMsg_SMPP2COND (SMS_INFO *rcvBlkMsg, int trace_type)
{
    GeneralQMsgType txGenQMsg;
    IxpcQMsgType    *txIxpcMsg = NULL;
    char            szTrcMsg[4096];
    int             dMsgLen= 0, dTxLen;
    struct timeval  stTmval;
    char            sztimebuf[128];
    char			szTypeStr[512];

    memset(&stTmval, 0x00, sizeof(struct timeval));
    memset(&sztimebuf, 0x00, sizeof(sztimebuf));
    memset(&txGenQMsg, 0x00, sizeof(txGenQMsg));
    memset(szTrcMsg, 0x00, 4096);

    txGenQMsg.mtype = MTYPE_TRC_CONSOLE;
    txIxpcMsg = (IxpcQMsgType*)txGenQMsg.body;
    memset((void*)&txIxpcMsg->head, 0x00, sizeof(txIxpcMsg->head));

    strcpy(txIxpcMsg->head.srcSysName, mySysName);
    strcpy(txIxpcMsg->head.srcAppName, myAppName);
    strcpy(txIxpcMsg->head.dstSysName, "DSCM");
    strcpy(txIxpcMsg->head.dstAppName, "COND");

    gettimeofday(&stTmval, NULL );
    sprintf( sztimebuf,"[%s.%06ld]", str_time(stTmval.tv_sec), stTmval.tv_usec);
    sprintf (szTypeStr, "SMS : block info Message\nblock time:%d\nP/H:%02d %02d\nsms msg:%s "
             , rcvBlkMsg->blkTm, rcvBlkMsg->sPBit, rcvBlkMsg->sHBit, rcvBlkMsg->smsMsg);

    if (trace_type == TRACE_METHOD_IMSI) {
        dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "IMSI:%s S7000 CALL TRACE INFORMATION (SMPP)\n", rcvBlkMsg->subsID);
    } else if (trace_type == TRACE_METHOD_IP) {
        dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "IP:%s: S7000 CALL TRACE INFORMATION (SMPP)\n", rcvBlkMsg->subsIP);
    }
    else {
        dAppLog(LOG_CRI, "trace type is wrong(%d)", trace_type);
    }
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "%s\t%s \n", mySysName, sztimebuf);
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "------------------------------------------------------------\n");
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "Trace Log] %s \n", szTypeStr);

    txIxpcMsg->head.bodyLen = dMsgLen;
    memcpy(txIxpcMsg->body, szTrcMsg, dMsgLen);

    dTxLen = sizeof(txIxpcMsg->head) + txIxpcMsg->head.bodyLen;

    if( msgsnd(ixpcQid, (void*)&txGenQMsg, dTxLen, IPC_NOWAIT) < 0 ) {
        dAppLog(LOG_CRI, "[FAIL] SEND TO TRACE ERROR %d(%s)\n", errno, strerror(errno));
        return -1;
    }
    else {
        dAppLog(LOG_CRI, "[SUCC] SEND TO BLK-INFO TRACE, SUCCESS(%d)", dTxLen);
    }
    return 0;
}
Exemple #6
0
void create_bbs_message(char *directory,char *copyfile,char *subject,
      int user,char *from, struct board_info *new_board, int num_msg,
      struct bbs_board_info *bbs_info)
 {
   int flag = 0;
   struct ffblk look_up;
   char s[27];
   char str[60];
   char temp[29];
   FILE *file_write;
   FILE *file_read;
   time_t now;

   while (!flag)
    {
      sprintf(s,"%s\\m%04dx%02d",directory,user_lines[tswitch].number,(dans_counter % 100));
      lock_dos();
      flag = findfirst(s,&look_up,FA_NORMAL);
      unlock_dos();
      next_task();
    };
   lock_dos();
   if ((file_write=g_fopen(s,"wb","BBS#1"))==NULL)
    {
#ifdef DEBUG
      log_error(s);
#endif

      unlock_dos();
      return;
    };
   fprintf(file_write,"|*h1|*f4   User: |*f7(#%03d) %s|*r1%s",user,from,cr_lf);
   fprintf(file_write,"|*h1|*f4Subject: |*f7%s|*r1%s",subject,cr_lf);
   time(&now);
   str_time(temp,30,localtime(&now));
   strftime(s,70,"%a %b %d %Y",localtime(&now));
   sprintf(str,"%s  %s ",s,temp);
   fprintf(file_write,"   |*f4|*h1Date:|*f7 %s%s%s|*r1",str,cr_lf,cr_lf);
   if ((file_read=g_fopen(copyfile,"rb","BBS#2"))==NULL)
    {
      log_error(copyfile);
      g_fclose(file_write);
      unlock_dos();
      return;
    };
   copy_stream(file_read,file_write);
   g_fclose(file_read);
   g_fclose(file_write);
   if (num_msg >= new_board->limit_messages)
    {
      sprintf(s,"%s\\%s",directory,bbs_info[0].filename);
      remove(s);
    };
   unlock_dos();
 };
static void *
do_time(void *arg)
{
	int connfd;
	 
	connfd=*((int *)arg);
	free(arg);
	
	Pthread_detach(pthread_self());
	str_time(connfd);
	Close(connfd);
	return(NULL);

}
void HTTPDictionarySource::getUpdateFieldAndDate(Poco::URI & uri)
{
    if (update_time != std::chrono::system_clock::from_time_t(0))
    {
        auto tmp_time = update_time;
        update_time = std::chrono::system_clock::now();
        time_t hr_time = std::chrono::system_clock::to_time_t(tmp_time) - 1;
        char buffer [80];
        struct tm * timeinfo;
        timeinfo = localtime (&hr_time);
        strftime(buffer, 80, "%Y-%m-%d %H:%M:%S", timeinfo);
        std::string str_time(buffer);
        uri.addQueryParameter(update_field, str_time);
    }
    else
    {
        update_time = std::chrono::system_clock::now();
        uri.addQueryParameter(update_field, "0000-00-00 00:00:00");
    }
}
Exemple #9
0
static SQInteger _mod_filelog(HSQUIRRELVM v) {
    const SQChar* fname;
    const SQChar* text;
    sq_getstring(v, 2, &fname);
    sq_getstring(v, 3, &text);
    if(fname && text) {
        char fullname[512],tmm[128];
        if(fname[0]=='/')
            sprintf(fullname,"%s",fname);
        else
            sprintf(fullname,"%s/%s",__pSQ->ctx()->_dir_home,fname);
        FILE* pf = fopen(fullname, "ab");
        if(!pf) {return sq_throwerror(v,_SC("fopen(null_pointer, 0 bytes) error"));}
        str_time(tmm);
        fprintf(pf,"[%s] \t%s\n", tmm, text);
        fclose(pf);
        return 1;
    }
    return -1;
}
Exemple #10
0
char * curr_time (const char *fmt)
{
	time_t t = time (NULL);	       	
	return str_time(fmt, &t);
}
Exemple #11
0
/**
 * MOTION_LOG
 *
 *    This routine is used for printing all informational, debug or error
 *    messages produced by any of the other motion functions.  It always
 *    produces a message of the form "[n] {message}", and (if the param
 *    'errno_flag' is set) follows the message with the associated error
 *    message from the library.
 *
 * Parameters:
 *
 *     level           logging level for the 'syslog' function
 *
 *     type            logging type.
 *
 *     errno_flag      if set, the log message should be followed by the
 *                     error message.
 *     fmt             the format string for producing the message
 *     ap              variable-length argument list
 *
 * Returns:
 *                     Nothing
 */
void motion_log(int level, unsigned int type, int errno_flag, const char *fmt, ...)
{
    int errno_save, n;
    char buf[1024];
/* GNU-specific strerror_r() */
#if (!defined(XSI_STRERROR_R))
    char msg_buf[100];
#endif
    va_list ap;
    int threadnr;

    /* Exit if level is greater than log_level */
    if ((unsigned int)level > log_level)
        return;

    /* Exit if type is not equal to log_type and not TYPE_ALL */
    if ((log_type != TYPE_ALL) && (type != log_type))
        return;

    //printf("log_type %d, type %d level %d\n", log_type, type, level);

    /*
     * If pthread_getspecific fails (e.g., because the thread's TLS doesn't
     * contain anything for thread number, it returns NULL which casts to zero,
     * which is nice because that's what we want in that case.
     */
    threadnr = (unsigned long)pthread_getspecific(tls_key_threadnr);

    /*
     * First we save the current 'error' value.  This is required because
     * the subsequent calls to vsnprintf could conceivably change it!
     */
    errno_save = errno;

    /*
     * Prefix the message with the log level string, log type string,
     * time and thread number. e.g. [1] [ERR] [ENC] [Apr 03 00:08:44] blah
     *
     */
    if (!log_mode) {
        n = snprintf(buf, sizeof(buf), "[%d] [%s] [%s] [%s] ",
                     threadnr, get_log_level_str(level), get_log_type_str(type),
                     str_time());
    } else {
    /*
     * Prefix the message with the log level string, log type string
     * and thread number. e.g. [1] [DBG] [TRK] blah
     */
        n = snprintf(buf, sizeof(buf), "[%d] [%s] [%s] ",
                     threadnr, get_log_level_str(level), get_log_type_str(type));
    }

    /* Next add the user's message. */
    va_start(ap, fmt);
    n += vsnprintf(buf + n, sizeof(buf) - n, fmt, ap);
    buf[1023] = '\0';

    /* If errno_flag is set, add on the library error message. */
    if (errno_flag) {
      size_t buf_len = strlen(buf);

      // just knock off 10 characters if we're that close...
      if (buf_len + 10 > 1024) {
          buf[1024 - 10] = '\0';
          buf_len = 1024 - 10;
      }

      strncat(buf, ": ", 1024 - buf_len);
      n += 2;
        /*
         * This is bad - apparently gcc/libc wants to use the non-standard GNU
         * version of strerror_r, which doesn't actually put the message into
         * my buffer :-(.  I have put in a 'hack' to get around this.
         */
#if defined(XSI_STRERROR_R)
        /* XSI-compliant strerror_r() */
        strerror_r(errno_save, buf + n, sizeof(buf) - n);    /* 2 for the ': ' */
#else
        /* GNU-specific strerror_r() */
        strncat(buf, strerror_r(errno_save, msg_buf, sizeof(msg_buf)), 1024 - strlen(buf));
#endif
    }

    if (!log_mode) {
        strncat(buf, "\n", 1024 - strlen(buf));
        fputs(buf, logfile);
        fflush(logfile);

    /* If log_mode, send the message to the syslog. */
    } else {
        syslog(level, "%s", buf);
        strncat(buf, "\n", 1024 - strlen(buf));
        fputs(buf, stderr);
        fflush(stderr);
    }

    /* Clean up the argument list routine. */
    va_end(ap);
}
Exemple #12
0
int Send_TrcMsg_DelivMsg_SMPP2COND (SMS_HIS *sms_his, SMPP_DELIVER *deliver, int trace_type)
{
#if 1
    GeneralQMsgType txGenQMsg;
    IxpcQMsgType    *txIxpcMsg = NULL;
    char            szTrcMsg[4096];
    int             dMsgLen= 0, dTxLen;
    struct timeval  stTmval;
    char            sztimebuf[128];
    char			szTypeStr[512];
    char			strTime[32];

    memset(&stTmval, 0x00, sizeof(struct timeval));
    memset(&sztimebuf, 0x00, sizeof(sztimebuf));
    memset(&txGenQMsg, 0x00, sizeof(txGenQMsg));
    memset(szTrcMsg, 0x00, 4096);
    memset(strTime, 0x00, sizeof(strTime));

    txGenQMsg.mtype = MTYPE_TRC_CONSOLE;
    txIxpcMsg = (IxpcQMsgType*)txGenQMsg.body;
    memset((void*)&txIxpcMsg->head, 0x00, sizeof(txIxpcMsg->head));

    strcpy(txIxpcMsg->head.srcSysName, mySysName);
    strcpy(txIxpcMsg->head.srcAppName, myAppName);
    strcpy(txIxpcMsg->head.dstSysName, "DSCM");
    strcpy(txIxpcMsg->head.dstAppName, "COND");

    gettimeofday(&stTmval, NULL );
    sprintf( sztimebuf,"[%s.%06ld]", str_time(stTmval.tv_sec), stTmval.tv_usec);
    sprintf (szTypeStr, "\tSMS : Send DELIVER Message\n"
             "\tSend Time : %s\n"
             "\tS/N : %02d\n"
             "\tTID : %02d\n"
             "\tOrg Addr : %s\n"
             "\tDst Addr : %s\n"
             "\tSMS MSG  : %s "
             , str_time((time_t)sms_his->delivTm)
             , deliver->sn, deliver->tid, deliver->org_addr, deliver->dst_addr, deliver->text);

    if (trace_type == TRACE_METHOD_IMSI) {
        dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "IMSI:%s S7000 CALL TRACE INFORMATION (SMPP)\n", sms_his->info.subsID);
    } else if (trace_type == TRACE_METHOD_IP) {
        dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "IP:%s: S7000 CALL TRACE INFORMATION (SMPP)\n", sms_his->info.subsIP);
    }
    else {
        dAppLog(LOG_CRI, "trace type is wrong(%d)", trace_type);
    }
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "%s\t%s \n", mySysName, sztimebuf);
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "------------------------------------------------------------\n");
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "%s \n", szTypeStr);
    dMsgLen += snprintf(szTrcMsg + dMsgLen, sizeof(szTrcMsg), "------------------------------------------------------------\n");

    txIxpcMsg->head.bodyLen = dMsgLen;
    memcpy(txIxpcMsg->body, szTrcMsg, dMsgLen);

    dTxLen = sizeof(txIxpcMsg->head) + txIxpcMsg->head.bodyLen;

    if( msgsnd(ixpcQid, (void*)&txGenQMsg, dTxLen, IPC_NOWAIT) < 0 ) {
        dAppLog(LOG_CRI, "[FAIL] SEND TO TRACE ERROR %d(%s)\n", errno, strerror(errno));
        return -1;
    }
    else {
        dAppLog(LOG_CRI, "[SUCC] SEND TO DELIVER TRACE, SUCCESS(%d)", dTxLen);
    }
#endif
    return 0;
}
Exemple #13
0
/*
 * dump SADB_MSG formated.  For debugging, you should use kdebug_sadb().
 */
void
pfkey_sadump(struct sadb_msg *m)
{
	caddr_t mhp[SADB_EXT_MAX + 1];
	struct sadb_sa *m_sa;
	struct sadb_x_sa2 *m_sa2;
	struct sadb_lifetime *m_lftc, *m_lfth, *m_lfts;
	struct sadb_address *m_saddr, *m_daddr;
	struct sadb_key *m_auth, *m_enc;

	/* check pfkey message. */
	if (pfkey_align(m, mhp)) {
		printf("%s\n", ipsec_strerror());
		return;
	}
	if (pfkey_check(mhp)) {
		printf("%s\n", ipsec_strerror());
		return;
	}

	m_sa = (struct sadb_sa *)mhp[SADB_EXT_SA];
	m_sa2 = (struct sadb_x_sa2 *)mhp[SADB_X_EXT_SA2];
	m_lftc = (struct sadb_lifetime *)mhp[SADB_EXT_LIFETIME_CURRENT];
	m_lfth = (struct sadb_lifetime *)mhp[SADB_EXT_LIFETIME_HARD];
	m_lfts = (struct sadb_lifetime *)mhp[SADB_EXT_LIFETIME_SOFT];
	m_saddr = (struct sadb_address *)mhp[SADB_EXT_ADDRESS_SRC];
	m_daddr = (struct sadb_address *)mhp[SADB_EXT_ADDRESS_DST];
	m_auth = (struct sadb_key *)mhp[SADB_EXT_KEY_AUTH];
	m_enc = (struct sadb_key *)mhp[SADB_EXT_KEY_ENCRYPT];

	/* source address */
	if (m_saddr == NULL) {
		printf("no ADDRESS_SRC extension.\n");
		return;
	}
	printf("%s ", str_ipaddr((struct sockaddr *)(m_saddr + 1)));

	/* destination address */
	if (m_daddr == NULL) {
		printf("no ADDRESS_DST extension.\n");
		return;
	}
	printf("%s ", str_ipaddr((struct sockaddr *)(m_daddr + 1)));

	/* SA type */
	if (m_sa == NULL) {
		printf("no SA extension.\n");
		return;
	}
	if (m_sa2 == NULL) {
		printf("no SA2 extension.\n");
		return;
	}
	printf("\n\t");

	GETMSGSTR(str_satype, m->sadb_msg_satype);

	printf("mode=");
	GETMSGSTR(str_mode, m_sa2->sadb_x_sa2_mode);

	printf("spi=%u(0x%08x) reqid=%u(0x%08x)\n",
		(u_int32_t)ntohl(m_sa->sadb_sa_spi),
		(u_int32_t)ntohl(m_sa->sadb_sa_spi),
		(u_int32_t)m_sa2->sadb_x_sa2_reqid,
		(u_int32_t)m_sa2->sadb_x_sa2_reqid);

	/* encryption key */
	if (m->sadb_msg_satype == SADB_X_SATYPE_IPCOMP) {
		printf("\tC: ");
		GETMSGV2S(str_alg_comp, m_sa->sadb_sa_encrypt);
	} else if (m->sadb_msg_satype == SADB_SATYPE_ESP) {
		if (m_enc != NULL) {
			printf("\tE: ");
			GETMSGV2S(str_alg_enc, m_sa->sadb_sa_encrypt);
			ipsec_hexdump((caddr_t)m_enc + sizeof(*m_enc),
				      m_enc->sadb_key_bits / 8);
			printf("\n");
		}
	}

	/* authentication key */
	if (m_auth != NULL) {
		printf("\tA: ");
		GETMSGV2S(str_alg_auth, m_sa->sadb_sa_auth);
		ipsec_hexdump((caddr_t)m_auth + sizeof(*m_auth),
		              m_auth->sadb_key_bits / 8);
		printf("\n");
	}

	/* replay windoe size & flags */
	printf("\tseq=0x%08x replay=%u flags=0x%08x ",
		m_sa2->sadb_x_sa2_sequence,
		m_sa->sadb_sa_replay,
		m_sa->sadb_sa_flags);

	/* state */
	printf("state=");
	GETMSGSTR(str_state, m_sa->sadb_sa_state);
	printf("\n");

	/* lifetime */
	if (m_lftc != NULL) {
		time_t tmp_time = time(0);

		printf("\tcreated: %s",
			str_time(m_lftc->sadb_lifetime_addtime));
		printf("\tcurrent: %s\n", str_time(tmp_time));
		printf("\tdiff: %lu(s)",
			(u_long)(m_lftc->sadb_lifetime_addtime == 0 ?
			0 : (tmp_time - m_lftc->sadb_lifetime_addtime)));

		printf("\thard: %lu(s)",
			(u_long)(m_lfth == NULL ?
			0 : m_lfth->sadb_lifetime_addtime));
		printf("\tsoft: %lu(s)\n",
			(u_long)(m_lfts == NULL ?
			0 : m_lfts->sadb_lifetime_addtime));

		printf("\tlast: %s",
			str_time(m_lftc->sadb_lifetime_usetime));
		printf("\thard: %lu(s)",
			(u_long)(m_lfth == NULL ?
			0 : m_lfth->sadb_lifetime_usetime));
		printf("\tsoft: %lu(s)\n",
			(u_long)(m_lfts == NULL ?
			0 : m_lfts->sadb_lifetime_usetime));

		str_lifetime_byte(m_lftc, "current");
		str_lifetime_byte(m_lfth, "hard");
		str_lifetime_byte(m_lfts, "soft");
		printf("\n");

		printf("\tallocated: %lu",
			(unsigned long)m_lftc->sadb_lifetime_allocations);
		printf("\thard: %lu",
			(u_long)(m_lfth == NULL ?
			0 : m_lfth->sadb_lifetime_allocations));
		printf("\tsoft: %lu\n",
			(u_long)(m_lfts == NULL ?
			0 : m_lfts->sadb_lifetime_allocations));
	}

	printf("\tsadb_seq=%lu pid=%lu ",
		(u_long)m->sadb_msg_seq,
		(u_long)m->sadb_msg_pid);

	/* XXX DEBUG */
	printf("refcnt=%u\n", m->sadb_msg_reserved);

	return;
}
Exemple #14
0
char *t_elapsed(time_t start, time_t end)
{
	return str_time(end - start);
}