Patches to argus-clients-3.0.0.rc.15 and argus-clients-2.0.6.fixes.1

Peter Van Epp vanepp at sfu.ca
Wed Jul 5 22:53:55 EDT 2006


	Below are a pair of patch sets one each for (argus-clients-2.0.6.fixes.1
and argus-clients-3.0.0.rc.15) that almost fix most of the errors that occur
when comparing 2.0.6 ra output to 3.0 ra output. The user data stuff is still
broken (looks like thats a Carter task :-)) because I can't quite figure out
what its supposed to do :-).
	While fixing the tcp window code, the thought struck that it would be
interesting to know that a window hit 0 (indicating host buffer conjestion) and
for how long.

Peter Van Epp / Operations and Technical Support 
Simon Fraser University, Burnaby, B.C. Canada

 argus-clients-3.0.0.rc.15

*** common/argus_util.c.orig	Sun Jul  2 15:24:45 2006
--- common/argus_util.c	Wed Jul  5 19:33:14 2006
***************
*** 2869,2887 ****
  
                          case IPPROTO_ICMP: {
                             char type[32];
!                            sprintf (type, "%d", flow->flow_un.icmp.type);
                             if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
                                switch (parser->RaFieldWidth) {
                                   case RA_FIXED_WIDTH:
                                      sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, type, parser->RaFieldDelimiter);
                                      break;
                                   default:
!                                     sprintf (&buf[strlen(buf)], "%d%c", flow->flow_un.icmp.type, parser->RaFieldDelimiter);
                                      break;
                                }
                             } else {
!                               sprintf (&buf[strlen(buf)], "%-*.*s ", len, len, type);
!                            }
                             done++;
                             break;
                          }
--- 2869,2887 ----
  
                          case IPPROTO_ICMP: {
                             char type[32];
! 			   type[0] = '\0';
                             if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
                                switch (parser->RaFieldWidth) {
                                   case RA_FIXED_WIDTH:
                                      sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, type, parser->RaFieldDelimiter);
                                      break;
                                   default:
! 				    sprintf (&buf[strlen(buf)], "%s%c", type, parser->RaFieldDelimiter);
                                      break;
                                }
                             } else {
! 			      sprintf (&buf[strlen(buf)], "%-*.*s ", len, len, type);
! 			   }
                             done++;
                             break;
                          }
