Rename buffer_ routines to ws_buffer_ to avoid name collisions.
authorGuy Harris <guy@alum.mit.edu>
Sat, 2 Aug 2014 11:00:48 +0000 (04:00 -0700)
committerGuy Harris <guy@alum.mit.edu>
Sat, 2 Aug 2014 11:01:29 +0000 (11:01 +0000)
In particular, epan/wslua/lrexlib.c has its own buffer_ routines,
causing some linker warnings on some platforms, as reported in bug
10332.

(Not to be backported to 1.12, as that would change the API and ABI of
libwsutil and libwiretap.  We should also make the buffer_ routines in
epan/wslua/lrexlib.c static, which should also address this problem, but
the name change avoids other potential namespace collisions.)

Change-Id: I1d42c7d1778c7e4c019deb2608d476c52001ce28
Reviewed-on: https://code.wireshark.org/review/3351
Reviewed-by: Guy Harris <guy@alum.mit.edu>
47 files changed:
epan/wslua/wslua_file.c
file.c
filetap/file_access.c
filetap/ftap.c
frame_tvbuff.c
reordercap.c
tfshark.c
tshark.c
ui/gtk/mcast_stream_dlg.c
ui/gtk/packet_list_store.c
ui/gtk/packet_win.c
ui/proto_hier_stats.c
ui/qt/packet_list_record.cpp
wiretap/ascend.y
wiretap/camins.c
wiretap/catapult_dct2000.c
wiretap/cosine.c
wiretap/csids.c
wiretap/daintree-sna.c
wiretap/dbs-etherwatch.c
wiretap/dct3trace.c
wiretap/eyesdn.c
wiretap/file_access.c
wiretap/iptrace.c
wiretap/iseries.c
wiretap/k12.c
wiretap/k12text.l
wiretap/libpcap.c
wiretap/logcat.c
wiretap/mp2t.c
wiretap/netmon.c
wiretap/netscaler.c
wiretap/netscreen.c
wiretap/nettl.c
wiretap/network_instruments.c
wiretap/netxray.c
wiretap/ngsniffer.c
wiretap/pcapng.c
wiretap/pppdump.c
wiretap/snoop.c
wiretap/toshiba.c
wiretap/visual.c
wiretap/vms.c
wiretap/vwr.c
wiretap/wtap.c
wsutil/buffer.c
wsutil/buffer.h

