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