***************
*** 2988,2994 ****
  
                          case IPPROTO_ICMP: {
                             char code[32];
!                            sprintf (code, "%d", flow->flow_un.icmp.code);
  
                             if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
                                switch (parser->RaFieldWidth) {
--- 2988,2994 ----
  
                          case IPPROTO_ICMP: {
                             char code[32];
! 			   code[0] = '\0';
  
                             if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
                                switch (parser->RaFieldWidth) {
***************
*** 2996,3002 ****
                                      sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, code, parser->RaFieldDelimiter);
                                      break;
                                   default:
!                                     sprintf (&buf[strlen(buf)], "%d%c", flow->flow_un.icmp.code, parser->RaFieldDelimiter);
                                      break;
                                }
                             } else {
--- 2996,3002 ----
                                      sprintf (&buf[strlen(buf)], "%-*.*s%c", len, len, code, parser->RaFieldDelimiter);
                                      break;
                                   default:
!                                     sprintf (&buf[strlen(buf)], "%s%c", code, parser->RaFieldDelimiter);
                                      break;
                                }
                             } else {
***************
*** 4724,4733 ****
   
     } else {
        char value[32];
!       bzero(value, 4);
  
        if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
!          double stdev = 0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
           unsigned int n;
           float meanval;
  
--- 4724,4733 ----
   
     } else {
        char value[32];
!       bzero(value, 32);
  
        if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
!          double stdev = 0.0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
           unsigned int n;
           float meanval;
  
***************
*** 4811,4821 ****
        }
   
     } else {
!       double stdev = 0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
        unsigned int n;
        float meanval;
        char sbuf[32];
!       bzero(sbuf, 4);
  
        if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
           if ((n = (jitter->act.dst.n + jitter->idle.dst.n)) > 0) {
--- 4811,4821 ----
        }
   
     } else {
!       double stdev = 0.0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
        unsigned int n;
        float meanval;
        char sbuf[32];
!       bzero(sbuf, 32);
  
        if (argus && ((jitter = &argus->canon.jitter) != NULL)) {
           if ((n = (jitter->act.dst.n + jitter->idle.dst.n)) > 0) {
***************
*** 5927,5933 ****
  
     bzero(vlanbuf, sizeof(vlanbuf));
     if (vlan != NULL) 
!       if ((vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN) || (vlan->sid > 0))
           sprintf (vlanbuf, "%d", (vlan->sid & 0x0FFF));
  
     if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
--- 5927,5933 ----
  
     bzero(vlanbuf, sizeof(vlanbuf));
     if (vlan != NULL) 
!       if (vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN)
           sprintf (vlanbuf, "%d", (vlan->sid & 0x0FFF));
  
     if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
***************
*** 6027,6033 ****
                                                                                                             
     bzero(vstr, sizeof(vstr));
     if (vlan != NULL)
!       if ((vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN) || (vlan->sid > 0))
           sprintf (vstr, "0x%04x", vlan->sid);
                                                                                                             
     if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
--- 6027,6033 ----
                                                                                                             
     bzero(vstr, sizeof(vstr));
     if (vlan != NULL)
!       if (vlan->hdr.argus_dsrvl8.qual & ARGUS_SRC_VLAN)
           sprintf (vstr, "0x%04x", vlan->sid);
                                                                                                             
     if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
***************
*** 6056,6062 ****
  
     bzero(vstr, sizeof(vstr));
     if (vlan != NULL)
!       if ((vlan->hdr.argus_dsrvl8.qual & ARGUS_DST_VLAN) || (vlan->did > 0))
           sprintf (vstr, "0x%04x", vlan->did);
  
     if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
--- 6056,6062 ----
  
     bzero(vstr, sizeof(vstr));
     if (vlan != NULL)
!       if (vlan->hdr.argus_dsrvl8.qual & ARGUS_DST_VLAN)
           sprintf (vstr, "0x%04x", vlan->did);
  
     if ((parser->RaFieldDelimiter != ' ') && (parser->RaFieldDelimiter != '\0')) {
***************
*** 6240,6246 ****
                 switch (flow->ip_flow.ip_p) {
                    case  IPPROTO_TCP: {
                       int win = tcp->src.win << tcp->src.winshift;
!                      sprintf (winbuf, "%d", win);
                       break;
                    }
                    default:
--- 6240,6246 ----
                 switch (flow->ip_flow.ip_p) {
                    case  IPPROTO_TCP: {
                       int win = tcp->src.win << tcp->src.winshift;
!                      sprintf (winbuf, "%u", win);
                       break;
                    }
                    default:
***************
*** 6252,6258 ****
                 switch (flow->ipv6_flow.ip_p) {
                    case  IPPROTO_TCP: {
                       int win = tcp->src.win << tcp->src.winshift;
!                      sprintf (winbuf, "%d", win);
                       break;
                    }
                    default:
--- 6252,6258 ----
                 switch (flow->ipv6_flow.ip_p) {
                    case  IPPROTO_TCP: {
                       int win = tcp->src.win << tcp->src.winshift;
!                      sprintf (winbuf, "%u", win);
                       break;
                    }
                    default:
***************
*** 6301,6308 ****
              case ARGUS_TYPE_IPV4:
                 switch (flow->ip_flow.ip_p) {
                    case  IPPROTO_TCP: {
!                      int win = tcp->dst.win << tcp->src.winshift;
!                      sprintf (winbuf, "%d", win);
                       break;
                    }
                    default:
--- 6301,6308 ----
              case ARGUS_TYPE_IPV4:
                 switch (flow->ip_flow.ip_p) {
                    case  IPPROTO_TCP: {
!                      int win = tcp->dst.win << tcp->dst.winshift;
!                      sprintf (winbuf, "%u", win);
                       break;
                    }
                    default:
***************
*** 6314,6320 ****
                 switch (flow->ipv6_flow.ip_p) {
                    case  IPPROTO_TCP: {
                       int win = tcp->dst.win << tcp->src.winshift;
!                      sprintf (winbuf, "%d", win);
                       break;
                    }
                    default:
--- 6314,6320 ----
                 switch (flow->ipv6_flow.ip_p) {
                    case  IPPROTO_TCP: {
                       int win = tcp->dst.win << tcp->src.winshift;
!                      sprintf (winbuf, "%u", win);
                       break;
                    }
                    default:
***************
*** 8106,8112 ****
              break;
        }
        exlen += 8;
!       if (len > 10) exlen++;
  
        if ((user = (struct ArgusDataStruct *)argus->dsrs[ARGUS_SRCUSERDATA_INDEX]) != NULL) {
           unsigned short *sptr = &user->hdr.argus_dsrvl16.len;
--- 8106,8118 ----
              break;
        }
        exlen += 8;
! 
!       /* Assuming this compensates for the extra digit in the s[%d], it needs
!          to start at 10 and occur again at 100+ other than that this still
! 	 doesn't work correctly :-)  */
! 
!       if (len >= 10) exlen++;
!       if (len >= 100) exlen++;
  
        if ((user = (struct ArgusDataStruct *)argus->dsrs[ARGUS_SRCUSERDATA_INDEX]) != NULL) {
           unsigned short *sptr = &user->hdr.argus_dsrvl16.len;
***************
*** 12765,12770 ****
--- 12771,12777 ----
                          tcp->src.bytes            = nv2tcp->src.bytes;
                          tcp->src.retrans          = nv2tcp->src.rpkts;
                          tcp->src.win              = nv2tcp->src.win;
+ 			tcp->src.winshift 	  = 0;
                          tcp->src.flags            = nv2tcp->src.flags;
                          tcp->src.status           = 0; tcp->src.seq    = 0;
                          tcp->src.ack              = 0; tcp->src.winnum = 0;
***************
*** 12774,12779 ****
--- 12781,12787 ----
                          tcp->dst.bytes            = nv2tcp->dst.bytes;
                          tcp->dst.retrans          = nv2tcp->dst.rpkts;
                          tcp->dst.win              = nv2tcp->dst.win;
+ 			tcp->dst.winshift 	  = 0;
                          tcp->dst.flags            = nv2tcp->dst.flags;
                          tcp->dst.status           = 0; tcp->dst.seq    = 0;
                          tcp->dst.ack              = 0; tcp->dst.winnum = 0;
***************
*** 12825,12831 ****
                          user->hdr.subtype          =  ARGUS_LEN_16BITS | ARGUS_SRC_DATA;
                          user->hdr.argus_dsrvl16.len = nv2user->length + 1;
                          user->size                 = nv2user->length * 4;
!                         user->count                = user->size;
  
                          bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
                          dsr += user->hdr.argus_dsrvl16.len;
--- 12833,12839 ----
                          user->hdr.subtype          =  ARGUS_LEN_16BITS | ARGUS_SRC_DATA;
                          user->hdr.argus_dsrvl16.len = nv2user->length + 1;
                          user->size                 = nv2user->length * 4;
!                         user->count                = user->hdr.argus_dsrvl16.len + 1;
  
                          bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
                          dsr += user->hdr.argus_dsrvl16.len;
***************
*** 12840,12846 ****
                          user->hdr.subtype          =  ARGUS_LEN_16BITS | ARGUS_DST_DATA;
                          user->hdr.argus_dsrvl16.len = nv2user->length + 1;
                          user->size                 = nv2user->length * 4;
!                         user->count                = user->size;
  
                          bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
                          dsr += user->hdr.argus_dsrvl16.len;
--- 12848,12854 ----
                          user->hdr.subtype          =  ARGUS_LEN_16BITS | ARGUS_DST_DATA;
                          user->hdr.argus_dsrvl16.len = nv2user->length + 1;
                          user->size                 = nv2user->length * 4;
!                         user->count                = user->hdr.argus_dsrvl16.len + 1;
  
                          bcopy (&nv2user->data, &user->array, (nv2user->length - 1) * 4);
                          dsr += user->hdr.argus_dsrvl16.len;
***************
*** 12924,12929 ****
--- 12932,12945 ----
                          vlan->hdr.type             = ARGUS_VLAN_DSR;
                          vlan->hdr.subtype          = 0;
                          vlan->hdr.argus_dsrvl8.len = sizeof(*vlan)/4;
+ 		        if (nv2vlan->status & ARGUS_SRC_VLAN)
+ 			   vlan->hdr.argus_dsrvl8.qual |= ARGUS_SRC_VLAN;
+ 			else 
+ 			   vlan->hdr.argus_dsrvl8.qual &= ~ARGUS_SRC_VLAN;
+ 		        if (nv2vlan->status & ARGUS_DST_VLAN)
+ 			   vlan->hdr.argus_dsrvl8.qual |= ARGUS_DST_VLAN;
+ 			else
+ 			   vlan->hdr.argus_dsrvl8.qual &= ~ARGUS_DST_VLAN;
                          vlan->sid = nv2vlan->sid;
                          vlan->did = nv2vlan->did;
  
argus-clients-2.0.6.fixes.1


*** common/argus_util.c.orig	Sat Dec  6 09:43:56 2003
--- common/argus_util.c	Wed Jul  5 18:20:13 2006
***************
*** 909,915 ****
  void
  ArgusPrintStartDate (char *date, struct ArgusRecord *ptr)
  {
-    char delim = ' ';
     struct timeval *tvp = NULL;
  
     if (ptr->ahdr.type & ARGUS_MAR)
--- 909,914 ----
***************
*** 917,932 ****
     else
        tvp = &ptr->argus_far.time.start;
  
!    if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!       delim = RaFieldDelimiter;
! 
!    sprintf (&date[strlen(date)], "%s%c", print_time(tvp), delim);
  }
  
  void
  ArgusPrintLastDate (char *date, struct ArgusRecord *ptr)
  {
-    char delim = ' ';
     struct timeval *tvp = NULL;
  
     if (ptr->ahdr.type & ARGUS_MAR)
--- 916,927 ----
     else
        tvp = &ptr->argus_far.time.start;
  
!    sprintf (&date[strlen(date)], "%s", print_time(tvp));
  }
  
  void
  ArgusPrintLastDate (char *date, struct ArgusRecord *ptr)
  {
     struct timeval *tvp = NULL;
  
     if (ptr->ahdr.type & ARGUS_MAR)
***************
*** 934,943 ****
     else 
        tvp = &ptr->argus_far.time.last;
        
!    if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!       delim = RaFieldDelimiter;
! 
!    sprintf (&date[strlen(date)], "%s%c", print_time(tvp), delim);
  }
  
  void
--- 929,935 ----
     else 
        tvp = &ptr->argus_far.time.last;
        
!    sprintf (&date[strlen(date)], "%s", print_time(tvp));
  }
  
  void
***************
*** 967,973 ****
           sprintf (&date[strlen(date)], " ");
  
     if (RaPrintLastTime)
!       sprintf (&date[strlen(date)], "%s%c", print_time(last), delim);
  }
  
  void ArgusPrintSrcRate (char *, struct ArgusRecord *);
--- 959,965 ----
           sprintf (&date[strlen(date)], " ");
  
     if (RaPrintLastTime)
!       sprintf (&date[strlen(date)], "%s", print_time(last));
  }
  
  void ArgusPrintSrcRate (char *, struct ArgusRecord *);
***************
*** 1003,1009 ****
        if (ArgusThisAgr && (ArgusThisAgr->type == ARGUS_AGR_DSR))
           hits = ArgusThisAgr->count;
  
!       sprintf(&buf[strlen(buf)], "%5d ", hits);
     }
  }
  
--- 995,1001 ----
        if (ArgusThisAgr && (ArgusThisAgr->type == ARGUS_AGR_DSR))
           hits = ArgusThisAgr->count;
  
!       sprintf(&buf[strlen(buf)], "%5d", hits);
     }
  }
  
***************
*** 1013,1019 ****
  ArgusPrintAvgDuration (char *date, struct ArgusRecord *ptr)
  {
     struct ArgusAGRStruct *ArgusThisAgr = NULL;
!    char *sptr, *iptr, delim = ' ';
     struct timeval *start = NULL, *last = NULL;
     struct timeval  buf,  *time = &buf;
  
--- 1005,1011 ----
  ArgusPrintAvgDuration (char *date, struct ArgusRecord *ptr)
  {
     struct ArgusAGRStruct *ArgusThisAgr = NULL;
!    char *sptr, *iptr;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  buf,  *time = &buf;
  
***************
*** 1065,1081 ****
        sprintf(sptr, ".%06d", (int) time->tv_usec);
        sptr[pflag + 1] = '\0';
     }
- 
-    if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
-       sprintf(&date[strlen(date)], "%c", delim);
-    else
-       sprintf(&date[strlen(date)], "%c", ' ');
  }
  
  void
  ArgusPrintDuration (char *date, struct ArgusRecord *ptr)
  {
!    char *sptr, *iptr, delim = ' ';
     struct timeval *start = NULL, *last = NULL;
     struct timeval  buf,  *time = &buf;
  
--- 1057,1068 ----
        sprintf(sptr, ".%06d", (int) time->tv_usec);
        sptr[pflag + 1] = '\0';
     }
  }
  
  void
  ArgusPrintDuration (char *date, struct ArgusRecord *ptr)
  {
!    char *sptr, *iptr;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  buf,  *time = &buf;
  
***************
*** 1115,1125 ****
        sprintf(sptr, ".%06d", (int) time->tv_usec);
        sptr[pflag + 1] = '\0';
     }
- 
-    if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
-       sprintf(&date[strlen(date)], "%c", delim);
-    else
-       sprintf(&date[strlen(date)], "%c", ' ');
  }
  
  void ArgusGetIndicatorString (struct ArgusRecord *, char *);
--- 1102,1107 ----
***************
*** 1215,1222 ****
           }
        }
  
-       *ptr = RaFieldDelimiter;
- 
     } else {
        int encdone = 0;
  
--- 1197,1202 ----
***************
*** 1386,1392 ****
     else
        sprintf (argusIDStr, "%u", argus->ahdr.argusid);
  
!    sprintf(buf, "%-15.15s ", argusIDStr);
  }
  
  void ArgusPrintBinNumber (char *, struct ArgusRecord *);
