datapath-windows/ovsext/Netlink/NetlinkBuf.c
/*
 * --------------------------------------------------------------------------
 * NlBufCopyAtOffset --
 *
 *    Inserts data at input offset in the buffer.
 *    If the offset is earlier then tail end then it first creates
 *    space of size input length at input offset by moving the existing
 *    data forward.
 * --------------------------------------------------------------------------
 */


Inserts data at input offset in the buffer.
If the offset is earlier then tail end then it first creates
space of size input length at input offset by moving the existing
data forward.
Inserts data at input offset in the buffer . If the offset is earlier then tail end then it first creates space of size input length at input offset by moving the existing data forward .
BOOLEAN
NlBufCopyAtOffset(PNL_BUFFER nlBuf, PCHAR data, UINT32 len, UINT32 offset)
{
    PCHAR dest = NULL;
    BOOLEAN ret = TRUE;
    ASSERT(nlBuf);
    if ((!NL_BUF_IS_VALID_OFFSET(nlBuf, offset)) ||
        (!NL_BUF_CAN_ADD(nlBuf, len, offset))) {
        ret = FALSE;
        goto done;
    }
    dest = nlBuf->head + offset;
    if (dest == nlBuf->tail) {
        _NlBufCopyAtTailUnsafe(nlBuf, data, len);
        goto done;
    }
    _NlBufCopyAtOffsetUnsafe(nlBuf, data, len, offset);
done:
    return ret;
}
BOOLEAN NlBufCopyAtOffset ( PNL_BUFFER nlBuf , PCHAR data , UINT32 len , UINT32 offset ) { PCHAR dest = NULL ; BOOLEAN ret = TRUE ; ASSERT ( nlBuf ) ; if ( ( ! NL_BUF_IS_VALID_OFFSET ( nlBuf , offset ) ) || ( ! NL_BUF_CAN_ADD ( nlBuf , len , offset ) ) ) { ret = FALSE ; goto done ; } dest = nlBuf -> head + offset ; if ( dest == nlBuf -> tail ) { _NlBufCopyAtTailUnsafe ( nlBuf , data , len ) ; goto done ; } _NlBufCopyAtOffsetUnsafe ( nlBuf , data , len , offset ) ; done : return ret ; }
NlBufCopyAtOffset
NlBufCopyAtOffset
/* Check if input offset is valid and has enough space */ /* same as inserting in tail */