index 92d6364ab0e02123f05a0d03845eb3c263ae73d1..965014f4ce7203d48630d61a79c0fd2afbc8a949 100644 (file)
@@ -1284,8 +1284,8 @@ static int FrameInfo_set_data (lua_State* L) {
         const gchar* s = luaL_checklstring(L,2,&len);
         if (s) {
             /* Make sure we have enough room for the packet */
-            buffer_assure_space(fi->buf, len);
-            memcpy(buffer_start_ptr(fi->buf), s, len);
+            ws_buffer_assure_space(fi->buf, len);
+            memcpy(ws_buffer_start_ptr(fi->buf), s, len);
             fi->phdr->caplen = (guint32) len;
             fi->phdr->len = (guint32) len;
         } else {
@@ -1303,7 +1303,7 @@ static int FrameInfo_get_data (lua_State* L) {
 
     if (!fi->buf) return 0;
 
-    lua_pushlstring(L, buffer_start_ptr(fi->buf), buffer_length(fi->buf));
+    lua_pushlstring(L, ws_buffer_start_ptr(fi->buf), ws_buffer_length(fi->buf));
 
     WSLUA_RETURN(1); /* A Lua string of the frame buffer's data. */
 }
@@ -1801,7 +1801,7 @@ wslua_filehandler_seek_read(wtap *wth, gint64 seek_off,
                 size_t len = 0;
                 const gchar* fd = lua_tolstring(L, -1, &len);
                 if (len < WTAP_MAX_PACKET_SIZE)
-                    memcpy(buffer_start_ptr(buf), fd, len);
+                    memcpy(ws_buffer_start_ptr(buf), fd, len);
                 retval = 1;
                 break;
             }
diff --git a/file.c b/file.c
index 576b9c783c532828bab9d0f703c195538466dd47..edfca6a860ef95ff8edc9363ebe85dc022e8a537 100644 (file)
--- a/file.c
+++ b/file.c
@@ -346,7 +346,7 @@ cf_open(capture_file *cf, const char *fname, unsigned int type, gboolean is_temp
 
   /* XXX - we really want to initialize this after we've read all
      the packets, so we know how much we'll ultimately need. */
-  buffer_init(&cf->buf, 1500);
+  ws_buffer_init(&cf->buf, 1500);
 
   /* Create new epan session for dissection.
    * (The old one was freed in cf_close().)
@@ -471,7 +471,7 @@ cf_close(capture_file *cf)
   cf->open_type = WTAP_TYPE_AUTO;
 
   /* Free up the packet buffer. */
-  buffer_free(&cf->buf);
+  ws_buffer_free(&cf->buf);
 
   dfilter_free(cf->rfcode);
   cf->rfcode = NULL;
@@ -1758,8 +1758,8 @@ cf_read_record_r(capture_file *cf, const frame_data *fdata,
     }
 
     *phdr = frame->phdr;
-    buffer_assure_space(buf, frame->phdr.caplen);
-    memcpy(buffer_start_ptr(buf), frame->pd, frame->phdr.caplen);
+    ws_buffer_assure_space(buf, frame->phdr.caplen);
+    memcpy(ws_buffer_start_ptr(buf), frame->pd, frame->phdr.caplen);
     return TRUE;
   }
 #endif
@@ -2004,7 +2004,7 @@ rescan_packets(capture_file *cf, const char *action, const char *action_item, gb
 
     add_packet_to_packet_list(fdata, cf, &edt, dfcode,
                                     cinfo, &cf->phdr,
-                                    buffer_start_ptr(&cf->buf),
+                                    ws_buffer_start_ptr(&cf->buf),
                                     add_to_packet_list);
 
     /* If this frame is displayed, and this is the first frame we've
@@ -2239,7 +2239,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
   struct wtap_pkthdr phdr;
 
   memset(&phdr, 0, sizeof(struct wtap_pkthdr));
-  buffer_init(&buf, 1500);
+  ws_buffer_init(&buf, 1500);
 
   /* Update the progress bar when it gets to this value. */
   progbar_nextstep = 0;
@@ -2324,7 +2324,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
       break;
     }
     /* Process the packet */
-    if (!callback(cf, fdata, &phdr, buffer_start_ptr(&buf), callback_args)) {
+    if (!callback(cf, fdata, &phdr, ws_buffer_start_ptr(&buf), callback_args)) {
       /* Callback failed.  We assume it reported the error appropriately. */
       ret = PSP_FAILED;
       break;
@@ -2336,7 +2336,7 @@ process_specified_records(capture_file *cf, packet_range_t *range,
   if (progbar != NULL)
     destroy_progress_dlg(progbar);
 
-  buffer_free(&buf);
+  ws_buffer_free(&buf);
 
   return ret;
 }
@@ -3304,7 +3304,7 @@ match_narrow_and_wide(capture_file *cf, frame_data *fdata, void *criterion)
 
   result = MR_NOTMATCHED;
   buf_len = fdata->cap_len;
-  pd = buffer_start_ptr(&cf->buf);
+  pd = ws_buffer_start_ptr(&cf->buf);
   i = 0;
   while (i < buf_len) {
     c_char = pd[i];
@@ -3352,7 +3352,7 @@ match_narrow(capture_file *cf, frame_data *fdata, void *criterion)
 
   result = MR_NOTMATCHED;
   buf_len = fdata->cap_len;
-  pd = buffer_start_ptr(&cf->buf);
+  pd = ws_buffer_start_ptr(&cf->buf);
   i = 0;
   while (i < buf_len) {
     c_char = pd[i];
@@ -3399,7 +3399,7 @@ match_wide(capture_file *cf, frame_data *fdata, void *criterion)
 
   result = MR_NOTMATCHED;
   buf_len = fdata->cap_len;
-  pd = buffer_start_ptr(&cf->buf);
+  pd = ws_buffer_start_ptr(&cf->buf);
   i = 0;
   while (i < buf_len) {
     c_char = pd[i];
@@ -3445,7 +3445,7 @@ match_binary(capture_file *cf, frame_data *fdata, void *criterion)
 
   result = MR_NOTMATCHED;
   buf_len = fdata->cap_len;
-  pd = buffer_start_ptr(&cf->buf);
+  pd = ws_buffer_start_ptr(&cf->buf);
   i = 0;
   while (i < buf_len) {
     if (pd[i] == binary_data[c_match]) {
@@ -4013,11 +4013,11 @@ cf_get_comment(capture_file *cf, const frame_data *fd)
 
     memset(&phdr, 0, sizeof(struct wtap_pkthdr));
 
-    buffer_init(&buf, 1500);
+    ws_buffer_init(&buf, 1500);
     if (!cf_read_record_r(cf, fd, &phdr, &buf))
       { /* XXX, what we can do here? */ }
 
-    buffer_free(&buf);
+    ws_buffer_free(&buf);
     return phdr.opt_comment;
   }
   return NULL;
index d3bf37fc404b63fc9637dc767f456ba5c6d3f1c7..01de11594333e1783e2f2748248a0d1caa84e9bd 100644 (file)
@@ -730,7 +730,7 @@ ftap* ftap_open_offline(const char *filename, int *err, char **err_info,
 
 success:
        fth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
-       buffer_init(fth->frame_buffer, 1500);
+       ws_buffer_init(fth->frame_buffer, 1500);
 
        return fth;
 }
index 11d79b904d8d49f8e25afefdc74524770748fa12..4f570826357efc9f93c8aa45dd81f832553146bd 100644 (file)
@@ -311,7 +311,7 @@ ftap_sequential_close(ftap *fth)
        }
 
        if (fth->frame_buffer) {
-               buffer_free(fth->frame_buffer);
+               ws_buffer_free(fth->frame_buffer);
                g_free(fth->frame_buffer);
                fth->frame_buffer = NULL;
        }
@@ -431,9 +431,9 @@ ftap_read_packet_bytes(FILE_F fh, Buffer *buf, guint length, int *err,
 {
        int     bytes_read;
 
-       buffer_assure_space(buf, length);
+       ws_buffer_assure_space(buf, length);
        errno = FTAP_ERR_CANT_READ;
-       bytes_read = file_read(buffer_start_ptr(buf), length, fh);
+       bytes_read = file_read(ws_buffer_start_ptr(buf), length, fh);
 
        if (bytes_read < 0 || (guint)bytes_read != length) {
                *err = file_error(fh, err_info);
@@ -464,7 +464,7 @@ wtap_phdr(wtap *wth)
 guint8 *
 wtap_buf_ptr(wtap *wth)
 {
-       return buffer_start_ptr(wth->frame_buffer);
+       return ws_buffer_start_ptr(wth->frame_buffer);
 }
 #endif
 
index b47d206f07bbc4426421d13f02707d9f85acc857..c577f4693adc57537976c2320e7b8393358c1364 100644 (file)
@@ -80,13 +80,13 @@ frame_cache(struct tvb_frame *frame_tvb)
                frame_tvb->buf = (struct Buffer *) g_malloc(sizeof(struct Buffer));
 
                /* XXX, register frame_tvb to some list which frees from time to time not used buffers :] */
-               buffer_init(frame_tvb->buf, frame_tvb->tvb.length + frame_tvb->offset);
+               ws_buffer_init(frame_tvb->buf, frame_tvb->tvb.length + frame_tvb->offset);
 
                if (!frame_read(frame_tvb, &phdr, frame_tvb->buf))
                        { /* TODO: THROW(???); */ }
        }
 
-       frame_tvb->tvb.real_data = buffer_start_ptr(frame_tvb->buf) + frame_tvb->offset;
+       frame_tvb->tvb.real_data = ws_buffer_start_ptr(frame_tvb->buf) + frame_tvb->offset;
 }
 
 static void
@@ -95,7 +95,7 @@ frame_free(tvbuff_t *tvb)
        struct tvb_frame *frame_tvb = (struct tvb_frame *) tvb;
 
        if (frame_tvb->buf) {
-               buffer_free(frame_tvb->buf);
+               ws_buffer_free(frame_tvb->buf);
 
                g_free(frame_tvb->buf);
        }
@@ -231,7 +231,7 @@ frame_tvbuff_new(const frame_data *fd, const guint8 *buf)
 tvbuff_t *
 frame_tvbuff_new_buffer(const frame_data *fd, Buffer *buf)
 {
-       return frame_tvbuff_new(fd, buffer_start_ptr(buf));
+       return frame_tvbuff_new(fd, ws_buffer_start_ptr(buf));
 }
 
 static tvbuff_t *
@@ -336,5 +336,5 @@ file_tvbuff_new(const frame_data *fd, const guint8 *buf)
 tvbuff_t *
 file_tvbuff_new_buffer(const frame_data *fd, Buffer *buf)
 {
-       return frame_tvbuff_new(fd, buffer_start_ptr(buf));
+       return frame_tvbuff_new(fd, ws_buffer_start_ptr(buf));
 }
index 92469746821ffa5c787fef3338c6d51d6db5a790..c8e1fd53a40ff0be895e3ddd20287882951d703c 100644 (file)
@@ -143,7 +143,7 @@ frame_write(FrameRecord_t *frame, wtap *wth, wtap_dumper *pdh, Buffer *buf,
     phdr.ts = frame->time;
 
     /* Dump frame to outfile */
-    if (!wtap_dump(pdh, &phdr, buffer_start_ptr(buf), &err)) {
+    if (!wtap_dump(pdh, &phdr, ws_buffer_start_ptr(buf), &err)) {
         fprintf(stderr, "reordercap: Error (%s) writing frame to outfile\n",
                 wtap_strerror(err));
         exit(1);
@@ -361,7 +361,7 @@ main(int argc, char *argv[])
     }
 
     /* Write out each sorted frame in turn */
-    buffer_init(&buf, 1500);
+    ws_buffer_init(&buf, 1500);
     for (i = 0; i < frames->len; i++) {
         FrameRecord_t *frame = (FrameRecord_t *)frames->pdata[i];
 
@@ -371,7 +371,7 @@ main(int argc, char *argv[])
         }
         g_slice_free(FrameRecord_t, frame);
     }
-    buffer_free(&buf);
+    ws_buffer_free(&buf);
 
     if (!write_output_regardless && (wrong_order_count == 0)) {
         printf("Not writing output file because input file is already in order!\n");
index 6ac6fe06da5052061284f8750a74151b61301fde..a3a0a0c0e42d863157abae4055fdd2d7e0163b06 100644 (file)
--- a/tfshark.c
+++ b/tfshark.c
@@ -1867,7 +1867,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
 
     prev_dis = NULL;
     prev_cap = NULL;
-    buffer_init(&buf, 1500);
+    ws_buffer_init(&buf, 1500);
 
     if (do_dissection) {
       gboolean create_proto_tree;
@@ -1902,7 +1902,7 @@ load_cap_file(capture_file *cf, int max_packet_count, gint64 max_byte_count)
       edt = NULL;
     }
 
-    buffer_free(&buf);
+    ws_buffer_free(&buf);
   }
   else {
     framenum = 0;
index 0fe649c6f805bdc2521391e1cc7dc33f0532b183..8e142b4631a9b00681866a43c3e63799c5cc03a5 100644 (file)
--- a/tshark.c
+++ b/tshark.c
@@ -3240,7 +3240,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
 
     prev_dis = NULL;
     prev_cap = NULL;
-    buffer_init(&buf, 1500);
+    ws_buffer_init(&buf, 1500);
 
     if (do_dissection) {
       gboolean create_proto_tree;
@@ -3268,7 +3268,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
              filter, so, if we're writing to a capture file, write
              this packet out. */
           if (pdh != NULL) {
-            if (!wtap_dump(pdh, &phdr, buffer_start_ptr(&buf), &err)) {
+            if (!wtap_dump(pdh, &phdr, ws_buffer_start_ptr(&buf), &err)) {
               /* Error writing to a capture file */
               switch (err) {
 
@@ -3320,7 +3320,7 @@ load_cap_file(capture_file *cf, char *save_file, int out_file_type,
       edt = NULL;
     }
 
-    buffer_free(&buf);
+    ws_buffer_free(&buf);
   }
   else {
     framenum = 0;
index e9c45f479b44eaee919417234e45b6d35b07d84f..f13859fb9084159fb6502c7fcaeba7d81212dce3 100644 (file)
@@ -58,7 +58,7 @@ void register_tap_listener_mcast_stream_dlg(void);
 /* Capture callback data keys */
 #define E_MCAST_ENTRY_1     "burst_interval"
 #define E_MCAST_ENTRY_2     "burst_alarm"
-#define E_MCAST_ENTRY_3     "buffer_alarm"
+#define E_MCAST_ENTRY_3     "ws_buffer_alarm"
 #define E_MCAST_ENTRY_4     "stream_speed"
 #define E_MCAST_ENTRY_5     "total_speed"
 
index 6a3c77a4e2b5c89be6784775c213195e7f831cf8..58f949386429050058511e00876bd5dc11174a91 100644 (file)
@@ -1116,7 +1116,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
        } else
                cinfo = NULL;
 
-       buffer_init(&buf, 1500);
+       ws_buffer_init(&buf, 1500);
        if (!cf_read_record_r(&cfile, fdata, &phdr, &buf)) {
                /*
                 * Error reading the record.
@@ -1138,7 +1138,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
                        fdata->color_filter = NULL;
                        record->colorized = TRUE;
                }
-               buffer_free(&buf);
+               ws_buffer_free(&buf);
                return; /* error reading the record */
        }
 
@@ -1175,7 +1175,7 @@ packet_list_dissect_and_cache_record(PacketList *packet_list, PacketListRecord *
                record->colorized = TRUE;
 
        epan_dissect_cleanup(&edt);
-       buffer_free(&buf);
+       ws_buffer_free(&buf);
 }
 
 void
index 189ce8af909343955c887122b91800b61875a1c7..dd0e324cab0855b036736d423d88a57405f98bea 100644 (file)
@@ -974,7 +974,7 @@ void new_packet_window(GtkWidget *w _U_, gboolean reference, gboolean editable _
        DataPtr->frame = fd;
        DataPtr->phdr  = cfile.phdr;
        DataPtr->pd = (guint8 *)g_malloc(DataPtr->frame->cap_len);
-       memcpy(DataPtr->pd, buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len);
+       memcpy(DataPtr->pd, ws_buffer_start_ptr(&cfile.buf), DataPtr->frame->cap_len);
 
        epan_dissect_init(&(DataPtr->edt), DataPtr->epan, TRUE, TRUE);
        epan_dissect_run(&(DataPtr->edt), cfile.cd_t, &DataPtr->phdr,
index fd4adbd3338fe73eac9170c82be9762a35c2199c..c083de2fec277f0069fef2984de0fd14b6529848 100644 (file)
@@ -146,7 +146,7 @@ process_record(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
        memset(&phdr, 0, sizeof(struct wtap_pkthdr));
 
        /* Load the record from the capture file */
-       buffer_init(&buf, 1500);
+       ws_buffer_init(&buf, 1500);
        if (!cf_read_record_r(&cfile, frame, &phdr, &buf))
                return FALSE;   /* failure */
 
@@ -170,7 +170,7 @@ process_record(frame_data *frame, column_info *cinfo, ph_stats_t* ps)
 
        /* Free our memory. */
        epan_dissect_cleanup(&edt);
-       buffer_free(&buf);
+       ws_buffer_free(&buf);
 
        return TRUE;    /* success */
 }
index 2bad6f80323f8d10b3416a7404d8a43455bc8546..b5c50a979d294847cb62b3e21f56522d35856eb9 100644 (file)
@@ -98,7 +98,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_color)
         cinfo = &cap_file->cinfo;
     }
 
-    buffer_init(&buf, 1500);
+    ws_buffer_init(&buf, 1500);
     if (!cf_read_record_r(cap_file, fdata_, &phdr, &buf)) {
         /*
          * Error reading the record.
@@ -119,7 +119,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_color)
             fdata_->color_filter = NULL;
             colorized_ = TRUE;
         }
-        buffer_free(&buf);
+        ws_buffer_free(&buf);
         return;    /* error reading the record */
     }
 
@@ -155,7 +155,7 @@ void PacketListRecord::dissect(capture_file *cap_file, bool dissect_color)
     }
 
     epan_dissect_cleanup(&edt);
-    buffer_free(&buf);
+    ws_buffer_free(&buf);
 }
 
 //#define MINIMIZE_STRING_COPYING 1
index 3ba2deae6b79ef36338ae78efb3a08434fb4d9fe..881aece401edb950e8116d15442dff8d816586a8 100644 (file)
@@ -504,8 +504,8 @@ parse_ascend(ascend_t *ascend, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
 {
   int retval;
 
-  buffer_assure_space(buf, length);
-  retval = run_ascend_parser(fh, phdr, buffer_start_ptr(buf));
+  ws_buffer_assure_space(buf, length);
+  retval = run_ascend_parser(fh, phdr, ws_buffer_start_ptr(buf));
 
   /* did we see any data (hex bytes)? if so, tip off ascend_seek()
      as to where to look for the next packet, if any. If we didn't,
index 333eca16d80ef8f99f07d76dc8fd6eaef37db328..faa516aeaafebed84a2204d77c05d074be616549 100644 (file)
@@ -268,8 +268,8 @@ camins_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
     if (!find_next_pkt_dat_type_len(fh, &dat_trans_type, &dat_len, err, err_info))
         return FALSE;
 
-    buffer_assure_space(buf, DVB_CI_PSEUDO_HDR_LEN+dat_len);
-    p = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, DVB_CI_PSEUDO_HDR_LEN+dat_len);
+    p = ws_buffer_start_ptr(buf);
     /* NULL check for p is done in create_pseudo_hdr() */
     offset = create_pseudo_hdr(p, dat_trans_type, dat_len);
     if (offset<0) {
index 72a9fabd8a4237e544bdcddc72d7fe182d0c93fa..a0555ddd1f7278736e7b48dfa7b56474d9b44af9 100644 (file)
@@ -1298,7 +1298,7 @@ process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals,
 
     /*****************************/
     /* Get the data buffer ready */
-    buffer_assure_space(buf,
+    ws_buffer_assure_space(buf,
                         strlen(context_name)+1 +     /* Context name */
                         1 +                          /* port */
                         strlen(timestamp_string)+1 + /* timestamp */
@@ -1308,7 +1308,7 @@ process_parsed_line(wtap *wth, dct2000_file_externals_t *file_externals,
                         1 +                          /* direction */
                         1 +                          /* encap */
                         (is_comment ? data_chars : (data_chars/2)));
-    frame_buffer = buffer_start_ptr(buf);
+    frame_buffer = ws_buffer_start_ptr(buf);
 
     /******************************************/
     /* Write the stub info to the data buffer */
index 4b87d53578e949ea1e2a355feae1c3e3b3db6a90..fbf1c1384227a3c2d01acefd824528867cae4ee9 100644 (file)
@@ -447,8 +447,8 @@ parse_cosine_hex_dump(FILE_T fh, struct wtap_pkthdr *phdr, int pkt_len,
        int     i, hex_lines, n, caplen = 0;
 
        /* Make sure we have enough room for the packet */
-       buffer_assure_space(buf, COSINE_MAX_PACKET_LEN);
-       pd = buffer_start_ptr(buf);
+       ws_buffer_assure_space(buf, COSINE_MAX_PACKET_LEN);
+       pd = ws_buffer_start_ptr(buf);
 
        /* Calculate the number of hex dump lines, each
         * containing 16 bytes of data */
index 94632c0e5d2de34bd9f82f5d6a07087bc47f9766..99dff7f2bbf29228c2e004388f0232337c164c60 100644 (file)
@@ -205,7 +205,7 @@ csids_read_packet(FILE_T fh, csids_t *csids, struct wtap_pkthdr *phdr,
   if( !wtap_read_packet_bytes( fh, buf, phdr->caplen, err, err_info ) )
     return FALSE;
 
-  pd = buffer_start_ptr( buf );
+  pd = ws_buffer_start_ptr( buf );
   if( csids->byteswapped ) {
     if( phdr->caplen >= 2 ) {
       PBSWAP16(pd);   /* the ip len */
index 7379aa8688a047ec0800fb4aa6913949510f3e08..0b5ab67f85811b329b388efab311e3369cde0ff6 100644 (file)
@@ -287,7 +287,7 @@ daintree_sna_process_hex_data(struct wtap_pkthdr *phdr, Buffer *buf,
 
        phdr->caplen = bytes;
 
-       buffer_assure_space(buf, bytes);
-       memcpy(buffer_start_ptr(buf), readData, bytes);
+       ws_buffer_assure_space(buf, bytes);
+       memcpy(ws_buffer_start_ptr(buf), readData, bytes);
        return TRUE;
 }
index 99f0df529c50cb9bf5186887d548699e429caf84..fd6ca4a0886bba61fa919b624d296d1674ee8459 100644 (file)
@@ -284,8 +284,8 @@ parse_dbs_etherwatch_packet(struct wtap_pkthdr *phdr, FILE_T fh, Buffer* buf,
        int     count, line_count;
 
        /* Make sure we have enough room for the packet */
-       buffer_assure_space(buf, DBS_ETHERWATCH_MAX_PACKET_LEN);
-       pd = buffer_start_ptr(buf);
+       ws_buffer_assure_space(buf, DBS_ETHERWATCH_MAX_PACKET_LEN);
+       pd = ws_buffer_start_ptr(buf);
 
        eth_hdr_len = 0;
        memset(&tm, 0, sizeof(tm));
index 7e02c16e98867c5c7eed16a2c6227a74e529ef3d..5baaa69971e98167e5a77e38e8a6a330d365cc77 100644 (file)
@@ -220,8 +220,8 @@ static gboolean dct3trace_get_packet(FILE_T fh, struct wtap_pkthdr *phdr,
                                *err = 0;
 
                                /* Make sure we have enough room for the packet */
-                               buffer_assure_space(buf, phdr->caplen);
-                               memcpy( buffer_start_ptr(buf), databuf, phdr->caplen );
+                               ws_buffer_assure_space(buf, phdr->caplen);
+                               memcpy( ws_buffer_start_ptr(buf), databuf, phdr->caplen );
 
                                return TRUE;
                        }
index f9d7aea66e58d844e01f2bdca585990dff080120..ccf165c1fcdf41a4bd7fbf67db5ff805b1af0152 100644 (file)
@@ -321,10 +321,10 @@ read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err,
        phdr->len = pkt_len;
 
        /* Make sure we have enough room for the packet */
-       buffer_assure_space(buf, EYESDN_MAX_PACKET_LEN);
+       ws_buffer_assure_space(buf, EYESDN_MAX_PACKET_LEN);
 
        errno = WTAP_ERR_CANT_READ;
-       pd = buffer_start_ptr(buf);
+       pd = ws_buffer_start_ptr(buf);
        bytes_read = esc_read(pd, pkt_len, fh);
        if (bytes_read != pkt_len) {
                if (bytes_read == -2) {
index 3d213563618595d3f476798240fef3f37d12457b..740108da3336c7ec7dbd2d27a003fd144f50df0a 100644 (file)
@@ -1006,7 +1006,7 @@ fail:
 
 success:
        wth->frame_buffer = (struct Buffer *)g_malloc(sizeof(struct Buffer));
-       buffer_init(wth->frame_buffer, 1500);
+       ws_buffer_init(wth->frame_buffer, 1500);
 
        if(wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_PCAP){
 
index e5192e9981d59cd40538e3e262d13d69f3873449..3bd06f24cea3ff0119a82e49daa632eec0f86c16 100644 (file)
@@ -487,7 +487,7 @@ iptrace_read_rec_data(FILE_T fh, Buffer *buf, struct wtap_pkthdr *phdr,
                 * Attempt to guess from the packet data, the VPI,
                 * and the VCI information about the type of traffic.
                 */
-               atm_guess_traffic_type(phdr, buffer_start_ptr(buf));
+               atm_guess_traffic_type(phdr, ws_buffer_start_ptr(buf));
        }
 
        return TRUE;
index f0c32f255ebce1db0eb7c2c81a290c18a2b034b7..ba1dd628ec9ba1fc2f01e1d2808e66ad6e56c4da 100644 (file)
@@ -836,9 +836,9 @@ iseries_parse_packet (wtap * wth, FILE_T fh, struct wtap_pkthdr *phdr,
   phdr->caplen = ((guint32) strlen (ascii_buf))/2;
 
   /* Make sure we have enough room for the packet. */
-  buffer_assure_space (buf, ISERIES_MAX_PACKET_LEN);
+  ws_buffer_assure_space (buf, ISERIES_MAX_PACKET_LEN);
   /* Convert ascii data to binary and return in the frame buffer */
-  iseries_parse_hex_string (ascii_buf, buffer_start_ptr (buf), strlen (ascii_buf));
+  iseries_parse_hex_string (ascii_buf, ws_buffer_start_ptr (buf), strlen (ascii_buf));
 
   /* free buffer allocs and return */
   *err = 0;
index 1e8ad078d893f91c9e42369b9a12824a8a2650cc..068c968c76b48e2b69baf27bff5a0d05f550d7d2 100644 (file)
@@ -567,15 +567,15 @@ process_packet_data(struct wtap_pkthdr *phdr, Buffer *target, guint8 *buffer,
     type = pntoh32(buffer + K12_RECORD_TYPE);
     buffer_offset = (type == K12_REC_D0020) ? K12_PACKET_FRAME_D0020 : K12_PACKET_FRAME;
 
-    buffer_assure_space(target, length);
-    memcpy(buffer_start_ptr(target), buffer + buffer_offset, length);
+    ws_buffer_assure_space(target, length);
+    memcpy(ws_buffer_start_ptr(target), buffer + buffer_offset, length);
 
     /* extra information need by some protocols */
     extra_len = len - buffer_offset - length;
-    buffer_assure_space(&(k12->extra_info), extra_len);
-    memcpy(buffer_start_ptr(&(k12->extra_info)),
+    ws_buffer_assure_space(&(k12->extra_info), extra_len);
+    memcpy(ws_buffer_start_ptr(&(k12->extra_info)),
            buffer + buffer_offset + length, extra_len);
-    phdr->pseudo_header.k12.extra_info = (guint8*)buffer_start_ptr(&(k12->extra_info));
+    phdr->pseudo_header.k12.extra_info = (guint8*)ws_buffer_start_ptr(&(k12->extra_info));
     phdr->pseudo_header.k12.extra_length = extra_len;
 
     src_id = pntoh32(buffer + K12_RECORD_SRC_ID);
@@ -731,7 +731,7 @@ static k12_t* new_k12_file_data(void) {
     fd->rand_read_buff = NULL;
     fd->rand_read_buff_len = 0;
 
-    buffer_init(&(fd->extra_info), 100);
+    ws_buffer_init(&(fd->extra_info), 100);
 
     return fd;
 }
@@ -750,7 +750,7 @@ static void destroy_k12_file_data(k12_t* fd) {
     g_hash_table_destroy(fd->src_by_id);
     g_hash_table_foreach_remove(fd->src_by_name,destroy_srcdsc,NULL);
     g_hash_table_destroy(fd->src_by_name);
-    buffer_free(&(fd->extra_info));
+    ws_buffer_free(&(fd->extra_info));
     g_free(fd->seq_read_buff);
     g_free(fd->rand_read_buff);
     g_free(fd);
index 0174954da15c99af649092e5873d72e78a68ffe8..f0d2d6783f005196433005d8d2c1fdf64d3176c7 100644 (file)
@@ -283,8 +283,8 @@ k12text_read(wtap *wth, int *err, char ** err_info, gint64 *data_offset)
 
        k12text_set_headers(&wth->phdr);
 
-       buffer_assure_space(wth->frame_buffer, wth->phdr.caplen);
-       memcpy(buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen);
+       ws_buffer_assure_space(wth->frame_buffer, wth->phdr.caplen);
+       memcpy(ws_buffer_start_ptr(wth->frame_buffer), bb, wth->phdr.caplen);
 
        return TRUE;
 }
@@ -313,8 +313,8 @@ k12text_seek_read(wtap *wth, gint64 seek_off, struct wtap_pkthdr *phdr, Buffer *
 
        k12text_set_headers(phdr);
 
-       buffer_assure_space(buf, phdr->caplen);
-       memcpy(buffer_start_ptr(buf), bb, phdr->caplen);
+       ws_buffer_assure_space(buf, phdr->caplen);
+       memcpy(ws_buffer_start_ptr(buf), bb, phdr->caplen);
 
        return TRUE;
 }
index 727e48edddfed8f74ac4e0643a5c0267008ee229..4d3c8a5224612c572f7af1928137d24a4285669c 100644 (file)
@@ -695,7 +695,7 @@ libpcap_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
 
        libpcap = (libpcap_t *)wth->priv;
        pcap_read_post_process(wth->file_type_subtype, wth->file_encap,
-           phdr, buffer_start_ptr(buf), libpcap->byte_swapped, -1);
+           phdr, ws_buffer_start_ptr(buf), libpcap->byte_swapped, -1);
        return TRUE;
 }
 
index 53fb2fec0140fd2ac6a3edbe93792d49951bffaf..4dedff3ff111b8bcde491acaf7b895e5a0223391 100644 (file)
@@ -331,8 +331,8 @@ static gboolean logcat_read_packet(struct logcat_phdr *logcat, FILE_T fh,
         return FALSE;
     }
 
-    buffer_assure_space(buf, packet_size);
-    pd = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, packet_size);
+    pd = ws_buffer_start_ptr(buf);
     log_entry = (struct logger_entry *) pd;
 
     /* Copy the first two bytes of the packet. */
index 9ea24a2b36223fae13be28436a019dd60b79b392..3b3dc81a9e9c6e4372267a5448d6ce5fa9bd4daf 100644 (file)
@@ -67,9 +67,9 @@ mp2t_read_packet(mp2t_filetype_t *mp2t, FILE_T fh, gint64 offset,
     guint64 tmp;
     int bytes_read;
 
-    buffer_assure_space(buf, MP2T_SIZE);
+    ws_buffer_assure_space(buf, MP2T_SIZE);
     errno = WTAP_ERR_CANT_READ;
-    bytes_read = file_read(buffer_start_ptr(buf), MP2T_SIZE, fh);
+    bytes_read = file_read(ws_buffer_start_ptr(buf), MP2T_SIZE, fh);
     if (MP2T_SIZE != bytes_read) {
         *err = file_error(fh, err_info);
         /* bytes_read==0 is end of file, not a short read */
index 23c1aa3c407bf09b32296d885cfdc7d296edb0e3..bb974a931a689b5592781bff220acf307a17f20e 100644 (file)
@@ -421,7 +421,7 @@ netmon_set_pseudo_header_info(struct wtap_pkthdr *phdr, Buffer *buf)
                 * Attempt to guess from the packet data, the VPI, and
                 * the VCI information about the type of traffic.
                 */
-               atm_guess_traffic_type(phdr, buffer_start_ptr(buf));
+               atm_guess_traffic_type(phdr, ws_buffer_start_ptr(buf));
                break;
 
        case WTAP_ENCAP_ETHERNET:
index edc1eea34e733c09e9a0ea487d7e8d7a3749132e..978f10aec7c0d7dd57ac1a373499aceacfb7f0d9 100644 (file)
@@ -961,8 +961,8 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
             (phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
             (phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
             TRACE_FULL_V##type##_REC_LEN_OFF(phdr,v##type##_full,fp,pktracefull_v##type);\
-            buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
-            memcpy(buffer_start_ptr(wth->frame_buffer), fp, (phdr)->caplen);\
+            ws_buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+            memcpy(ws_buffer_start_ptr(wth->frame_buffer), fp, (phdr)->caplen);\
             *data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
             nstrace->nstrace_buf_offset = nstrace_buf_offset + (phdr)->len;\
             nstrace->nstrace_buflen = nstrace_buflen;\
@@ -985,8 +985,8 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
             (phdr)->ts.secs = nstrace->nspm_curtime + (guint32) (nsg_creltime / 1000000000);\
             (phdr)->ts.nsecs = (guint32) (nsg_creltime % 1000000000);\
             TRACE_PART_V##type##_REC_LEN_OFF(phdr,v##type##_part,pp,pktracepart_v##type);\
-            buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
-            memcpy(buffer_start_ptr(wth->frame_buffer), pp, (phdr)->caplen);\
+            ws_buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+            memcpy(ws_buffer_start_ptr(wth->frame_buffer), pp, (phdr)->caplen);\
             *data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
             nstrace->nstrace_buf_offset = nstrace_buf_offset + (phdr)->caplen;\
             nstrace->nsg_creltime = nsg_creltime;\
@@ -1114,8 +1114,8 @@ static gboolean nstrace_read_v10(wtap *wth, int *err, gchar **err_info, gint64 *
         SIZEDEF##ver((phdr),fp,ver);\
         TRACE_V##ver##_REC_LEN_OFF((phdr),enumprefix,type,structname);\
         (phdr)->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##TYPE;\
-        buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
-        memcpy(buffer_start_ptr(wth->frame_buffer), fp, (phdr)->caplen);\
+        ws_buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+        memcpy(ws_buffer_start_ptr(wth->frame_buffer), fp, (phdr)->caplen);\
         *data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
         nstrace->nstrace_buf_offset = nstrace_buf_offset + nspr_getv20recordsize((nspr_hd_v20_t *)fp);\
         nstrace->nstrace_buflen = nstrace_buflen;\
@@ -1239,7 +1239,7 @@ static gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info, gint64 *
     SIZEDEF##ver((phdr),fp,ver);\
     TRACE_V##ver##_REC_LEN_OFF((phdr),enumprefix,type,structname);\
     (phdr)->pseudo_header.nstr.rec_type = NSPR_HEADER_VERSION##TYPE;\
-    buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
+    ws_buffer_assure_space(wth->frame_buffer, (phdr)->caplen);\
     *data_offset = nstrace->xxx_offset + nstrace_buf_offset;\
     while (nstrace_tmpbuff_off < nspr_##structname##_s) {\
         nstrace_tmpbuff[nstrace_tmpbuff_off++] = nstrace_buf[nstrace_buf_offset++];\
@@ -1267,7 +1267,7 @@ static gboolean nstrace_read_v20(wtap *wth, int *err, gchar **err_info, gint64 *
     while (nstrace_tmpbuff_off < nst_dataSize) {\
         nstrace_tmpbuff[nstrace_tmpbuff_off++] = nstrace_buf[nstrace_buf_offset++];\
     }\
-    memcpy(buffer_start_ptr(wth->frame_buffer), nstrace_tmpbuff, (phdr)->caplen);\
+    memcpy(ws_buffer_start_ptr(wth->frame_buffer), nstrace_tmpbuff, (phdr)->caplen);\
     nstrace->nstrace_buf_offset = nstrace_buf_offset;\
     nstrace->nstrace_buflen = nstrace_buflen = ((gint32)NSPR_PAGESIZE_TRACE);\
     nstrace->nsg_creltime = nsg_creltime;\
@@ -1372,8 +1372,8 @@ static gboolean nstrace_seek_read_v10(wtap *wth, gint64 seek_off,
     /*
     ** Copy the header to the buffer and read the rest of the record..
     */
-    buffer_assure_space(buf, record_length);
-    pd = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, record_length);
+    pd = ws_buffer_start_ptr(buf);
     memcpy(pd, (void *)&hdr, sizeof hdr);
     if (record_length > sizeof hdr) {
        bytes_to_read = (unsigned int)(record_length - sizeof hdr);
@@ -1477,8 +1477,8 @@ static gboolean nstrace_seek_read_v20(wtap *wth, gint64 seek_off,
     /*
     ** Copy the header to the buffer and read the rest of the record..
     */
-    buffer_assure_space(buf, record_length);
-    pd = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, record_length);
+    pd = ws_buffer_start_ptr(buf);
     memcpy(pd, (void *)&hdr, hdrlen);
     if (record_length > hdrlen) {
        bytes_to_read = (unsigned int)(record_length - hdrlen);
@@ -1592,8 +1592,8 @@ static gboolean nstrace_seek_read_v30(wtap *wth, gint64 seek_off,
     /*
     ** Copy the header to the buffer and read the rest of the record..
     */
-    buffer_assure_space(buf, record_length);
-    pd = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, record_length);
+    pd = ws_buffer_start_ptr(buf);
     memcpy(pd, (void *)&hdr, hdrlen);
     if (record_length > hdrlen) {
         bytes_to_read = (unsigned int)(record_length - hdrlen);
index 42918b14754a00204d887a1ea02e03062bc01256..c1fb1ece96f454b9fd7a9a7b25e54e0344bbfa13 100644 (file)
@@ -330,8 +330,8 @@ parse_netscreen_hex_dump(FILE_T fh, int pkt_len, const char *cap_int,
        gchar   dststr[13];
 
        /* Make sure we have enough room for the packet */
-       buffer_assure_space(buf, NETSCREEN_MAX_PACKET_LEN);
-       pd = buffer_start_ptr(buf);
+       ws_buffer_assure_space(buf, NETSCREEN_MAX_PACKET_LEN);
+       pd = ws_buffer_start_ptr(buf);
 
        while(1) {
 
index f93b92baf055c533335e4050cdfc6e43156c62e8..32739e9d3ad6b73a95b3a8bb78dc6b3b40858edf 100644 (file)
@@ -615,8 +615,8 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
     /*
      * Read the packet data.
      */
-    buffer_assure_space(buf, datalen);
-    pd = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, datalen);
+    pd = ws_buffer_start_ptr(buf);
     errno = WTAP_ERR_CANT_READ;
     if (fddihack) {
         /* read in FC, dest, src, DSAP and SSAP */
index fb571a041ffee9c9682a8e4c4fd9bb23400b6b7a..6b941aaff72bfc726ee03739eb4fbfec16908280 100644 (file)
@@ -546,7 +546,7 @@ read_packet_data(FILE_T fh, int offset_to_frame, int current_offset_from_packet_
     }
 
     /* set-up the packet buffer */
-    buffer_assure_space(buf, length);
+    ws_buffer_assure_space(buf, length);
 
     /* read in the packet data */
     if (!wtap_read_packet_bytes(fh, buf, length, err, err_info))
index 49e810ad61d7aa199f1107d0e4f4bc5a32a015f6..d8704d9fa0ae410a6776bd2af32471e5a567092d 100644 (file)
@@ -1640,7 +1640,7 @@ netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr, Buffer *buf)
                         * Try to guess the type and subtype based
                         * on the VPI/VCI and packet contents.
                         */
-                       pd = buffer_start_ptr(buf);
+                       pd = ws_buffer_start_ptr(buf);
                        atm_guess_traffic_type(phdr, pd);
                } else if (phdr->pseudo_header.atm.aal == AAL_5 &&
                    phdr->pseudo_header.atm.type == TRAF_LANE) {
@@ -1648,7 +1648,7 @@ netxray_guess_atm_type(wtap *wth, struct wtap_pkthdr *phdr, Buffer *buf)
                         * Try to guess the subtype based on the
                         * packet contents.
                         */
-                       pd = buffer_start_ptr(buf);
+                       pd = ws_buffer_start_ptr(buf);
                        atm_guess_lane_type(phdr, pd);
                }
        }
index 2bfdd1f2da4428869899b02dcdafc43461bd6e5b..99feaa2f599ab5e4a60bec952ba6cac080212e38 100644 (file)
@@ -1355,8 +1355,8 @@ ngsniffer_process_record(wtap *wth, gboolean is_random, guint *padding,
        /*
         * Read the packet data.
         */
-       buffer_assure_space(buf, size);
-       bytes_read = ng_file_read(buffer_start_ptr(buf), size, wth,
+       ws_buffer_assure_space(buf, size);
+       bytes_read = ng_file_read(ws_buffer_start_ptr(buf), size, wth,
            is_random, err, err_info);
        if (bytes_read != (gint64) size) {
                if (*err == 0)
@@ -1863,7 +1863,7 @@ fix_pseudo_header(int encap, Buffer *buf, int len,
 {
        const guint8 *pd;
 
-       pd = buffer_start_ptr(buf);
+       pd = ws_buffer_start_ptr(buf);
        switch (encap) {
 
        case WTAP_ENCAP_PER_PACKET:
index 45f1ad315649ea1d0bdf1288e6326ae4e56a983c..5e42797b68403f6b53cc76494ef730d8352151dc 100644 (file)
@@ -1311,7 +1311,7 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta
         g_free(option_content);
 
         pcap_read_post_process(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, iface_info.wtap_encap,
-            wblock->packet_header, buffer_start_ptr(wblock->frame_buffer),
+            wblock->packet_header, ws_buffer_start_ptr(wblock->frame_buffer),
             pn->byte_swapped, fcslen);
         return block_read;
 }
@@ -1488,7 +1488,7 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *
         }
 
         pcap_read_post_process(WTAP_FILE_TYPE_SUBTYPE_PCAPNG, iface_info.wtap_encap,
-            wblock->packet_header, buffer_start_ptr(wblock->frame_buffer),
+            wblock->packet_header, ws_buffer_start_ptr(wblock->frame_buffer),
             pn->byte_swapped, pn->if_fcslen);
         return block_read;
 }
@@ -1588,14 +1588,14 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
          * Start out with a buffer big enough for an IPv6 address and one
          * 64-byte name; we'll make the buffer bigger if necessary.
          */
-        buffer_init(&nrb_rec, INITIAL_NRB_REC_SIZE);
+        ws_buffer_init(&nrb_rec, INITIAL_NRB_REC_SIZE);
         while (block_read < to_read) {
                 /*
                  * There must be at least one record's worth of data
                  * here.
                  */
                 if ((size_t)(to_read - block_read) < sizeof nrb) {
-                        buffer_free(&nrb_rec);
+                        ws_buffer_free(&nrb_rec);
                         *err = WTAP_ERR_BAD_FILE;
                         *err_info = g_strdup_printf("pcapng_read_name_resolution_block: %d bytes left in the block < NRB record header size %u",
                                       to_read - block_read,
@@ -1604,7 +1604,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                 }
                 bytes_read = file_read(&nrb, sizeof nrb, fh);
                 if (bytes_read != sizeof nrb) {
-                        buffer_free(&nrb_rec);
+                        ws_buffer_free(&nrb_rec);
                         pcapng_debug0("pcapng_read_name_resolution_block: failed to read record header");
                         *err = file_error(fh, err_info);
                         return 0;
@@ -1617,7 +1617,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                 }
 
                 if (to_read - block_read < nrb.record_len + PADDING4(nrb.record_len)) {
-                        buffer_free(&nrb_rec);
+                        ws_buffer_free(&nrb_rec);
                         *err = WTAP_ERR_BAD_FILE;
                         *err_info = g_strdup_printf("pcapng_read_name_resolution_block: %d bytes left in the block < NRB record length + padding %u",
                                       to_read - block_read,
@@ -1645,17 +1645,17 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                  * should report a null name as such.)
                                  */
                                 if (nrb.record_len < 4) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         *err = WTAP_ERR_BAD_FILE;
                                         *err_info = g_strdup_printf("pcapng_read_name_resolution_block: NRB record length for IPv4 record %u < minimum length 4",
                                                       nrb.record_len);
                                         return -1;
                                 }
-                                buffer_assure_space(&nrb_rec, nrb.record_len);
-                                bytes_read = file_read(buffer_start_ptr(&nrb_rec),
+                                ws_buffer_assure_space(&nrb_rec, nrb.record_len);
+                                bytes_read = file_read(ws_buffer_start_ptr(&nrb_rec),
                                     nrb.record_len, fh);
                                 if (bytes_read != nrb.record_len) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         pcapng_debug0("pcapng_read_name_resolution_block: failed to read IPv4 record data");
                                         *err = file_error(fh, err_info);
                                         return 0;
@@ -1668,10 +1668,10 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                          * the record and add them.
                                          */
                                         memcpy(&v4_addr,
-                                            buffer_start_ptr(&nrb_rec), 4);
+                                            ws_buffer_start_ptr(&nrb_rec), 4);
                                         if (pn->byte_swapped)
                                                 v4_addr = GUINT32_SWAP_LE_BE(v4_addr);
-                                        for (namep = (char *)buffer_start_ptr(&nrb_rec) + 4, record_len = nrb.record_len - 4;
+                                        for (namep = (char *)ws_buffer_start_ptr(&nrb_rec) + 4, record_len = nrb.record_len - 4;
                                             record_len != 0;
                                             namep += namelen, record_len -= namelen) {
                                                 /*
@@ -1680,7 +1680,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                                  */
                                                 namelen = name_resolution_block_find_name_end(namep, record_len, err, err_info);
                                                 if (namelen == -1) {
-                                                        buffer_free(&nrb_rec);
+                                                        ws_buffer_free(&nrb_rec);
                                                         return -1;      /* fail */
                                                 }
                                                 pn->add_new_ipv4(v4_addr, namep);
@@ -1689,7 +1689,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
 
                                 file_offset64 = file_seek(fh, PADDING4(nrb.record_len), SEEK_CUR, err);
                                 if (file_offset64 <= 0) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         if (*err != 0)
                                                 return -1;
                                         return 0;
@@ -1712,22 +1712,22 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                  * should report a null name as such.)
                                  */
                                 if (nrb.record_len < 16) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         *err = WTAP_ERR_BAD_FILE;
                                         *err_info = g_strdup_printf("pcapng_read_name_resolution_block: NRB record length for IPv6 record %u < minimum length 16",
                                                       nrb.record_len);
                                         return -1;
                                 }
                                 if (to_read < nrb.record_len) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         pcapng_debug0("pcapng_read_name_resolution_block: insufficient data for IPv6 record");
                                         return 0;
                                 }
-                                buffer_assure_space(&nrb_rec, nrb.record_len);
-                                bytes_read = file_read(buffer_start_ptr(&nrb_rec),
+                                ws_buffer_assure_space(&nrb_rec, nrb.record_len);
+                                bytes_read = file_read(ws_buffer_start_ptr(&nrb_rec),
                                     nrb.record_len, fh);
                                 if (bytes_read != nrb.record_len) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         pcapng_debug0("pcapng_read_name_resolution_block: failed to read IPv6 record data");
                                         *err = file_error(fh, err_info);
                                         return 0;
@@ -1735,7 +1735,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                 block_read += bytes_read;
 
                                 if (pn->add_new_ipv6) {
-                                        for (namep = (char *)buffer_start_ptr(&nrb_rec) + 16, record_len = nrb.record_len - 16;
+                                        for (namep = (char *)ws_buffer_start_ptr(&nrb_rec) + 16, record_len = nrb.record_len - 16;
                                             record_len != 0;
                                             namep += namelen, record_len -= namelen) {
                                                 /*
@@ -1744,17 +1744,17 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                                  */
                                                 namelen = name_resolution_block_find_name_end(namep, record_len, err, err_info);
                                                 if (namelen == -1) {
-                                                        buffer_free(&nrb_rec);
+                                                        ws_buffer_free(&nrb_rec);
                                                         return -1;      /* fail */
                                                 }
-                                                pn->add_new_ipv6(buffer_start_ptr(&nrb_rec),
+                                                pn->add_new_ipv6(ws_buffer_start_ptr(&nrb_rec),
                                                     namep);
                                         }
                                 }
 
                                 file_offset64 = file_seek(fh, PADDING4(nrb.record_len), SEEK_CUR, err);
                                 if (file_offset64 <= 0) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         if (*err != 0)
                                                 return -1;
                                         return 0;
@@ -1765,7 +1765,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                                 pcapng_debug1("pcapng_read_name_resolution_block: unknown record type 0x%x", nrb.record_type);
                                 file_offset64 = file_seek(fh, nrb.record_len + PADDING4(nrb.record_len), SEEK_CUR, err);
                                 if (file_offset64 <= 0) {
-                                        buffer_free(&nrb_rec);
+                                        ws_buffer_free(&nrb_rec);
                                         if (*err != 0)
                                                 return -1;
                                         return 0;
@@ -1775,7 +1775,7 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t
                 }
         }
 
-        buffer_free(&nrb_rec);
+        ws_buffer_free(&nrb_rec);
         return block_read;
 }
 
index 300e2ae649dbdabdeed37a171d418472b1de9034..173a97adefe60e7b4270ec9f609f88c10227da9b 100644 (file)
@@ -351,8 +351,8 @@ pppdump_read(wtap *wth, int *err, gchar **err_info, gint64 *data_offset)
        } else
                pid = NULL;     /* sequential only */
 
-       buffer_assure_space(wth->frame_buffer, PPPD_BUF_SIZE);
-       buf = buffer_start_ptr(wth->frame_buffer);
+       ws_buffer_assure_space(wth->frame_buffer, PPPD_BUF_SIZE);
+       buf = ws_buffer_start_ptr(wth->frame_buffer);
 
        if (!collate(state, wth->fh, err, err_info, buf, &num_bytes, &direction,
            pid, 0)) {
@@ -746,8 +746,8 @@ pppdump_seek_read(wtap *wth,
        init_state(state->seek_state);
        state->seek_state->offset = pid->offset;
 
-       buffer_assure_space(buf, PPPD_BUF_SIZE);
-       pd = buffer_start_ptr(buf);
+       ws_buffer_assure_space(buf, PPPD_BUF_SIZE);
+       pd = ws_buffer_start_ptr(buf);
 
        /*
         * We'll start reading at the first record containing data from
index e5f831f3d8ff0d59190e9c9571905a448aa62352..2a5cee65ec44d8ca15e80bda6a083f7002cc1c4d 100644 (file)
@@ -655,7 +655,7 @@ snoop_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
         */
        if (wth->file_encap == WTAP_ENCAP_ATM_PDUS &&
            phdr->pseudo_header.atm.type == TRAF_LANE) {
-               atm_guess_lane_type(phdr, buffer_start_ptr(buf));
+               atm_guess_lane_type(phdr, ws_buffer_start_ptr(buf));
        }
 
        return rec_size - ((guint)sizeof hdr + packet_size);
index 049251499ae7c843542d5c60ffad61f0927980d3..1cbff935dc417601d0554154ba54704511fd29b0 100644 (file)
@@ -343,8 +343,8 @@ parse_toshiba_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
        }
 
        /* Make sure we have enough room for the packet */
-       buffer_assure_space(buf, TOSHIBA_MAX_PACKET_LEN);
-       pd = buffer_start_ptr(buf);
+       ws_buffer_assure_space(buf, TOSHIBA_MAX_PACKET_LEN);
+       pd = ws_buffer_start_ptr(buf);
 
        /* Calculate the number of hex dump lines, each
         * containing 16 bytes of data */
index 84b87be60f04d430b995fb5d637e0a77908f9b18..23c76e59cab4f556d98774832dd366a959823923 100644 (file)
@@ -573,7 +573,7 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
            be configured for auto-detect, in which case the encapsulation
            hint is 13, and the encapsulation must be guessed from the
            packet contents.  Auto-detect is the default. */
-        pd = buffer_start_ptr(buf);
+        pd = ws_buffer_start_ptr(buf);
 
         /* If PPP is specified in the encap hint, then use that */
         if (vpkt_hdr.encap_hint == 14)
index 027e3928b6faf4e7a4a780a8068ad51187887124..e05ca8fffd016f3977671ad17929d9d74e866015 100644 (file)
@@ -408,8 +408,8 @@ parse_vms_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, gch
     phdr->len = pkt_len;
 
     /* Make sure we have enough room for the packet */
-    buffer_assure_space(buf, pkt_len);
-    pd = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, pkt_len);
+    pd = ws_buffer_start_ptr(buf);
 
     /* Convert the ASCII hex dump to binary data */
     for (i = 0; i < pkt_len; i += 16) {
index 73c650921ae649eed617d3c6106b427d935f1443..a522531548fbead7a4c9f68040e1595632e3a484 100644 (file)
@@ -982,8 +982,8 @@ static gboolean vwr_read_s1_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr,
     phdr->rec_type = REC_TYPE_PACKET;
     phdr->presence_flags = WTAP_HAS_TS;
 
-    buffer_assure_space(buf, phdr->caplen);
-    data_ptr = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, phdr->caplen);
+    data_ptr = ws_buffer_start_ptr(buf);
 
     /*
      * Generate and copy out the common metadata headers,
@@ -1339,8 +1339,8 @@ static gboolean vwr_read_s2_W_rec(vwr_t *vwr, struct wtap_pkthdr *phdr,
     phdr->rec_type = REC_TYPE_PACKET;
     phdr->presence_flags = WTAP_HAS_TS;
 
-    buffer_assure_space(buf, phdr->caplen);
-    data_ptr = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, phdr->caplen);
+    data_ptr = ws_buffer_start_ptr(buf);
 
     /*
      * Generate and copy out the common metadata headers,
@@ -1635,8 +1635,8 @@ static gboolean vwr_read_rec_data_ethernet(vwr_t *vwr, struct wtap_pkthdr *phdr,
 
     /*etap_hdr.vw_ip_length = (guint16)ip_len;*/
 
-    buffer_assure_space(buf, phdr->caplen);
-    data_ptr = buffer_start_ptr(buf);
+    ws_buffer_assure_space(buf, phdr->caplen);
+    data_ptr = ws_buffer_start_ptr(buf);
 
     /*
      * Generate and copy out the common metadata headers,
index 2a6b7f220d6167a8313d097079d2af31d384a92e..64d0cdb6dc00e3fdb4fb8b3dd0d38585c48d139e 100644 (file)
@@ -881,7 +881,7 @@ wtap_sequential_close(wtap *wth)
        }
 
        if (wth->frame_buffer) {
-               buffer_free(wth->frame_buffer);
+               ws_buffer_free(wth->frame_buffer);
                g_free(wth->frame_buffer);
                wth->frame_buffer = NULL;
        }
@@ -1041,9 +1041,9 @@ wtap_read_packet_bytes(FILE_T fh, Buffer *buf, guint length, int *err,
 {
        int     bytes_read;
 
-       buffer_assure_space(buf, length);
+       ws_buffer_assure_space(buf, length);
        errno = WTAP_ERR_CANT_READ;
-       bytes_read = file_read(buffer_start_ptr(buf), length, fh);
+       bytes_read = file_read(ws_buffer_start_ptr(buf), length, fh);
 
        if (bytes_read < 0 || (guint)bytes_read != length) {
                *err = file_error(fh, err_info);
@@ -1073,7 +1073,7 @@ wtap_phdr(wtap *wth)
 guint8 *
 wtap_buf_ptr(wtap *wth)
 {
-       return buffer_start_ptr(wth->frame_buffer);
+       return ws_buffer_start_ptr(wth->frame_buffer);
 }
 
 gboolean
index e12c8de5f6752b61e711642ada6c59bf282ff36f..3a3bd3dcb52156e3790ea6d54ce39d987cf8e16f 100644 (file)
@@ -29,7 +29,7 @@
 
 /* Initializes a buffer with a certain amount of allocated space */
 void
-buffer_init(Buffer* buffer, gsize space)
+ws_buffer_init(Buffer* buffer, gsize space)
 {
        buffer->data = (guint8*)g_malloc(space);
        buffer->allocated = space;
@@ -39,7 +39,7 @@ buffer_init(Buffer* buffer, gsize space)
 
 /* Frees the memory used by a buffer */
 void
-buffer_free(Buffer* buffer)
+ws_buffer_free(Buffer* buffer)
 {
        g_free(buffer->data);
        buffer->data = NULL;
@@ -48,9 +48,9 @@ buffer_free(Buffer* buffer)
 /* Assures that there are 'space' bytes at the end of the used space
        so that another routine can copy directly into the buffer space. After
        doing that, the routine will also want to run
-       buffer_increase_length(). */
+       ws_buffer_increase_length(). */
 void
-buffer_assure_space(Buffer* buffer, gsize space)
+ws_buffer_assure_space(Buffer* buffer, gsize space)
 {
        gsize available_at_end = buffer->allocated - buffer->first_free;
        gsize space_used;
@@ -64,7 +64,7 @@ buffer_assure_space(Buffer* buffer, gsize space)
        /* Maybe we don't have the space available at the end, but we would
                if we moved the used space back to the beginning of the
                allocation. The buffer could have become fragmented through lots
-               of calls to buffer_remove_start(). I'm using buffer->start as the
+               of calls to ws_buffer_remove_start(). I'm using buffer->start as the
                same as 'available_at_start' in this comparison. */
 
        /* or maybe there's just no more room. */
@@ -88,18 +88,18 @@ buffer_assure_space(Buffer* buffer, gsize space)
 }
 
 void
-buffer_append(Buffer* buffer, guint8 *from, gsize bytes)
+ws_buffer_append(Buffer* buffer, guint8 *from, gsize bytes)
 {
-       buffer_assure_space(buffer, bytes);
+       ws_buffer_assure_space(buffer, bytes);
        memcpy(buffer->data + buffer->first_free, from, bytes);
        buffer->first_free += bytes;
 }
 
 void
-buffer_remove_start(Buffer* buffer, gsize bytes)
+ws_buffer_remove_start(Buffer* buffer, gsize bytes)
 {
        if (buffer->start + bytes > buffer->first_free) {
-               g_error("buffer_remove_start trying to remove %" G_GINT64_MODIFIER "u bytes. s=%" G_GINT64_MODIFIER "u ff=%" G_GINT64_MODIFIER "u!\n",
+               g_error("ws_buffer_remove_start trying to remove %" G_GINT64_MODIFIER "u bytes. s=%" G_GINT64_MODIFIER "u ff=%" G_GINT64_MODIFIER "u!\n",
                        (guint64)bytes, (guint64)buffer->start,
                        (guint64)buffer->first_free);
                /** g_error() does an abort() and thus never returns **/
@@ -115,15 +115,15 @@ buffer_remove_start(Buffer* buffer, gsize bytes)
 
 #ifndef SOME_FUNCTIONS_ARE_DEFINES
 void
-buffer_clean(Buffer* buffer)
+ws_buffer_clean(Buffer* buffer)
 {
-       buffer_remove_start(buffer, buffer_length(buffer));
+       ws_buffer_remove_start(buffer, ws_buffer_length(buffer));
 }
 #endif
 
 #ifndef SOME_FUNCTIONS_ARE_DEFINES
 void
-buffer_increase_length(Buffer* buffer, gsize bytes)
+ws_buffer_increase_length(Buffer* buffer, gsize bytes)
 {
        buffer->first_free += bytes;
 }
@@ -131,7 +131,7 @@ buffer_increase_length(Buffer* buffer, gsize bytes)
 
 #ifndef SOME_FUNCTIONS_ARE_DEFINES
 gsize
-buffer_length(Buffer* buffer)
+ws_buffer_length(Buffer* buffer)
 {
        return buffer->first_free - buffer->start;
 }
@@ -139,7 +139,7 @@ buffer_length(Buffer* buffer)
 
 #ifndef SOME_FUNCTIONS_ARE_DEFINES
 guint8 *
-buffer_start_ptr(Buffer* buffer)
+ws_buffer_start_ptr(Buffer* buffer)
 {
        return buffer->data + buffer->start;
 }
@@ -147,7 +147,7 @@ buffer_start_ptr(Buffer* buffer)
 
 #ifndef SOME_FUNCTIONS_ARE_DEFINES
 guint8 *
-buffer_end_ptr(Buffer* buffer)
+ws_buffer_end_ptr(Buffer* buffer)
 {
        return buffer->data + buffer->first_free;
 }
@@ -155,8 +155,8 @@ buffer_end_ptr(Buffer* buffer)
 
 #ifndef SOME_FUNCTIONS_ARE_DEFINES
 void
-buffer_append_buffer(Buffer* buffer, Buffer* src_buffer)
+ws_buffer_append_buffer(Buffer* buffer, Buffer* src_buffer)
 {
-       buffer_append(buffer, buffer_start_ptr(src_buffer), buffer_length(src_buffer));
+       ws_buffer_append(buffer, ws_buffer_start_ptr(src_buffer), ws_buffer_length(src_buffer));
 }
 #endif
index 774dcdddb68ca62601b14079567d133d8bf4b62c..d8047cd1fdbb30af6f64de03bfc9075017f1ffb4 100644 (file)
@@ -39,30 +39,30 @@ typedef struct Buffer {
 } Buffer;
 
 WS_DLL_PUBLIC
-void buffer_init(Buffer* buffer, gsize space);
+void ws_buffer_init(Buffer* buffer, gsize space);
 WS_DLL_PUBLIC
-void buffer_free(Buffer* buffer);
+void ws_buffer_free(Buffer* buffer);
 WS_DLL_PUBLIC
-void buffer_assure_space(Buffer* buffer, gsize space);
+void ws_buffer_assure_space(Buffer* buffer, gsize space);
 WS_DLL_PUBLIC
-void buffer_append(Buffer* buffer, guint8 *from, gsize bytes);
+void ws_buffer_append(Buffer* buffer, guint8 *from, gsize bytes);
 WS_DLL_PUBLIC
-void buffer_remove_start(Buffer* buffer, gsize bytes);
+void ws_buffer_remove_start(Buffer* buffer, gsize bytes);
 
 #ifdef SOME_FUNCTIONS_ARE_DEFINES
-# define buffer_clean(buffer) buffer_remove_start((buffer), buffer_length(buffer))
-# define buffer_increase_length(buffer,bytes) (buffer)->first_free += (bytes)
-# define buffer_length(buffer) ((buffer)->first_free - (buffer)->start)
-# define buffer_start_ptr(buffer) ((buffer)->data + (buffer)->start)
-# define buffer_end_ptr(buffer) ((buffer)->data + (buffer)->first_free)
-# define buffer_append_buffer(buffer,src_buffer) buffer_append((buffer), buffer_start_ptr(src_buffer), buffer_length(src_buffer))
+# define ws_buffer_clean(buffer) ws_buffer_remove_start((buffer), ws_buffer_length(buffer))
+# define ws_buffer_increase_length(buffer,bytes) (buffer)->first_free += (bytes)
+# define ws_buffer_length(buffer) ((buffer)->first_free - (buffer)->start)
+# define ws_buffer_start_ptr(buffer) ((buffer)->data + (buffer)->start)
+# define ws_buffer_end_ptr(buffer) ((buffer)->data + (buffer)->first_free)
+# define ws_buffer_append_buffer(buffer,src_buffer) ws_buffer_append((buffer), ws_buffer_start_ptr(src_buffer), ws_buffer_length(src_buffer))
 #else
- void buffer_clean(Buffer* buffer);
- void buffer_increase_length(Buffer* buffer, unsigned int bytes);
- unsigned int buffer_length(Buffer* buffer);
- guint8* buffer_start_ptr(Buffer* buffer);
- guint8* buffer_end_ptr(Buffer* buffer);
- void buffer_append_buffer(Buffer* buffer, Buffer* src_buffer);
+ void ws_buffer_clean(Buffer* buffer);
+ void ws_buffer_increase_length(Buffer* buffer, unsigned int bytes);
+ unsigned int ws_buffer_length(Buffer* buffer);
+ guint8* ws_buffer_start_ptr(Buffer* buffer);
+ guint8* ws_buffer_end_ptr(Buffer* buffer);
+ void ws_buffer_append_buffer(Buffer* buffer, Buffer* src_buffer);
 #endif
 
 #ifdef __cplusplus