forked from osmocom/wireshark
Rename buffer_ routines to ws_buffer_ to avoid name collisions.
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>
This commit is contained in:
parent
41e322594b
commit
0734ac385f
|
@ -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;
|
||||
}
|
||||
|
|
28
file.c
28
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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
6
tshark.c
6
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;
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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){
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue