⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nprobe.i

📁 该软件根据网络数据生成NetFlow记录。NetFlow可用于网络规划、负载均衡、安全监控等
💻 I
📖 第 1 页 / 共 5 页
字号:
/*****************************************************************************//* * Class sk_buff_alloc_fail_rec - records nprobe sk_buf allocation failures */%addmethods sk_buff_alloc_fail_rec { /* Constructor */sk_buff_alloc_fail_rec(){  struct sk_buff_alloc_fail_rec *fr;	  if ((fr = (struct sk_buff_alloc_fail_rec *)malloc(sizeof(struct sk_buff_alloc_fail_rec))) == NULL)    wr_error("sk_buff_alloc_fail_rec: malloc");  return fr;}	/*Destructor */~sk_buff_alloc_fail_rec() {  free(self);}/* ascii print out of record */void printself(unsigned int indx){  report_buf_alloc_fail(self, indx);}/* * Get current buf_alloc fail record from file * - next_rec already called and record identified as fail record   */void read_failrec(struct np_file *file){  _read_buf_alloc_fail(file, self);  return;}/* Get next buf_alloc fail record from file  */int get_next_failrec(struct np_file *file){  int rec_type = _next_rec(file, REC_BUF_ALLOC_FAIL);  if (rec_type == -1)    {      return -1;    }  else    {      assert(rec_type == REC_BUF_ALLOC_FAIL);      _read_buf_alloc_fail(file, self);      //self->indx = file->indx -1;      return rec_type;    }}}; /* End addmethods sk_buff_alloc_fail_rec *//*****************************************************************************//* * Class period_report - records nprobe accounting period data */%addmethods period_report { /* Constructor */period_report(){  struct period_report *pr;	  if ((pr = (struct period_report *)malloc(sizeof(struct period_report))) == NULL)    wr_error("period_report: malloc");  return pr;}	/*Destructor */~period_report() {  free(self);}/* ascii print out of record */void printself(unsigned int indx, counters_t *ctrs, int why){  report_period_report(self, indx, ctrs, why);}/* * Get current period report record from file * - next_rec already called and record identified as period report record  * - if not wire-driven requires ptr to ru struct to read following ru record  */void read_reprec(struct np_file *file, struct np_rusage *rup, int read_rup){  if (read_rup)    _read_period_report(file, self, rup);  else    _read_period_report(file, self, NULL);  return;}/* Get next report record from file  */int get_next_reprec(struct np_file *file, struct np_rusage *rup){  int rec_type = _next_rec(file, REC_PERIOD_REPORT);  if (rec_type == -1)    {      return -1;    }  else    {      assert(rec_type == REC_PERIOD_REPORT);      return _read_period_report(file, self, rup);      //self->indx = file->indx -1;      return rec_type;    }}/* Return time stamp */struct tval *get_ts(){  return (struct tval *)&self->ts;}/* Return HTML octets parsed */int get_html_parsed(){  return self->html_parsed;}/* Return max fetch interval */int get_max_fetch_interval(){  return self->max_fetch_interval;}/* Return rep bytes written */int get_rep_bytes_written(){  return self->rep_bytes_written;}/* Return dump bytes written */int get_dump_bytes_written(){  return self->dump_bytes_written;}/* Return rep blks dumped */int get_rep_blks_dumped(){  return self->repblks_dumped;}/* Return dump blks dumped */int get_dump_blks_dumped(){  return self->dumpblks_dumped;}/* Return wire pkts */int get_wire_pkts(){  return self->wire_pkts;}/* Return TCP pkts */int get_tcp_pkts(){  return self->tcp_pkts;}/* Return UDP pkts */int get_udp_pkts(){  return self->udp_pkts;}/* Return HTTP pkts */int get_http_pkts(){  return self->http_pkts;}/* Return tous_in */int get_tous_in(){  return (int)(self->tous_in);}/* Return tous_out */int get_tous_out(){  return (int)(self->tous_out);}/* Return frus_in */int get_frus_in(){  return (int)(self->frus_in);}/* Return frus_out */int get_frus_out(){  return (int)(self->frus_out);}/* Return tous_in - tous_out */int get_tous_inout(){  return (int)(self->tous_in - self->tous_out);}/* Return frus_in - frus_out */int get_frus_inout(){  return (int)(self->frus_in - self->frus_out);}/* Return timeout values */int get_tcp_to(){  return (int)self->tcp_to;}int get_udp_to(){  return (int)self->udp_to;}int get_tcp_seq_to(){  return (int)self->tcp_seq_to;}int get_tcp_seq_to_forced(){  return (int)self->tcp_seq_to_forced;}int get_tcp_seq_to_q(){  return (int)self->tcp_seq_to_q;}int get_tcp_seq_to_ack(){  return (int)self->tcp_seq_to_ack;}/* Get rejected packet < min IP len */int get_IP_ulen(){  return (int)self->IP_ulen_pkts;}}; /* End addmethods period_report *//*****************************************************************************//* * Class np_rusage - records nprobe accounting period data */%addmethods np_rusage { /* Constructor */np_rusage(){  struct np_rusage *rup;	  if ((rup = (struct np_rusage *)malloc(sizeof(struct np_rusage))) == NULL)    wr_error("np_rusage: malloc");  return rup;}	/*Destructor */~np_rusage() {  free(self);}/* ascii print out of record  * - suppress printing rec_no and time if print_stamp == 0 */void printself(unsigned int indx, int print_stamp){  report_rusage(self, indx, print_stamp);}/* Get next report record from file  */int get_next_rusage(struct np_file *file){  int rec_type = _next_rec(file, REC_RUSAGE);  if (rec_type == -1)    {      return -1;    }  else    {      assert(rec_type == REC_RUSAGE);      _read_rusage(file, self);      return rec_type;    }}/* Populate class instance */void read(struct np_file *file){  _read_rusage(file, self);}/* Return time stamp */struct tval *get_ts(){  return (struct tval *)&self->ts;}/* Return user processor time */struct tval *get_utime(){  return (struct tval *)&self->ru.ru_utime;}/* Return system processor time */struct tval *get_stime(){  return (struct tval *)&self->ru.ru_stime;}/* Return max RSS */long max_rss(){  return self->ru.ru_maxrss;}/* Return max RSS */long majflt(){  return self->ru.ru_majflt;}/* Return # swaps */long nswap(){  return self->ru.ru_nswap;}/* Return # block io's */long blkio(){  return self->ru.ru_inblock + self->ru.ru_oublock;}/* Return # context switches */long cswitches(){  return self->ru.ru_nvcsw + self->ru.ru_nivcsw;}  }; /* End addmethods np_rusage *//*****************************************************************************//* * Class  wrapper_record */%addmethods wrapper_record {  /* Constructor */wrapper_record(){  struct wrapper_record *wp;	  if ((wp = (struct wrapper_record *)malloc(sizeof(struct wrapper_record))) == NULL)    wr_error("wrapper_record: malloc");  return wp;}	/*Destructor */~wrapper_record() {  free(self);}/* ascii print out of record */void printself(unsigned int indx){  report_wrapper(self, indx);}/* Populate */void read(struct np_file *file){  _read_wrapper(file, self);}/* get internal record type */int type(){  return self->type;}/* * Get internal fields for type call_times *//* Time stamp */struct tval *get_ts(){  assert(self->type == WRAPPER_TIME_CALLS);  return (struct tval *)&self->data.call_times.ts;}/* IP - usr */struct ulonglong *get_ip_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.ip.utm;}/* IP - sys */struct ulonglong *get_ip_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.ip.stm;}/* UDP - usr */struct ulonglong *get_udp_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.udp.utm;}/* UDP - sys */struct ulonglong *get_udp_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.udp.stm;}/* TCP - usr */struct ulonglong *get_tcp_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp.utm;}/* TCP - sys */struct ulonglong *get_tcp_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp.stm;}/* TCP in sequence  - usr */struct ulonglong *get_tcp_inseq_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp_inseq.utm;}/* TCP in sequence  - sys */struct ulonglong *get_tcp_inseq_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp_inseq.stm;}/* TCP catch up  - usr */struct ulonglong *get_tcp_catchup_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp_catchup.utm;}/* TCP catch up   - sys */struct ulonglong *get_tcp_catchup_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp_catchup.stm;}/* TCP service  - usr */struct ulonglong *get_tcp_serv_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp_serv.utm;}/* TCP service   - sys */struct ulonglong *get_tcp_serv_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.tcp_serv.stm;}/* HTTP - usr */struct ulonglong *get_http_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.http.utm;}/* HTTP - sys */struct ulonglong *get_http_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.http.stm;}/* HTML - usr */struct ulonglong *get_html_usrtm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.html.utm;}/* HTML - sys */struct ulonglong *get_html_systm(){  assert(self->type == WRAPPER_TIME_CALLS);  return (ulonglong *)&self->data.call_times.html.stm;}  }; /* End addmethods wrapper_record *//*****************************************************************************//* * Class  procstat_rec */%addmethods procstat_rec {  /* Constructor */procstat_rec(){  struct procstat_rec *prp;	  if ((prp = (struct procstat_rec *)malloc(sizeof(struct procstat_rec))) == NULL)    wr_error("procstat_rec: malloc");  return prp;}	/*Destructor */~procstat_rec() {  free(self);}/* Populate */void read(struct np_file *file){  _read_procstats(file, self);}/* Get time stamp */struct tval *get_ts(){  return (struct tval *)&self->ts;}/* Get nprobe process usr time */int get_p_utm(){  return (int)self->proc.utm;}/* Get nprobe process sys time */int get_p_stm(){  return (int)self->proc.stm;}/* Get nprobe process major page faults */int get_p_majflt(){  return (int)self->proc.majflt;}/* Get nprobe process swaps */int get_p_nswap(){  return (int)self->proc.nswap;}/* Get system total cpu jiffies */int get_s_tcpu(){  return (int)(self->stat.utm + self->stat.stm + self->stat.itm);}/* Get system interrupts */int get_s_itot(){  return (int)self->stat.itot;}/* Get system context switches */int get_s_csw(){  return (int)self->stat.csw;}  }; /* End addmethods procstat_rec *//*****************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -