BadVPN – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 /**
2 * @file PacketPassFifoQueue.h
3 * @author Ambroz Bizjak <ambrop7@gmail.com>
4 *
5 * @section LICENSE
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of the author nor the
15 * names of its contributors may be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */
29  
30 #ifndef BADVPN_PACKETPASSFIFOQUEUE_H
31 #define BADVPN_PACKETPASSFIFOQUEUE_H
32  
33 #include <misc/debugcounter.h>
34 #include <structure/LinkedList1.h>
35 #include <base/DebugObject.h>
36 #include <flow/PacketPassInterface.h>
37  
38 typedef void (*PacketPassFifoQueue_handler_busy) (void *user);
39  
40 struct PacketPassFifoQueueFlow_s;
41  
42 typedef struct {
43 PacketPassInterface *output;
44 BPendingGroup *pg;
45 LinkedList1 waiting_flows_list;
46 struct PacketPassFifoQueueFlow_s *sending_flow;
47 BPending schedule_job;
48 int freeing;
49 DebugCounter d_flows_ctr;
50 DebugObject d_obj;
51 } PacketPassFifoQueue;
52  
53 typedef struct PacketPassFifoQueueFlow_s {
54 PacketPassFifoQueue *queue;
55 PacketPassInterface input;
56 int is_waiting;
57 LinkedList1Node waiting_flows_list_node;
58 uint8_t *waiting_data;
59 int waiting_len;
60 PacketPassFifoQueue_handler_busy handler_busy;
61 void *user;
62 DebugObject d_obj;
63 } PacketPassFifoQueueFlow;
64  
65 void PacketPassFifoQueue_Init (PacketPassFifoQueue *o, PacketPassInterface *output, BPendingGroup *pg);
66 void PacketPassFifoQueue_Free (PacketPassFifoQueue *o);
67 void PacketPassFifoQueue_PrepareFree (PacketPassFifoQueue *o);
68  
69 void PacketPassFifoQueueFlow_Init (PacketPassFifoQueueFlow *o, PacketPassFifoQueue *queue);
70 void PacketPassFifoQueueFlow_Free (PacketPassFifoQueueFlow *o);
71 void PacketPassFifoQueueFlow_AssertFree (PacketPassFifoQueueFlow *o);
72 int PacketPassFifoQueueFlow_IsBusy (PacketPassFifoQueueFlow *o);
73 void PacketPassFifoQueueFlow_SetBusyHandler (PacketPassFifoQueueFlow *o, PacketPassFifoQueue_handler_busy handler_busy, void *user);
74 PacketPassInterface * PacketPassFifoQueueFlow_GetInput (PacketPassFifoQueueFlow *o);
75  
76 #endif