--- 1366,1372 ----
     else
        sprintf (argusIDStr, "%u", argus->ahdr.argusid);
  
!    sprintf(buf, "%-15.15s", argusIDStr);
  }
  
  void ArgusPrintBinNumber (char *, struct ArgusRecord *);
***************
*** 1404,1410 ****
  
  void
  ArgusPrintSequenceNumber (char *buf, struct ArgusRecord *argus) {
!    sprintf(buf, "%d ", argus->ahdr.seqNumber);
  }
  
  
--- 1384,1390 ----
  
  void
  ArgusPrintSequenceNumber (char *buf, struct ArgusRecord *argus) {
!    sprintf(buf, "%d", argus->ahdr.seqNumber);
  }
  
  
***************
*** 1424,1433 ****
        esrcString = etheraddr_string ((u_char *)&mac->phys_union.ether.ethersrc);
        edstString = etheraddr_string ((u_char *)&mac->phys_union.ether.etherdst);
   
!       sprintf (buf, "%17.17s %17.17s ", esrcString, edstString);
  
!    } else
!       sprintf (buf, "%17.17s %17.17s ", blankStr, blankStr);
  }
  
  void
--- 1404,1424 ----
        esrcString = etheraddr_string ((u_char *)&mac->phys_union.ether.ethersrc);
        edstString = etheraddr_string ((u_char *)&mac->phys_union.ether.etherdst);
   
!       sprintf (buf, "%17.17s", esrcString);
!       if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!          sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
!       else
!          sprintf(&buf[strlen(buf)], "%c", ' ');
!       sprintf (&buf[strlen(buf)], "%17.17s", edstString);
  
!    } else {
!       sprintf (buf, "%17.17s", blankStr);
!       if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!          sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
!       else
!          sprintf(&buf[strlen(buf)], "%c", ' ');
!       sprintf (&buf[strlen(buf)], "%17.17s", blankStr);
!    }
  }
  
  void
***************
*** 1468,1474 ****
     }
  
     if (protoStr != NULL)
!       sprintf (buf, "%4.4s ", protoStr);
  }
  
  int ArgusPrintNet = 0;
--- 1459,1465 ----
     }
  
     if (protoStr != NULL)
!       sprintf (buf, "%4.4s", protoStr);
  }
  
  int ArgusPrintNet = 0;
***************
*** 1537,1543 ****
     struct ArgusFlow *flow;
  
     if (argus->ahdr.type & ARGUS_MAR) {
!       sprintf (&buf[strlen(buf)], "%*d ", hfield, argus->argus_mar.nextMrSequenceNum);
  
     } else {
        flow = &argus->argus_far.flow;
--- 1528,1534 ----
     struct ArgusFlow *flow;
  
     if (argus->ahdr.type & ARGUS_MAR) {
!       sprintf (&buf[strlen(buf)], "%*u ", hfield, argus->argus_mar.nextMrSequenceNum);
  
     } else {
        flow = &argus->argus_far.flow;
***************
*** 1595,1603 ****
     }
  
     if (addr != NULL) 
!       sprintf (buf, "%*.*s ", thishfield, thishfield, addrstr);
     else
!       sprintf (buf, "%*.*s ", thishfield, thishfield, "                  ");
  }
  
  
--- 1586,1595 ----
     }
  
     if (addr != NULL) 
!       sprintf (buf, "%*.*s", thishfield, thishfield, addrstr);
     else
!       sprintf (buf, "%*.*s", thishfield, thishfield, "                  ");
! 
  }
  
  
***************
*** 1631,1638 ****
           case ETHERTYPE_REVARP:
           case ETHERTYPE_ARP:
              sprintf (&buf[strlen(buf)], "%*s", pfield - 1, " ");
-             if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
-                sprintf (buf, "%c", RaFieldDelimiter);
              break;
  
           default:
