예제 #1
0
파일: anaryze.c 프로젝트: Quacknine/------
int AnalyzeTcp(u_char *data,int size)
{
u_char	*ptr;
int	lest;
struct tcphdr	*tcphdr;

	ptr=data;
	lest=size;

	if(lest<sizeof(struct tcphdr)){
		if(fil[3] == 1){
		fprintf(stderr,"lest(%d)<sizeof(struct tcphdr)\n",lest);
		}
		return(-1);
	}

	tcphdr=(struct tcphdr *)ptr;
	ptr+=sizeof(struct tcphdr);
	lest-=sizeof(struct tcphdr);

	if(fil[3] == 1){
	PrintTcp(tcphdr,stdout);
	}

	return(0);
}
예제 #2
0
int AnalyzeTcp(u_char *data, int size) {
  u_char *ptr = NULL;
  int lest = 0;
  struct tcphdr *tcphdr = NULL;

  ptr = data;
  lest = size;

  if (lest < sizeof(struct tcphdr)) {
    ExitWithTooLittleLengthError("tcphdr", lest);
  }

  tcphdr = (struct tcphdr *) ptr;
  ptr += sizeof(struct tcphdr);     // ?
  lest -= sizeof(struct tcphdr);    // ?

  PrintTcp(tcphdr, stdout);

  return 0;
}