int AnalyzeUdp(u_char *data,int size) { u_char *ptr; int lest; struct udphdr *udphdr; ptr=data; lest=size; if(lest<sizeof(struct udphdr)){ if(fil[2] == 1){ fprintf(stderr,"lest(%d)<sizeof(struct udphdr)\n",lest); } return(-1); } udphdr=(struct udphdr *)ptr; ptr+=sizeof(struct udphdr); lest-=sizeof(struct udphdr); if(fil[2] == 1){ PrintUdp(udphdr,stdout); } return(0); }
int AnalyzeUdp(u_char *data, int size) { u_char *ptr = NULL; int lest = 0; struct udphdr *udphdr = NULL; ptr = data; lest = size; if (lest < sizeof(struct udphdr)) { ExitWithTooLittleLengthError("udphdr", lest); } udphdr = (struct udphdr *) ptr; ptr += sizeof(struct udphdr); lest -= sizeof(struct udphdr); PrintUdp(udphdr, stdout); return 0; }