--- 1623,1628 ----
***************
*** 1650,1656 ****
  ArgusPrintDstPort (char *buf, struct ArgusRecord *argus)
  {
     if (argus->ahdr.type & ARGUS_MAR) {
!       sprintf (&buf[strlen(buf)], "%-*d", pfield + 1, argus->argus_mar.flows);
  
     } else {
        struct ArgusFlow *flow = &argus->argus_far.flow;
--- 1640,1646 ----
  ArgusPrintDstPort (char *buf, struct ArgusRecord *argus)
  {
     if (argus->ahdr.type & ARGUS_MAR) {
!       sprintf (&buf[strlen(buf)], "%-*u", pfield + 1, argus->argus_mar.flows);
  
     } else {
        struct ArgusFlow *flow = &argus->argus_far.flow;
***************
*** 1673,1681 ****
              } else
                 sprintf (&buf[strlen(buf)], "%*s", pfield - 1, " ");
  
-             if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
-                sprintf (buf, "%c", RaFieldDelimiter);
- 
              break;
  
           default:
--- 1663,1668 ----
***************
*** 1699,1769 ****
                 switch (proto) {
                    case IPPROTO_TCP:
                    case IPPROTO_UDP:
!                      if (RaPrintIndex > 0)
                          if ((RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintSrcAddr) ||
                               (RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintDstAddr))
                             if (RaFieldDelimiter == '\0')
                                if (buf[strlen(buf) - 1] == ' ')
                                   buf[strlen(buf) - 1] = '.';
  
-                      sprintf (buf, "%-*d ", thispfield, port);
                       break;
  
                    default:
-                      if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
-                         sprintf (&buf[strlen(buf)], "%c", RaFieldDelimiter);
-                      else
-                         sprintf (buf, "%-*.*s ", thispfield, thispfield, " ");
                       break;
                 }
              } else {
                 switch (proto) {
                    case IPPROTO_TCP:
                    case IPPROTO_UDP:
!                      if (RaPrintIndex > 0)
                          if ((RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintSrcAddr) ||
                               (RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintDstAddr))
                             if (RaFieldDelimiter == '\0')
                                if (buf[strlen(buf) - 1] == ' ')
                                   buf[strlen(buf) - 1] = '.';
  
                       if (proto == IPPROTO_TCP)
!                         sprintf (buf, "%-*.*s ", thispfield, thispfield, tcpport_string(port));
                       else
!                         sprintf (buf, "%-*.*s ", thispfield, thispfield, udpport_string(port));
                       break;
  
                    default:
!                      if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!                         sprintf (&buf[strlen(buf)], "%c", RaFieldDelimiter);
!                      else
!                         sprintf (buf, "%-*.*s ", thispfield, thispfield, " ");
                       break;
                 }
              }
  
           } else {
              if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0')) {
-                sprintf (buf, "%c", RaFieldDelimiter);
              } else {
                 switch (proto) {
                    default:
!                      sprintf (buf, "%-*.*s ", thispfield, thispfield, " ");
                       break;
  
                    case IPPROTO_TCP:
                    case IPPROTO_UDP:
!                      if (RaPrintIndex > 0)
                          if ((RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintSrcAddr) ||
                               (RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintDstAddr))
                             if (RaFieldDelimiter == '\0')
                                if (buf[strlen(buf) - 1] == ' ')
                                   buf[strlen(buf) - 1] = '.';
! 
                       if (argus->ahdr.status & ARGUS_MERGED)
                          sprintf (buf, "%-*.*s ", thispfield, thispfield, "*");
                       else 
!                         sprintf (buf, "%-*d ", thispfield, port);
                       break;
                 }
              }
--- 1686,1762 ----
                 switch (proto) {
                    case IPPROTO_TCP:
                    case IPPROTO_UDP:
!                      if ((RaPrintIndex > 0) && ((RaFieldDelimiter == ' ') ||
! 			 (RaFieldDelimiter == '\0'))) {
                          if ((RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintSrcAddr) ||
                               (RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintDstAddr))
                             if (RaFieldDelimiter == '\0')
                                if (buf[strlen(buf) - 1] == ' ')
                                   buf[strlen(buf) - 1] = '.';
+ 		     }
+ 
+                      sprintf (buf, "%-*d", thispfield, port);
  
                       break;
  
                    default:
                       break;
                 }
              } else {
                 switch (proto) {
                    case IPPROTO_TCP:
                    case IPPROTO_UDP:
!                      if ((RaPrintIndex > 0) && ((RaFieldDelimiter == ' ') ||
! 			 (RaFieldDelimiter == '\0'))) {
                          if ((RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintSrcAddr) ||
                               (RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintDstAddr))
                             if (RaFieldDelimiter == '\0')
                                if (buf[strlen(buf) - 1] == ' ')
                                   buf[strlen(buf) - 1] = '.';
+ 		     }
  
                       if (proto == IPPROTO_TCP)
!                         sprintf (buf, "%-*.*s", thispfield, thispfield, tcpport_string(port));
                       else
!                         sprintf (buf, "%-*.*s", thispfield, thispfield, udpport_string(port));
                       break;
  
                    default:
! 
                       break;
                 }
              }
  
           } else {
              if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0')) {
              } else {
                 switch (proto) {
                    default:
!                      sprintf (buf, "%-*.*s", thispfield, thispfield, " ");
!                      if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!                         sprintf (&buf[strlen(buf)], "%c", RaFieldDelimiter);
!                      else
!                         sprintf (buf, "%-*.*s ", thispfield, thispfield, " ");
                       break;
  
                    case IPPROTO_TCP:
                    case IPPROTO_UDP:
!                      if ((RaPrintIndex > 0) && ((RaFieldDelimiter == ' ') ||
! 			 (RaFieldDelimiter == '\0'))) {
                          if ((RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintSrcAddr) ||
                               (RaPrintAlgorithms[RaPrintIndex - 1] == ArgusPrintDstAddr))
                             if (RaFieldDelimiter == '\0')
                                if (buf[strlen(buf) - 1] == ' ')
                                   buf[strlen(buf) - 1] = '.';
! 		     }
                       if (argus->ahdr.status & ARGUS_MERGED)
                          sprintf (buf, "%-*.*s ", thispfield, thispfield, "*");
                       else 
!                         sprintf (buf, "%-*d", thispfield, port);
!                      if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!                         sprintf (&buf[strlen(buf)], "%c", RaFieldDelimiter);
!                      else
!                         sprintf (buf, "%-*.*s ", thispfield, thispfield, " ");
                       break;
                 }
              }
***************
*** 1775,1790 ****
        default:
           thispfield -= 2;
  
!          if ((ArgusThisProto == 0) && (proto != 0)) {
!             sprintf (buf, "%-*.*s ", thispfield, thispfield, llcsap_string((unsigned char) port));
!          } else {
  
-             if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0')) {
-                sprintf (buf, "%c", RaFieldDelimiter);
-             } else {
-                sprintf (buf, "%-*.*s ", thispfield, thispfield, " ");
-             }
-          }
     }
  
  }
--- 1768,1776 ----
        default:
           thispfield -= 2;
  
!          if ((ArgusThisProto == 0) && (proto != 0)) 
!             sprintf (buf, "%-*.*s", thispfield, thispfield, llcsap_string((unsigned char) port));
  
     }
  
  }
***************
*** 1969,1975 ****
        }
     }
  
!    sprintf (buf, "%s ", dirStr);
  }
  
  void
--- 1955,1961 ----
        }
     }
  
!    sprintf (buf, "%s", dirStr);
  }
  
  void
***************
*** 1986,1992 ****
        dst_count = argus->argus_far.dst.count;
     }
  
!    sprintf (buf, "%-8u %-8u  ", src_count, dst_count);
  }
  
  void
--- 1972,1978 ----
        dst_count = argus->argus_far.dst.count;
     }
  
!    sprintf (buf, "%-8u%c%-8u", src_count,RaFieldDelimiter, dst_count);
  }
  
  void
***************
*** 2001,2007 ****
        src_count = argus->argus_far.src.count;
     }
   
!    sprintf (buf, "%-8u ", src_count);
  }
  
  void
--- 1987,1993 ----
        src_count = argus->argus_far.src.count;
     }
   
