- /* ethernet */
- e_hdr=(struct ethhdr *)package;
- /* what types ? */
- printf("types = ");
- printf("%x ",ntohs(e_hdr->h_proto));
- printf("dest_addr = ");
- for(i=0;i<ETH_ALEN;i++)
- printf("%x%s",*(e_hdr->h_dest+i),((i==ETH_ALEN-1)?" ":":"));
- printf(" src_addr = ");
- for(i=0;i<ETH_ALEN;i++)
- printf("%x%s",*(e_hdr->h_source+i),((i==ETH_ALEN-1)?"\n":":"));
- /* IP ? */
- if(ntohs(e_hdr->h_proto)==ETH_P_IP) {
- printf("ip protocol: ");
- ip_hdr=(struct ip *)(package+sizeof(struct ethhdr));
- printf("version = %x ",ntohs(ip_hdr->ip_v));
- printf("header_length = %x \n",ntohs(ip_hdr->ip_hl));
- // i=0;
- //printf("service = %x ",*(ip_hdr->ip_tos));
- //printf("total_length(dec.) = %hu \n",*(ip_hdr->ip_len));
- //printf("ip_addresses: source = ");
- //for(i=0;i<4;i++)
- // printf("%x%s",*(ip_hdr->ip_src+i),
- // (i==3?"\n":"."));
-
+ /* pcap header */
+ printf("pcap header: ");
+ printf("capture_length(dec): %d\t",pcap_header->caplen);
+ printf("off_wire_length(dec): %d\n",pcap_header->len);
+
+ /* wireless stuff */
+ /* prism wlan ng headers */
+ if((my_info_struct->mmode-0x30==1) &
+ (strncmp(my_info_struct->dev,"wlan",4)==0)) {
+ printf("prism header: (%d bytes)\n",p_o);
+ prism_hdr=(struct linux_wlan_ng_prism_hdr *)package;
+ printf("| message code/length: %d/%d |\t",prism_hdr->msgcode,
+ prism_hdr->msglen);
+ printf("device: %s |\n",prism_hdr->devname);
+ /* ieee802.11 header */
+
+ /* we need smaller w_hdr for non distributed frames */
+ if((w_hdr->frame_ctl & (1<<8)) && (w_hdr->frame_ctl & (1<<9))) {
+ printf("=> distributed packet !!!!11\n");
+ } else w_o-=(sizeof(struct snaphdr)-sizeof(unsigned short));
+
+ printf("ieee802.11 header: (%d bytes)\n",w_o);
+ w_hdr=(struct ieee802_11_hdr *)(package+p_o);
+
+ printf("fc: ");
+ for(i=0;i<16;i++)
+ printf("%s%d%s",(i==0?"|":""),
+ (((w_hdr->frame_ctl) & (1<<i))>0?1:0),
+ (i==15?"|\n":"|"));
+ printf(" | v | t | s-t |t|f|m|r|p|m|w|o|\n");
+ /* frame type */
+ /* management */
+ if(!(w_hdr->frame_ctl & 0x0c)) {
+ tmp_buf1[0]='\0'; tmp_buf2[0]='\0';
+ if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_REQ)>0)
+ strcpy(tmp_buf,"association request");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_RESP)>0)
+ strcpy(tmp_buf,"association response");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_REASSOC_REQ)>0)
+ strcpy(tmp_buf,"reassociation request");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_REASSOC_RESP)>0)
+ strcpy(tmp_buf,"reassociation response");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_PROBE_REQ)>0)
+ strcpy(tmp_buf,"probe request");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_PROBE_RESP)>0)
+ strcpy(tmp_buf,"probe response");
+ else if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)==IEEE802_11_STYPE_BEACON) {
+ beacon_hdr=(struct beacon_struct *)(package+p_o+w_o);
+ beacon_hdr->ssid_s.elementid==0?strcpy(tmp_buf1,"essid = ")
+ :strcpy(tmp_buf1,"ibssid = ");
+ strncpy(tmp_buf2,beacon_hdr->ssid_s.ssid,
+ beacon_hdr->ssid_s.length);