Lines Matching defs:data

49 	static ancillary_data* FromData(void* data)
51 return (ancillary_data*)((char*)data - _ALIGN(sizeof(ancillary_data)));
66 static status_t append_data(net_buffer *buffer, const void *data, size_t size);
101 buffer->data = NULL;
126 free(buffer->data);
143 if (append_data(duplicate, buffer->data, buffer->size) != B_OK) {
154 /*! Clones the buffer by grabbing another reference to the underlying data.
155 If that data changes, it will be changed in the clone as well.
170 Split the buffer at offset, the header data
186 // allocate space for the tail data
194 memcpy(tailData, from->data + offset, remaining);
196 // truncate original data and move it to the new buffer
197 buffer->data = (uint8*)realloc(from->data, offset);
200 // the old buffer gets the newly allocated tail data
201 from->data = tailData;
224 status_t error = append_data(buffer, with->data, with->size);
228 // append buffer to the second buffer, then switch the data
229 status_t error = append_data(with, buffer->data, buffer->size);
233 free(buffer->data);
234 buffer->data = with->data;
237 with->data = NULL;
251 write_data(net_buffer *_buffer, size_t offset, const void *data, size_t size)
260 memcpy(buffer->data + offset, data, size);
267 read_data(net_buffer *_buffer, size_t offset, void *data, size_t size)
276 memcpy(data, buffer->data + offset, size);
294 memcpy(newData + size, buffer->data, buffer->size);
296 free(buffer->data);
297 buffer->data = newData;
301 *_contiguousBuffer = buffer->data;
308 prepend_data(net_buffer *buffer, const void *data, size_t size)
314 write_data(buffer, 0, data, size);
328 uint8* newData = (uint8*)realloc(buffer->data, buffer->size + size);
335 buffer->data = newData;
343 append_data(net_buffer *buffer, const void *data, size_t size)
351 write_data(buffer, used, data, size);
371 memmove(buffer->data, buffer->data + bytes, buffer->size);
372 buffer->data = (uint8*)realloc(buffer->data, buffer->size);
402 buffer->data = (uint8*)realloc(buffer->data, newSize);
410 Appends data coming from buffer \a source to the buffer \a buffer. It only
411 clones the data, though, that is the data is not copied, just referenced.
426 return append_data(buffer, source->data + offset, bytes);
431 Attaches ancillary data to the given buffer. The data are completely
432 orthogonal to the data the buffer stores.
435 \param header Description of the data.
436 \param data If not \c NULL, the data are copied into the allocated storage.
438 data as parameter when the buffer is destroyed.
439 \param _allocatedData Will be set to the storage allocated for the data.
444 const void *data, void (*destructor)(const ancillary_data_header*, void*),
448 // ancillary data in the buffer.
470 if (data != NULL)
471 memcpy(ancillaryData->Data(), data, header->len);
481 Detaches ancillary data from the given buffer. The associated memory is
482 free, i.e. the \a data pointer must no longer be used after calling this
484 the data.
487 \param data Pointer to the data to be removed (as returned by
490 attach_ancillary_data(), is invoked for the data.
494 detach_ancillary_data(net_buffer *_buffer, void *data, bool destroy)
498 if (data == NULL)
501 ancillary_data *ancillaryData = ancillary_data::FromData(data);
517 Moves all ancillary data from buffer \c from to the end of the list of
518 ancillary data of buffer \c to. Note, that this is the only function that
519 transfers or copies ancillary data from one buffer to another.
521 \param from The buffer from which to remove the ancillary data.
522 \param to The buffer to which to add teh ancillary data.
523 \return A pointer to the first of the moved ancillary data, if any, \c NULL
543 Returns the next ancillary data. When iterating over the data, initially
545 previously returned data pointer. After the last item, \c NULL is returned.
547 Note, that it is not safe to call detach_ancillary_data() for a data item
552 \param previousData The pointer to the previous data returned by this
554 \param header Pointer to allocated storage into which the data description
556 \return A pointer to the next ancillary data in the buffer. \c NULL after
601 *_contiguousBuffer = buffer->data + offset;
614 uint16 sum = compute_checksum(buffer->data + offset, size);
632 iovecs[0].iov_base = buffer->data;
658 dprintf("buffer %p, size %ld, data: %p\n", buffer, buffer->size,
659 buffer->data);
660 dump_block((char*)buffer->data, min_c(buffer->size, 32), " ");