!    sprintf (buf, "%-8u", src_count);
  }
  
  void
***************
*** 2016,2022 ****
        dst_count = argus->argus_far.dst.count;
     }
   
!    sprintf (buf, "%-8u ", dst_count);
  }
  
  void
--- 2002,2008 ----
        dst_count = argus->argus_far.dst.count;
     }
   
!    sprintf (buf, "%-8u", dst_count);
  }
  
  void
***************
*** 2038,2044 ****
        }
     }
  
!    sprintf (buf, "%-12u %-12u", src_bytes, dst_bytes);
  }
  
  void
--- 2024,2030 ----
        }
     }
  
!    sprintf (buf, "%-12u%c%-12u", src_bytes, RaFieldDelimiter, dst_bytes);
  }
  
  void
***************
*** 2077,2084 ****
     sprintf (buf, "%-12u", dst_bytes);
  }
  
- 
- 
  #include <math.h>
  
  void
--- 2063,2068 ----
***************
*** 2092,2099 ****
  void
  ArgusPrintDstJitter (char *buf, struct ArgusRecord *argus)
  {
!    RaPrintSrcTime = 1;
!    RaPrintDstTime = 0;
     ArgusPrintJitter (buf, argus);
  }
  
--- 2076,2083 ----
  void
  ArgusPrintDstJitter (char *buf, struct ArgusRecord *argus)
  {
!    RaPrintSrcTime = 0;
!    RaPrintDstTime = 1;
     ArgusPrintJitter (buf, argus);
  }
  
***************
*** 2102,2110 ****
  {
     struct ArgusTimeStruct *time = NULL;
     char stdstr[128], jitterstr[128];
!    int maxval = 0, minval = 0x7FFFFFFF, n, meanval = 0;
     long long sumtime = 0, tmpsumtime = 0;
!    double sumsqrd = 0.0, stdev = 0.0;
  
     ArgusThisFarStatus = ArgusIndexRecord(argus, ArgusThisFarHdrs);
     time = (struct ArgusTimeStruct *) ArgusThisFarHdrs[ARGUS_TIME_DSR_INDEX];
--- 2086,2096 ----
  {
     struct ArgusTimeStruct *time = NULL;
     char stdstr[128], jitterstr[128];
!    unsigned int n;
!    int maxval = 0, minval = 0x7FFFFFFF;
     long long sumtime = 0, tmpsumtime = 0;
!    double stdev = 0.0, sumsqrd1 = 0.0, sumsqrd2 = 0.0, sumsqrd;
!    float meanval;
  
     ArgusThisFarStatus = ArgusIndexRecord(argus, ArgusThisFarHdrs);
     time = (struct ArgusTimeStruct *) ArgusThisFarHdrs[ARGUS_TIME_DSR_INDEX];
***************
*** 2117,2157 ****
        n = 0;
  
        if (time != NULL) {
!          if (RaPrintActTime && time->src.act.n) {
!             n += time->src.act.n;
!             tmpsumtime = (time->src.act.meanval * time->src.act.n);
!             sumtime += tmpsumtime;
!             sumsqrd += (time->src.act.n * pow(time->src.act.stdev, 2.0)) + pow(tmpsumtime, 2.0)/time->src.act.n;
!             maxval = (maxval < time->src.act.maxval) ? time->src.act.maxval : maxval;
!             minval = (minval > time->src.act.minval) ? time->src.act.minval : minval;
!          }
! 
!          if (RaPrintIdleTime && time->src.idle.n) {
!             n += time->src.idle.n;
!             tmpsumtime = (time->src.idle.meanval * time->src.idle.n);
!             sumtime += tmpsumtime;
!             sumsqrd += (time->src.idle.n * pow(time->src.idle.stdev, 2.0)) + pow(tmpsumtime, 2.0)/time->src.idle.n;
!             maxval = (maxval < time->src.idle.maxval) ? time->src.idle.maxval : maxval;
!             minval = (minval > time->src.idle.minval) ? time->src.idle.minval : minval;
!          }
!       }
! 
!       if (n > 0) {
!          meanval = sumtime/n;
! /*
!          stdev = sqrt (sumsqrd/n - pow (meanval, 2.0));
!          istdev = (stdev) * 1;
! 
!          sprintf (stdstr, "%d.%03d", istdev/1000, istdev%1000);
!          stdstr[6] = '\0';
!          sprintf (jitterstr, "%6d.%03d (%6s)", meanval/1000, meanval%1000, stdstr);
! */
!          sprintf (jitterstr, "%6d.%03d", meanval/1000, meanval%1000);
!          sprintf (&buf[strlen(buf)], "%-12s ", jitterstr);
! 
!       } else {
!          sprintf (jitterstr, "%6d.%03d", meanval/1000, meanval%1000);
!          sprintf (&buf[strlen(buf)], "%-12s ", jitterstr);
        }
     }
  
--- 2103,2138 ----
        n = 0;
  
        if (time != NULL) {
!          if ((RaPrintActTime) && ((n = (time->src.act.n + time->dst.idle.n)) > 0)) {
! 	    if (time->src.act.n && time->dst.act.n) {
! 	       meanval  = ((time->src.act.meanval * time->src.act.n) +
! 	      		  (time->dst.idle.meanval * time->dst.act.n)) / n;
! 	       if (time->src.act.n) {
! 		  stdev = time->src.act.stdev;
! 		  sumsqrd1 = (time->src.act.n * pow(stdev, 2.0)) +
! 		              pow((time->src.act.meanval * time->src.act.n), 2.0)/time->src.act.n;
! 	       }
! 
! 	       if (time->dst.act.n) {
! 		  stdev = time->dst.act.meanval;
! 		  sumsqrd2 = (time->dst.act.n * pow(stdev, 2.0)) + 
! 			      pow((time->dst.act.meanval * time->dst.act.n), 2.0)/time->dst.act.n;
! 	       }
! 
! 	       sumsqrd = sumsqrd1 + sumsqrd2;
! 	       stdev   = ((sqrt ((sumsqrd/n) - pow (meanval, 2.0))) * 1);
! 	    } else 
! 	       stdev = (time->src.act.n) ? time->src.act.stdev : time->dst.act.stdev;
! 
! 	    sprintf (&buf[strlen(buf)],  "%f", stdev);
! 	 }
!       }	    
! 
!       if (RaPrintDstTime) {
!          if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!             sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
!          else 
!             sprintf(&buf[strlen(buf)], "%c", ' ');
        }
     }
  
***************
*** 2160,2207 ****
        bzero (jitterstr, 128);
        sumtime = 0;
        sumsqrd = 0.0;
