27 |
|
|
28 |
#include "buffer.h" |
#include "buffer.h" |
29 |
#include "access.h" |
#include "access.h" |
30 |
|
#include "window.h" |
31 |
#include "p3/header.h" |
#include "p3/header.h" |
32 |
|
|
33 |
struct p3state |
struct p3state |
34 |
{ |
{ |
35 |
int lastseq; |
int lastseq; /* the last sequence number sended */ |
36 |
int lastack; |
int lastack; /* the last sequence acknowledged */ |
37 |
int datawin; |
int want_ssr; /* an SS is received, but no SSR is send */ |
|
int nackwin; |
|
38 |
}; |
}; |
39 |
|
|
40 |
#define WINDOW_SIZE 16 /* Packet we can send/receive without ack */ |
#define WINDOW_SIZE 32 /* Packet we can send/receive without ack */ |
41 |
#define WINDOW_HIGH 8 /* when the window is considered near closed */ |
#define WINDOW_HIGH 24 /* when the window is considered near closed */ |
|
|
|
|
/* each buffer can handle 2 full packets */ |
|
|
#define BUFFER_SIZE P3_MAX_SIZE*2 |
|
|
|
|
|
extern struct p3hdr *data_win[WINDOW_SIZE]; |
|
|
extern int nack_win[WINDOW_SIZE]; |
|
42 |
|
|
43 |
extern struct p3state cli, srv; |
extern struct p3state cli, srv; |
44 |
|
extern window_t wsend, wunack, wnack; |
45 |
|
|
46 |
void p3_register_to_engine (const access_t * myaccess); |
void p3_register_to_engine (const access_t * myaccess); |
47 |
void p3_init (buffer_t * bufin, buffer_t * bufout); |
void p3_init (buffer_t * bufin, buffer_t * bufout); |
48 |
void p3_loop (buffer_t * bufin, buffer_t * bufout, int timeout); |
int p3_want_write(buffer_t * out); |
49 |
void p3_put_data (buffer_t * buffer, char *data, size_t data_size); |
void p3_recv (buffer_t * bufin); |
|
int p3_get_packet (buffer_t * buffer, buffer_t * out, |
|
|
struct p3hdr **header, char **data, size_t * data_size); |
|
|
void p3_put_packet (buffer_t * buffer, int type, char *data, |
|
|
size_t data_size); |
|
|
|
|
50 |
|
|
51 |
#endif /* __P3_P3_H__ */ |
#endif /* __P3_P3_H__ */ |