dccp_cc_sw.h revision 1.1 1 1.1 rjs /* $KAME: dccp_cc_sw.h,v 1.6 2005/02/10 04:25:38 itojun Exp $ */
2 1.1 rjs /* $NetBSD: dccp_cc_sw.h,v 1.1 2015/02/10 19:11:52 rjs Exp $ */
3 1.1 rjs
4 1.1 rjs /*
5 1.1 rjs * Copyright (c) 2003 Nils-Erik Mattsson
6 1.1 rjs * All rights reserved.
7 1.1 rjs *
8 1.1 rjs * Redistribution and use in source and binary forms, with or without
9 1.1 rjs * modification, are permitted provided that the following conditions
10 1.1 rjs * are met:
11 1.1 rjs *
12 1.1 rjs * 1. Redistributions of source code must retain the above copyright
13 1.1 rjs * notice, this list of conditions and the following disclaimer.
14 1.1 rjs * 2. Redistributions in binary form must reproduce the above copyright
15 1.1 rjs * notice, this list of conditions and the following disclaimer in the
16 1.1 rjs * documentation and/or other materials provided with the distribution.
17 1.1 rjs * 3. The name of the author may not be used to endorse or promote products
18 1.1 rjs * derived from this software without specific prior written permission.
19 1.1 rjs *
20 1.1 rjs * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 1.1 rjs * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 1.1 rjs * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 1.1 rjs * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 1.1 rjs * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 1.1 rjs * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 1.1 rjs * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 1.1 rjs * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 1.1 rjs * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 1.1 rjs * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 1.1 rjs *
31 1.1 rjs * Id: dccp_cc_sw.h,v 1.13 2003/05/13 15:31:50 nilmat-8 Exp
32 1.1 rjs */
33 1.1 rjs
34 1.1 rjs #ifndef _NETINET_DCCP_CC_SW_H_
35 1.1 rjs #define _NETINET_DCCP_CC_SW_H_
36 1.1 rjs
37 1.1 rjs /* All functions except inits has the ccb as first argument */
38 1.1 rjs
39 1.1 rjs /* Sender side */
40 1.1 rjs
41 1.1 rjs /* Init the sender side
42 1.1 rjs * args: dccpcb of current connection
43 1.1 rjs * returns: sender ccb
44 1.1 rjs */
45 1.1 rjs typedef void * cc_send_init_t (struct dccpcb *);
46 1.1 rjs
47 1.1 rjs /* Free the sender side */
48 1.1 rjs typedef void cc_send_free_t (void *);
49 1.1 rjs
50 1.1 rjs /* Ask the cc mechanism if dccp is allowed to send a packet
51 1.1 rjs * args: the packet size (0 == ACK)
52 1.1 rjs * returns: 1 if allowed to send, otherwise 0
53 1.1 rjs */
54 1.1 rjs typedef int cc_send_packet_t (void *, long);
55 1.1 rjs
56 1.1 rjs /* Inform the cc mechanism that a packet was sent
57 1.1 rjs * args: if there exists more to send or not
58 1.1 rjs * size of packet sent
59 1.1 rjs */
60 1.1 rjs typedef void cc_send_packet_sent_t (void *, int, long);
61 1.1 rjs
62 1.1 rjs /* Inform the cc mechanism (sender) that a packet has been received
63 1.1 rjs * args: options and option length
64 1.1 rjs */
65 1.1 rjs typedef void cc_send_packet_recv_t (void *, char *, int);
66 1.1 rjs
67 1.1 rjs
68 1.1 rjs /* Receiver side */
69 1.1 rjs
70 1.1 rjs /* Init the receiver side
71 1.1 rjs * args: dccpcb of current connection
72 1.1 rjs * returns: receiver ccb
73 1.1 rjs */
74 1.1 rjs typedef void * cc_recv_init_t (struct dccpcb *);
75 1.1 rjs
76 1.1 rjs /* Free the receiver side */
77 1.1 rjs typedef void cc_recv_free_t (void *);
78 1.1 rjs
79 1.1 rjs /* Inform the cc mechanism (receiver) that a packet was received
80 1.1 rjs * args: options and option length
81 1.1 rjs */
82 1.1 rjs typedef void cc_recv_packet_recv_t (void *, char *, int);
83 1.1 rjs
84 1.1 rjs struct dccp_cc_sw {
85 1.1 rjs /* Sender side */
86 1.1 rjs cc_send_init_t *cc_send_init;
87 1.1 rjs cc_send_free_t *cc_send_free;
88 1.1 rjs cc_send_packet_t *cc_send_packet;
89 1.1 rjs cc_send_packet_sent_t *cc_send_packet_sent;
90 1.1 rjs cc_send_packet_recv_t *cc_send_packet_recv;
91 1.1 rjs
92 1.1 rjs /* Receiver side */
93 1.1 rjs cc_recv_init_t *cc_recv_init;
94 1.1 rjs cc_recv_free_t *cc_recv_free;
95 1.1 rjs cc_recv_packet_recv_t *cc_recv_packet_recv;
96 1.1 rjs };
97 1.1 rjs
98 1.1 rjs /* Max ccid (i.e. cc_sw has DCCP_CC_MAX_CCID+2 elements) */
99 1.1 rjs #define DCCP_CC_MAX_CCID 2
100 1.1 rjs
101 1.1 rjs #endif
102