!       meanval = 0;
        stdev = 0.0;
        maxval = 0;
        minval = 0x7FFFFFFF;
        n = 0;
  
        if (time != NULL) {
!          if (RaPrintActTime && time->dst.act.n) {
!             n += time->dst.act.n;
!             tmpsumtime = (time->dst.act.meanval * time->dst.act.n);
!             sumtime += tmpsumtime;
!             sumsqrd += (time->dst.act.n * pow(time->dst.act.stdev, 2.0)) + pow(tmpsumtime, 2.0)/time->dst.act.n;
!             maxval = (maxval < time->dst.act.maxval) ? time->dst.act.maxval : maxval;
!             minval = (minval > time->dst.act.minval) ? time->dst.act.minval : minval;
!          }
! 
!          if (RaPrintIdleTime && time->dst.idle.n) {
!             n += time->dst.idle.n;
!             tmpsumtime = (time->dst.idle.meanval * time->dst.idle.n);
!             sumtime += tmpsumtime;
!             sumsqrd += (time->dst.idle.n * pow(time->dst.idle.stdev, 2.0)) + pow(tmpsumtime, 2.0)/time->dst.idle.n;
!             maxval = (maxval < time->dst.idle.maxval) ? time->dst.idle.maxval : maxval;
!             minval = (minval > time->dst.idle.minval) ? time->dst.idle.minval : minval;
!          }
!       }
! 
!       if (n > 0) {
!          meanval = sumtime/n;
! /*
!          stdev = sqrt (sumsqrd/n - pow (meanval, 2.0));
!          istdev = (stdev)*1;
  
!          sprintf (stdstr, "%d.%03d", istdev/1000, istdev%1000);
!          stdstr[6] = '\0';
!          sprintf (jitterstr, "%6d.%03d (%s)", meanval/1000, meanval%1000, stdstr);
! */
!          sprintf (jitterstr, "%6d.%03d", meanval/1000, meanval%1000);
!          sprintf (&buf[strlen(buf)], "%-12s", jitterstr);
! 
!       } else {
!          sprintf (jitterstr, "%6d.%03d", meanval/1000, meanval%1000);
!          sprintf (&buf[strlen(buf)], "%-12s", jitterstr);
        }
     }
  }
--- 2141,2179 ----
        bzero (jitterstr, 128);
        sumtime = 0;
        sumsqrd = 0.0;
!       meanval = 0.0;
        stdev = 0.0;
        maxval = 0;
        minval = 0x7FFFFFFF;
+       stdev = 0.0;
+       sumsqrd1 = 0.0;
+       sumsqrd2 = 0.0;
        n = 0;
  
        if (time != NULL) {
!          if ((RaPrintDstTime) && ((n = (time->src.idle.n + time->dst.idle.n)) > 0)) {
! 	    if (time->src.idle.n && time->dst.idle.n) {
! 	       meanval  = ((time->src.idle.meanval * time->src.idle.n) +
! 	      		  (time->dst.idle.meanval * time->dst.idle.n)) / n;
! 	       if (time->src.idle.n) {
! 		  stdev = time->src.idle.stdev;
! 		  sumsqrd1 = (time->src.idle.n * pow(stdev, 2.0)) +
! 		              pow((time->src.idle.meanval * time->src.idle.n), 2.0)/time->src.idle.n;
! 	       }
! 
! 	       if (time->dst.idle.n) {
! 		  stdev = time->dst.idle.stdev;
! 		  sumsqrd2 = (time->dst.idle.n * pow(time->dst.idle.stdev, 2.0)) + 
! 			      pow((time->dst.idle.meanval * time->dst.idle.n), 2.0)/time->dst.idle.n;
! 	       }
! 
! 	       sumsqrd = sumsqrd1 + sumsqrd2;
! 	       stdev   = ((sqrt ((sumsqrd/n) - pow (meanval, 2.0))) * 1);
! 	    } else 
! 	       stdev = (time->src.idle.n) ? time->src.idle.stdev : time->dst.idle.stdev;
  
! 	    sprintf (&buf[strlen(buf)],  "%f", stdev);
! 	 }
        }
     }
  }
