~ubuntu-branches/ubuntu/wily/openvswitch/wily

« back to all changes in this revision

Viewing changes to datapath-windows/ovsext/Netlink/NetlinkBuf.h

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2015-08-10 11:35:15 UTC
  • mfrom: (1.1.30)
  • Revision ID: package-import@ubuntu.com-20150810113515-575vj06oq29emxsn
Tags: 2.4.0~git20150810.97bab95-0ubuntu1
* New upstream snapshot from 2.4 branch:
  - d/*: Align any relevant packaging changes with upstream.
* d/*: wrap-and-sort.
* d/openvswitch-{common,vswitch}.install: Correct install location for
  bash completion files.
* d/tests/openflow.py: Explicitly use ovs-testcontroller as provided
  by 2.4.0 release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2014 VMware, Inc.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * You may obtain a copy of the License at:
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
#ifndef __NETLINK_BUF_H_
 
18
#define __NETLINK_BUF_H_ 1
 
19
 
 
20
typedef struct _NL_BUF {
 
21
    PCHAR head;         /* start address of the buffer */
 
22
    PCHAR tail;         /* first empty byte of the buffer */
 
23
    UINT32 bufLen;      /* original length of buffer */
 
24
    UINT32 bufRemLen;   /* remaining length of buffer */
 
25
} NL_BUFFER, *PNL_BUFFER;
 
26
 
 
27
VOID NlBufInit(PNL_BUFFER nlBuf, PCHAR base, UINT32 size);
 
28
VOID NlBufDeInit(PNL_BUFFER nlBuf);
 
29
 
 
30
BOOLEAN NlBufCopyAtTail(PNL_BUFFER nlBuf, PCHAR data, UINT32 len);
 
31
BOOLEAN NlBufCopyAtHead(PNL_BUFFER nlBuf, PCHAR data, UINT32 len);
 
32
BOOLEAN NlBufCopyAtOffset(PNL_BUFFER nlBuf, PCHAR data,
 
33
                          UINT32 len, UINT32 offset);
 
34
 
 
35
PCHAR NlBufCopyAtTailUninit(PNL_BUFFER nlBuf, UINT32 len);
 
36
PCHAR NlBufCopyAtHeadUninit(PNL_BUFFER nlBuf, UINT32 len);
 
37
PCHAR NlBufCopyAtOffsetUninit(PNL_BUFFER nlBuf, UINT32 len, UINT32 offset);
 
38
 
 
39
PCHAR NlBufAt(PNL_BUFFER nlBuf, UINT32 offset, UINT32 len);
 
40
 
 
41
/*
 
42
 * --------------------------------------------------------------------------
 
43
 * NlBufSize --
 
44
 *
 
45
 *    Returns the used size of buffer.
 
46
 * --------------------------------------------------------------------------
 
47
 */
 
48
static __inline UINT32
 
49
NlBufSize(PNL_BUFFER nlBuf)
 
50
{
 
51
    ASSERT(nlBuf);
 
52
    return (nlBuf->bufLen - nlBuf->bufRemLen);
 
53
}
 
54
 
 
55
/*
 
56
 * --------------------------------------------------------------------------
 
57
 * NlBufRemLen --
 
58
 *
 
59
 *    Returns the unused size of buffer.
 
60
 * --------------------------------------------------------------------------
 
61
 */
 
62
static __inline UINT32
 
63
NlBufRemLen(PNL_BUFFER nlBuf)
 
64
{
 
65
    ASSERT(nlBuf);
 
66
    return (nlBuf->bufRemLen);
 
67
}
 
68
 
 
69
#endif /* __NETLINK_BUF_H_ */