Move the new files to the same places as in automake.
[obnox/wireshark/wip.git] / wiretap / pcap-common.c
index 25a2be444c1fab04d0f9629d14c70a5122b0f8f6..576e5d82d4d918f73a3e03892833dc3da7eebe71 100644 (file)
@@ -378,6 +378,8 @@ static const struct {
        { 241,          WTAP_ENCAP_NETANALYZER_TRANSPARENT },
        /* IP-over-Infiniband, as specified by RFC 4391 section 6 */
        { 242,          WTAP_ENCAP_IP_OVER_IB },
+       /* ISO/IEC 13818-1 MPEG2-TS packets */
+       { 243,          WTAP_ENCAP_MPEG_2_TS },
 
        /*
         * To repeat:
@@ -934,11 +936,11 @@ pcap_read_sita_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header,
                return FALSE;
        }
 
-       pseudo_header->sita.flags   = sita_phdr[SITA_FLAGS_OFFSET];
-       pseudo_header->sita.signals = sita_phdr[SITA_SIGNALS_OFFSET];
-       pseudo_header->sita.errors1 = sita_phdr[SITA_ERRORS1_OFFSET];
-       pseudo_header->sita.errors2 = sita_phdr[SITA_ERRORS2_OFFSET];
-       pseudo_header->sita.proto   = sita_phdr[SITA_PROTO_OFFSET];
+       pseudo_header->sita.sita_flags   = sita_phdr[SITA_FLAGS_OFFSET];
+       pseudo_header->sita.sita_signals = sita_phdr[SITA_SIGNALS_OFFSET];
+       pseudo_header->sita.sita_errors1 = sita_phdr[SITA_ERRORS1_OFFSET];
+       pseudo_header->sita.sita_errors2 = sita_phdr[SITA_ERRORS2_OFFSET];
+       pseudo_header->sita.sita_proto   = sita_phdr[SITA_PROTO_OFFSET];
 
        return TRUE;
 }
@@ -1600,6 +1602,18 @@ pcap_process_pseudo_header(FILE_T fh, int file_type, int wtap_encap,
                        return -1;      /* Read error */
 
                phdr_len += size;
+
+               if (check_packet_size &&
+                   packet_size < (guint)phdr_len) {
+                       /*
+                        * Uh-oh, the packet isn't big enough for the pseudo-
+                        * header.
+                        */
+                       *err = WTAP_ERR_BAD_FILE;
+                       *err_info = g_strdup_printf("pcap: ERF file has a %u-byte packet, too small for a pseudo-header with ex- and sub-headers (%d)",
+                           packet_size, phdr_len);
+                       return -1;
+               }
                break;
 
        case WTAP_ENCAP_I2C:
@@ -1878,11 +1892,11 @@ pcap_write_phdr(wtap_dumper *wdh, int encap, const union wtap_pseudo_header *pse
                 * Write the SITA header.
                 */
                memset(&sita_hdr, 0, sizeof(sita_hdr));
-               sita_hdr[SITA_FLAGS_OFFSET]   = pseudo_header->sita.flags;
-               sita_hdr[SITA_SIGNALS_OFFSET] = pseudo_header->sita.signals;
-               sita_hdr[SITA_ERRORS1_OFFSET] = pseudo_header->sita.errors1;
-               sita_hdr[SITA_ERRORS2_OFFSET] = pseudo_header->sita.errors2;
-               sita_hdr[SITA_PROTO_OFFSET]   = pseudo_header->sita.proto;
+               sita_hdr[SITA_FLAGS_OFFSET]   = pseudo_header->sita.sita_flags;
+               sita_hdr[SITA_SIGNALS_OFFSET] = pseudo_header->sita.sita_signals;
+               sita_hdr[SITA_ERRORS1_OFFSET] = pseudo_header->sita.sita_errors1;
+               sita_hdr[SITA_ERRORS2_OFFSET] = pseudo_header->sita.sita_errors2;
+               sita_hdr[SITA_PROTO_OFFSET]   = pseudo_header->sita.sita_proto;
                if (!wtap_dump_file_write(wdh, sita_hdr, sizeof(sita_hdr), err))
                        return FALSE;
                wdh->bytes_dumped += sizeof(sita_hdr);