Revision 08a4230a util/udpSocket.h

View differences:

util/udpSocket.h
80 80
#define SO_EE_ORIGIN_ICMP6      3
81 81
/// @}
82 82

  
83
typedef enum {OK = 0, MSGLEN, FAILURE} error_codes;
83
typedef enum {OK = 0, MSGLEN, FAILURE, THROTTLE} error_codes;
84 84

  
85 85
/** 
86 86
 * A callback functions for received pmtu errors (icmp packets type 3 code 4) 
......
114 114
 */
115 115
int sendPacket(const int udpSocket, struct iovec *iov, int len, struct sockaddr_in *socketaddr);
116 116

  
117
/** 
118
  * Decide if a packet should be throttled
119
  * The implementation follows a leaky bucket algorithm: 
120
  * if the packet would fill the bucket beyond its limit, it is to be discarded
121
  *
122
  * @param len The length of the packet to be sent
123
  * @return OK or THROTTLE 
124
*/
125
int outputRateControl(int len);
126

  
127
/**
128
  * Configure the parameters for output rate control.
129
  * These values may also be set while packets are being transmitted.
130
  * @param bucketsize The size of the bucket in kbytes
131
  * @param drainrate The amount of kbytes draining in a second. If drainrate is 0, then rateControl is completely disabled (all packets are passed).
132
*/
133
void setOutputRateParams(int bucketsize, int drainrate);
134

  
117 135
/**
118 136
 * Receive a udp packet
119 137
 * @param udpSocket The udpSocket file descriptor.

Also available in: Unified diff