***************
*** 2209,2215 ****
  void
  ArgusPrintSrcRate (char *buf, struct ArgusRecord *argus)
  {
!    int src_count = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
     char tmpbuf[128], *ptr = tmpbuf;
--- 2181,2187 ----
  void
  ArgusPrintSrcRate (char *buf, struct ArgusRecord *argus)
  {
!    uint src_count = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
     char tmpbuf[128], *ptr = tmpbuf;
***************
*** 2236,2242 ****
  
     src_count = argus->argus_far.src.count;
  
!    if (src_count > 1)
        sprintf (ptr, "%.2f", ((double)(src_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
--- 2208,2214 ----
  
     src_count = argus->argus_far.src.count;
  
!    if (src_count > 0)
        sprintf (ptr, "%.2f", ((double)(src_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
***************
*** 2247,2253 ****
  void
  ArgusPrintDstRate (char *buf, struct ArgusRecord *argus)
  {
!    int dst_count = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
     char tmpbuf[128], *ptr = tmpbuf;
--- 2219,2225 ----
  void
  ArgusPrintDstRate (char *buf, struct ArgusRecord *argus)
  {
!    uint dst_count = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
     char tmpbuf[128], *ptr = tmpbuf;
***************
*** 2274,2280 ****
  
     dst_count = argus->argus_far.dst.count;
  
!    if (dst_count > 1)
        sprintf (ptr, "%.2f", ((double)(dst_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
--- 2246,2252 ----
  
     dst_count = argus->argus_far.dst.count;
  
!    if (dst_count > 0)
        sprintf (ptr, "%.2f", ((double)(dst_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
***************
*** 2285,2291 ****
  void
  ArgusPrintRate (char *buf, struct ArgusRecord *argus)
  {
!    int src_count = 0, dst_count = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
     char tmpbuf[128], *ptr = tmpbuf;
--- 2257,2263 ----
  void
  ArgusPrintRate (char *buf, struct ArgusRecord *argus)
  {
!    uint src_count = 0, dst_count = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
     char tmpbuf[128], *ptr = tmpbuf;
***************
*** 2313,2331 ****
     src_count = argus->argus_far.src.count;
     dst_count = argus->argus_far.dst.count;
  
!    if (src_count > 1)
        sprintf (ptr, "%.2f", ((double)(src_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
  
     sprintf (buf, "%10s", ptr);
  
!    if (dst_count > 1)
        sprintf (ptr, "%.2f", ((double)(dst_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
  
!    sprintf (&buf[strlen(buf)], "%10s  ", ptr);
  }
  
  /*
--- 2285,2308 ----
     src_count = argus->argus_far.src.count;
     dst_count = argus->argus_far.dst.count;
  
!    if (src_count > 0)
        sprintf (ptr, "%.2f", ((double)(src_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
  
     sprintf (buf, "%10s", ptr);
  
!    if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!       sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
!    else
!       sprintf(&buf[strlen(buf)], "%c", ' ');
! 
!    if (dst_count > 0)
        sprintf (ptr, "%.2f", ((double)(dst_count)/seconds));
     else
        sprintf (ptr, "%.2f", 0.0);
  
!    sprintf (&buf[strlen(buf)], "%10s", ptr);
  }
  
  /*
***************
*** 2443,2453 ****
        if (seconds) {
           sprintf (ptr, "%.4f", ((double)srcLossPkts));
           sprintf (buf, "%10s", ptr);
           sprintf (ptr, "%.4f", ((double)dstLossPkts));
!          sprintf (&buf[strlen(buf)], "%10s  ", ptr);
        } else {
           sprintf (ptr, "%.4f", 0.0);
           sprintf (buf, "%10s", ptr);
           sprintf (ptr, "%.4f", 0.0);
           sprintf (&buf[strlen(buf)], "%10s  ", ptr);
        }
--- 2420,2438 ----
        if (seconds) {
           sprintf (ptr, "%.4f", ((double)srcLossPkts));
           sprintf (buf, "%10s", ptr);
+          if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
+             sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
+          else
+             sprintf(&buf[strlen(buf)], "%c", ' ');
           sprintf (ptr, "%.4f", ((double)dstLossPkts));
!          sprintf (&buf[strlen(buf)], "%10s", ptr);
        } else {
           sprintf (ptr, "%.4f", 0.0);
           sprintf (buf, "%10s", ptr);
+          if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
+             sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
+          else
+             sprintf(&buf[strlen(buf)], "%c", ' ');
           sprintf (ptr, "%.4f", 0.0);
           sprintf (&buf[strlen(buf)], "%10s  ", ptr);
        }
***************
*** 2492,2501 ****
  
     if (seconds) {
        sprintf (ptr, "%.2f", ((double)(src_bytes * 8.0))/seconds);
!       sprintf (&buf[strlen(buf)], "%11s ", ptr);
     } else {
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (&buf[strlen(buf)], "%11s ", ptr);
     }
  }
  
--- 2477,2486 ----
  
     if (seconds) {
        sprintf (ptr, "%.2f", ((double)(src_bytes * 8.0))/seconds);
!       sprintf (&buf[strlen(buf)], "%11s", ptr);
     } else {
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (&buf[strlen(buf)], "%11s", ptr);
     }
  }
  
***************
*** 2538,2557 ****
  
     if (seconds) {
        sprintf (ptr, "%.2f", ((double)(dst_bytes * 8.0))/seconds);
!       sprintf (&buf[strlen(buf)], "%13s  ", ptr);
     } else {
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (&buf[strlen(buf)], "%13s  ", ptr);
     }
  }
  
  void
  ArgusPrintLoad (char *buf, struct ArgusRecord *argus)
  {
!    int src_count = 0, dst_count = 0, src_bytes = 0, dst_bytes = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
!    char tmpbuf[128], *ptr = tmpbuf;
     double seconds;
  
     start = &argus->argus_far.time.start;
--- 2523,2542 ----
  
     if (seconds) {
        sprintf (ptr, "%.2f", ((double)(dst_bytes * 8.0))/seconds);
!       sprintf (&buf[strlen(buf)], "%13s", ptr);
     } else {
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (&buf[strlen(buf)], "%13s", ptr);
     }
  }
  
  void
  ArgusPrintLoad (char *buf, struct ArgusRecord *argus)
  {
!    uint src_count = 0, dst_count = 0, src_bytes = 0, dst_bytes = 0;
     struct timeval *start = NULL, *last = NULL;
     struct timeval  timebuf,  *time = &timebuf;
!    char tmpbuf[128], *ptr = tmpbuf, delim = ' ';
     double seconds;
  
     start = &argus->argus_far.time.start;
***************
*** 2583,2599 ****
        src_bytes = argus->argus_far.src.bytes;
        dst_bytes = argus->argus_far.dst.bytes;
     }
  
     if (seconds) {
        sprintf (ptr, "%.2f", ((double)(src_bytes * 8.0))/seconds);
!       sprintf (buf, "%13s", ptr);
        sprintf (ptr, "%.2f", ((double)(dst_bytes * 8.0))/seconds);
!       sprintf (&buf[strlen(buf)], "%13s  ", ptr);
     } else {
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (buf, "%13s", ptr);
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (&buf[strlen(buf)], "%13s  ", ptr);
     }
  }
  
--- 2568,2587 ----
        src_bytes = argus->argus_far.src.bytes;
        dst_bytes = argus->argus_far.dst.bytes;
     }
+ 	
+    if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
+       delim = RaFieldDelimiter;
  
     if (seconds) {
        sprintf (ptr, "%.2f", ((double)(src_bytes * 8.0))/seconds);
!       sprintf (buf, "%13s%c", ptr, delim);
        sprintf (ptr, "%.2f", ((double)(dst_bytes * 8.0))/seconds);
!       sprintf (&buf[strlen(buf)], "%13s", ptr);
     } else {
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (buf, "%13s%c", ptr, delim);
        sprintf (ptr, "%.2f", 0.0);
!       sprintf (&buf[strlen(buf)], "%13s", ptr);
     }
  }
  
***************
*** 2608,2616 ****
              sdis = i - argus->argus_far.attr_ip.sttl;
           }
        }
!       sprintf (&buf[strlen(buf)], "  %3d  ", sdis);
     } else
!       sprintf (&buf[strlen(buf)], "  %3d  ", argus->argus_far.attr_ip.sttl);
  }
  
  void
--- 2596,2604 ----
              sdis = i - argus->argus_far.attr_ip.sttl;
           }
        }
!       sprintf (&buf[strlen(buf)], "  %3d", sdis);
     } else
!       sprintf (&buf[strlen(buf)], "  %3d", argus->argus_far.attr_ip.sttl);
  }
  
  void
***************
*** 2624,2633 ****
              ddis = i - argus->argus_far.attr_ip.dttl;
           }
        }
!       sprintf (&buf[strlen(buf)], "  %3d  ", ddis);
   
     } else
!       sprintf (&buf[strlen(buf)], "  %3d  ", argus->argus_far.attr_ip.dttl);
  }
  
  void
--- 2612,2621 ----
              ddis = i - argus->argus_far.attr_ip.dttl;
           }
        }
!       sprintf (&buf[strlen(buf)], "  %3d", ddis);
   
     } else
!       sprintf (&buf[strlen(buf)], "  %3d", argus->argus_far.attr_ip.dttl);
  }
  
  void
***************
*** 2637,2651 ****
        struct ArgusVlanStruct *vlan = (struct ArgusVlanStruct *) ArgusThisFarHdrs[ARGUS_VLAN_DSR_INDEX];
   
        if (vlan->status & ARGUS_SRC_VLAN)
!          sprintf (&buf[strlen(buf)], "0x%04x ", vlan->sid);
        else
!          sprintf(&buf[strlen(buf)], "       ");
        if (vlan->status & ARGUS_DST_VLAN)
!          sprintf (&buf[strlen(buf)], "0x%04x ", vlan->did);
        else
!          sprintf(&buf[strlen(buf)], "       ");
     } else
!       sprintf (&buf[strlen(buf)], "              ");
  }
  
  void
--- 2625,2646 ----
        struct ArgusVlanStruct *vlan = (struct ArgusVlanStruct *) ArgusThisFarHdrs[ARGUS_VLAN_DSR_INDEX];
   
        if (vlan->status & ARGUS_SRC_VLAN)
!          sprintf (&buf[strlen(buf)], "0x%04x%c", vlan->sid, RaFieldDelimiter);
        else
! 	 if (RaFieldDelimiter == ' ') 
!             sprintf(&buf[strlen(buf)], "       ");
! 	 else 
!             sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
        if (vlan->status & ARGUS_DST_VLAN)
!          sprintf (&buf[strlen(buf)], "0x%04x", vlan->did);
        else
! 	 if (RaFieldDelimiter == ' ')
!             sprintf(&buf[strlen(buf)], "      ");
     } else
!       if (RaFieldDelimiter == ' ') 
!          sprintf (&buf[strlen(buf)], "             ");
!       else 
! 	 sprintf(&buf[strlen(buf)], "%c", RaFieldDelimiter);
  }
  
  void
***************
*** 2655,2682 ****
        struct ArgusMplsStruct *mpls = (struct ArgusMplsStruct *) ArgusThisFarHdrs[ARGUS_MPLS_DSR_INDEX];
   
        if (mpls->status & ARGUS_SRC_MPLS)
!          sprintf (&buf[strlen(buf)], " %5x ", mpls->slabel);
        else
!          sprintf(&buf[strlen(buf)], "       ");
  
        if (mpls->status & ARGUS_DST_MPLS)
!          sprintf (&buf[strlen(buf)], " %5x ", mpls->dlabel);
        else
!          sprintf(&buf[strlen(buf)], "       ");
     } else 
!       sprintf (&buf[strlen(buf)], "              ");
  }
  
  void
  ArgusPrintSrcTOS (char *buf, struct ArgusRecord *argus)
  {
!    sprintf (&buf[strlen(buf)], "  %3d  ", argus->argus_far.attr_ip.stos);
  }
  
  void
  ArgusPrintDstTOS (char *buf, struct ArgusRecord *argus)
  {
!    sprintf (&buf[strlen(buf)], "  %3d  ", argus->argus_far.attr_ip.dtos);
  }
  
  
--- 2650,2681 ----
        struct ArgusMplsStruct *mpls = (struct ArgusMplsStruct *) ArgusThisFarHdrs[ARGUS_MPLS_DSR_INDEX];
   
        if (mpls->status & ARGUS_SRC_MPLS)
!          sprintf (&buf[strlen(buf)], "%5x%c", mpls->slabel, RaFieldDelimiter);
        else
!          sprintf(&buf[strlen(buf)], "     %c", RaFieldDelimiter);
  
        if (mpls->status & ARGUS_DST_MPLS)
!          sprintf (&buf[strlen(buf)], "%5x", mpls->dlabel);
        else
! 	 if (RaFieldDelimiter == ' ')
!             sprintf(&buf[strlen(buf)], "     ");
     } else 
! 	 if (RaFieldDelimiter == ' ')
!             sprintf(&buf[strlen(buf)], "     ");
! 	 else 
!             sprintf (&buf[strlen(buf)], "%c", RaFieldDelimiter);
  }
  
  void
  ArgusPrintSrcTOS (char *buf, struct ArgusRecord *argus)
  {
!    sprintf (&buf[strlen(buf)], "  %3d ", argus->argus_far.attr_ip.stos);
  }
  
  void
  ArgusPrintDstTOS (char *buf, struct ArgusRecord *argus)
  {
!    sprintf (&buf[strlen(buf)], "  %3d" , argus->argus_far.attr_ip.dtos);
  }
  
  
***************
*** 2694,2708 ****
           if (tcp != NULL) {
              srcwin = tcp->src.win;
              dstwin = tcp->dst.win;
!             sprintf (&buf[strlen(buf)], "%-5d  %-5d  ", srcwin, dstwin);
           } else {
!             sprintf (&buf[strlen(buf)], "%14s", " ");
           }
           break;
        }
  
        default:
!          sprintf (&buf[strlen(buf)], "%14s", " ");
     }
  }
  
--- 2693,2707 ----
           if (tcp != NULL) {
              srcwin = tcp->src.win;
              dstwin = tcp->dst.win;
!             sprintf (&buf[strlen(buf)], "%-5d%c%-5d", srcwin, RaFieldDelimiter, dstwin);
           } else {
!             sprintf (&buf[strlen(buf)], "%5s%c%5s", " ", RaFieldDelimiter, " ");
           }
           break;
        }
  
        default:
!          sprintf (&buf[strlen(buf)], "%5s%c%5s", " ", RaFieldDelimiter, " ");
     }
  }
  
***************
*** 2850,2858 ****
     bzero (tmpbuf, MAXSTRLEN);
  
     for (RaPrintIndex = 0; RaPrintIndex < MAX_PRINT_ALG_TYPES; RaPrintIndex++) {
!       if (RaPrintAlgorithms[RaPrintIndex] != NULL)
           RaPrintAlgorithms[RaPrintIndex](&argus_strbuf[strlen(argus_strbuf)], argus);
!       else
           break;
     }
  
--- 2849,2861 ----
     bzero (tmpbuf, MAXSTRLEN);
  
     for (RaPrintIndex = 0; RaPrintIndex < MAX_PRINT_ALG_TYPES; RaPrintIndex++) {
!       if (RaPrintAlgorithms[RaPrintIndex] != NULL) {
           RaPrintAlgorithms[RaPrintIndex](&argus_strbuf[strlen(argus_strbuf)], argus);
!          if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
!             sprintf(&argus_strbuf[strlen(argus_strbuf)], "%c", RaFieldDelimiter);
!          else
!             sprintf(&argus_strbuf[strlen(argus_strbuf)], "%c", ' ');
!       } else
           break;
     }
  
***************
*** 2882,2894 ****
        }
  
        while (*str) {
!          if (*str == ' ') {
!             if (lastchr != RaFieldDelimiter)
!                *ptr++ = RaFieldDelimiter;
              while (isspace((int)*str)) str++;
-          }
-          lastchr = *str;
- 
           *ptr++ = *str++;
        }
  
--- 2885,2892 ----
        }
  
        while (*str) {
!          if (*str == ' ') 
              while (isspace((int)*str)) str++;
           *ptr++ = *str++;
        }
  
***************
*** 3227,3233 ****
     if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
        delim = RaFieldDelimiter;
  
!    if ((ArgusSrcUserDataLen > 0) || (ArgusDstUserDataLen)) {
        if (ArgusSrcUserDataLen > 0) {
           switch (eflag) {
              case ARGUS_ENCODE_ASCII:
--- 3225,3231 ----
     if ((RaFieldDelimiter != ' ') && (RaFieldDelimiter != '\0'))
        delim = RaFieldDelimiter;
  
!    if ((ArgusSrcUserDataLen > 0) || (ArgusDstUserDataLen > 0)) {
        if (ArgusSrcUserDataLen > 0) {
           switch (eflag) {
              case ARGUS_ENCODE_ASCII:
***************
*** 3253,3274 ****
              bzero (strbuf, sizeof(strbuf));
              bzero (conbuf, sizeof(conbuf));
              if ((len = ArgusEncode (&user->data, NULL, len, str, sizeof(strbuf))) > 0)
!                sprintf (con, "%cs[%d]=%s", delim, len, str);
              else
                 sprintf (con, " ");
  
              if (delim == ' ')
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s ", exlen, con);
              else
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-s ", con);
  
-          } else {
-             if (delim != ' ')
-                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%c", delim);
-             else
-                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s ", exlen, " ");
           }
        }
  
        if (ArgusDstUserDataLen > 0) {
           switch (eflag) {
--- 3251,3271 ----
              bzero (strbuf, sizeof(strbuf));
              bzero (conbuf, sizeof(conbuf));
              if ((len = ArgusEncode (&user->data, NULL, len, str, sizeof(strbuf))) > 0)
!                sprintf (con, "s[%d]=%s", len, str);
              else
                 sprintf (con, " ");
  
              if (delim == ' ')
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s", exlen, con);
              else
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-s", con);
  
           }
        }
+       if (delim != ' ')
+          sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%c", delim);
+       else
+          sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s ", exlen, " ");
  
        if (ArgusDstUserDataLen > 0) {
           switch (eflag) {
***************
*** 3296,3318 ****
              bzero (strbuf, sizeof(strbuf));
              bzero (conbuf, sizeof(conbuf));
              if ((len = ArgusEncode (&user->data, NULL, len, str, sizeof(strbuf))) > 0)
!                sprintf (con, "%cd[%d]=%s", delim, len, str);
              else
                 sprintf (con, " ");
  
              if (delim == ' ')
                 sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s ", exlen, con);
              else
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-s ", con);
  
!          } else
!             if (delim != ' ')
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%c", delim);
!             else
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s ", exlen, " ");
        }
! 
!       sprintf (&RaUserDataStr[strlen(RaUserDataStr)], " ");
     }
  }
  
--- 3293,3314 ----
              bzero (strbuf, sizeof(strbuf));
              bzero (conbuf, sizeof(conbuf));
              if ((len = ArgusEncode (&user->data, NULL, len, str, sizeof(strbuf))) > 0)
!                sprintf (con, "d[%d]=%s", len, str);
              else
                 sprintf (con, " ");
  
              if (delim == ' ')
                 sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s ", exlen, con);
              else
!                sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-s", con);
  
!          }
        }
!    } else {
!       if (delim != ' ')
!          sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%c", delim);
!       else
!          sprintf (&RaUserDataStr[strlen(RaUserDataStr)], "%-*s %-*s ", exlen, " ", exlen, " ");
     }
  }
  



More information about the argus mailing list