Digging deepter into VM concepts...
FossilOrigin-Name: ba6454642f17c0f87106cb6af12689457433d44ba1fe2dd1ef920dba7be2ef27
This commit is contained in:
@ -33,32 +33,37 @@
|
||||
|
||||
#include "cw_action.h"
|
||||
|
||||
struct conn{
|
||||
#include "itemstore.h"
|
||||
|
||||
struct conn {
|
||||
int sock;
|
||||
struct sockaddr_storage addr;
|
||||
int recv_timeout;
|
||||
|
||||
cw_actionlist_t msgtr;
|
||||
cw_itemstore_t itemstore;
|
||||
|
||||
|
||||
struct avltree *msgtr;
|
||||
|
||||
uint8_t capwap_state;
|
||||
|
||||
FRAGMAN * fragman;
|
||||
// void (* process_message)(void *,uint8_t *,uint8_t *, int);
|
||||
FRAGMAN *fragman;
|
||||
// void (* process_message)(void *,uint8_t *,uint8_t *, int);
|
||||
|
||||
// void (* process_message)(void *,struct cwrmsg *); //uint8_t *,uint8_t *, int);
|
||||
// void * pmsgarg;
|
||||
// void (* process_message)(void *,struct cwrmsg *); //uint8_t *,uint8_t *, int);
|
||||
// void * pmsgarg;
|
||||
|
||||
int fragid;
|
||||
|
||||
int seqnum;
|
||||
|
||||
int last_seqnum_received;
|
||||
int last_seqnum_received;
|
||||
int last_message_id_received;
|
||||
|
||||
// struct cwmsg * last_response;
|
||||
// struct cwmsg swm;
|
||||
// int last_response_seqnum;
|
||||
// int last_response_rid;
|
||||
// struct cwmsg * last_response;
|
||||
// struct cwmsg swm;
|
||||
// int last_response_seqnum;
|
||||
// int last_response_rid;
|
||||
|
||||
struct cwrmsg cwrmsg;
|
||||
uint8_t cwrmsg_buffer[65536];
|
||||
@ -69,42 +74,42 @@ struct conn{
|
||||
uint8_t req_buffer[65536];
|
||||
uint8_t resp_buffer[65536];
|
||||
|
||||
|
||||
|
||||
int mtu; /* max mtu, could be changed during discovery */
|
||||
int mtu_discovery; /* 0 mtu discovery turned off, 1 discovery tuned on */
|
||||
|
||||
/* receive and send methods */
|
||||
|
||||
int (*recv_packet)(struct conn *, uint8_t *,int);
|
||||
int (*recv_packet_peek)(struct conn *, uint8_t *,int);
|
||||
int (*send_packet)(struct conn *, const uint8_t *, int);
|
||||
int (*recv_packet) (struct conn *, uint8_t *, int);
|
||||
int (*recv_packet_peek) (struct conn *, uint8_t *, int);
|
||||
int (*send_packet) (struct conn *, const uint8_t *, int);
|
||||
|
||||
int (*read)(struct conn *, uint8_t*, int);
|
||||
int (*write)(struct conn *, const uint8_t*, int);
|
||||
int (*read) (struct conn *, uint8_t *, int);
|
||||
int (*write) (struct conn *, const uint8_t *, int);
|
||||
|
||||
/* optional packet queue */
|
||||
uint8_t ** q;
|
||||
uint8_t **q;
|
||||
int qsize;
|
||||
int qrpos;
|
||||
int qwpos;
|
||||
sem_t q_sem;
|
||||
uint8_t * cur_packet;
|
||||
uint8_t *cur_packet;
|
||||
int cur_packet_len;
|
||||
int cur_packet_pos;
|
||||
|
||||
/* dtls stuff */
|
||||
int (*dtls_start)(struct conn*);
|
||||
int (*dtls_accept)(struct conn*);
|
||||
int (*dtls_start) (struct conn *);
|
||||
int (*dtls_accept) (struct conn *);
|
||||
|
||||
char * dtls_psk;
|
||||
char *dtls_psk;
|
||||
int dtls_psk_len;
|
||||
|
||||
char * dtls_cert_file;
|
||||
char * dtls_key_file;
|
||||
char * dtls_key_pass;
|
||||
char *dtls_cert_file;
|
||||
char *dtls_key_file;
|
||||
char *dtls_key_pass;
|
||||
|
||||
void * dtls_data;
|
||||
char * dtls_cipher;
|
||||
void *dtls_data;
|
||||
char *dtls_cipher;
|
||||
int dtls_error;
|
||||
uint8_t dtls_cookie[8];
|
||||
int dtls_verify_peer;
|
||||
@ -118,11 +123,11 @@ struct conn{
|
||||
int max_retransmit;
|
||||
int wait_dtls;
|
||||
int wait_join;
|
||||
|
||||
|
||||
|
||||
|
||||
/* used to link the conn obj with other objects */
|
||||
void * data;
|
||||
void *data;
|
||||
|
||||
/* misc */
|
||||
int capwap_mode;
|
||||
@ -130,8 +135,8 @@ struct conn{
|
||||
int strict_capwap;
|
||||
|
||||
|
||||
int (*request_handler) (void*);
|
||||
void * request_handler_param;
|
||||
int (*request_handler) (void *);
|
||||
void *request_handler_param;
|
||||
};
|
||||
|
||||
|
||||
@ -140,26 +145,28 @@ struct conn{
|
||||
|
||||
|
||||
|
||||
struct conn * conn_create(int sock, struct sockaddr * addr, int qsize);
|
||||
struct conn * conn_create_noq(int sock, struct sockaddr * addr);
|
||||
struct conn *conn_create(int sock, struct sockaddr *addr, int qsize);
|
||||
struct conn *conn_create_noq(int sock, struct sockaddr *addr);
|
||||
|
||||
|
||||
extern int conn_send_cwmsg(struct conn * conn, struct cwmsg * cwmsg);
|
||||
extern void conn_process_packet(struct conn * conn, uint8_t *packet, int len,int(*cb)(void*,struct cwrmsg*),void *cbarg);
|
||||
extern struct cwrmsg * conn_get_message(struct conn * conn);
|
||||
extern int conn_send_cwmsg(struct conn *conn, struct cwmsg *cwmsg);
|
||||
extern void conn_process_packet(struct conn *conn, uint8_t * packet, int len,
|
||||
int (*cb) (void *, uint8_t *,int len), void *cbarg);
|
||||
|
||||
extern int conn_send_packet(struct conn * conn,const uint8_t * buffer, int len);
|
||||
extern void conn_destroy(struct conn * conn);
|
||||
extern uint8_t *conn_get_message(struct conn *conn);
|
||||
|
||||
uint8_t * conn_q_get_packet(struct conn * conn);
|
||||
extern int conn_q_recv_packet(struct conn * conn, uint8_t * buffer,int len);
|
||||
extern int conn_q_recv_packet_peek(struct conn * conn, uint8_t * buffer,int len);
|
||||
extern int conn_send_packet(struct conn *conn, const uint8_t * buffer, int len);
|
||||
extern void conn_destroy(struct conn *conn);
|
||||
|
||||
extern int conn_recv_packet(struct conn* conn,uint8_t *buf,int len);
|
||||
extern int conn_recv_packet_peek(struct conn* conn,uint8_t *buf,int len);
|
||||
uint8_t *conn_q_get_packet(struct conn *conn);
|
||||
extern int conn_q_recv_packet(struct conn *conn, uint8_t * buffer, int len);
|
||||
extern int conn_q_recv_packet_peek(struct conn *conn, uint8_t * buffer, int len);
|
||||
|
||||
extern int conn_send_response(struct conn * conn,struct cwmsg * cwmsg,int seqnum);
|
||||
extern struct cwrmsg * conn_get_response(struct conn * conn);
|
||||
extern int conn_recv_packet(struct conn *conn, uint8_t * buf, int len);
|
||||
extern int conn_recv_packet_peek(struct conn *conn, uint8_t * buf, int len);
|
||||
|
||||
extern int conn_send_response(struct conn *conn, struct cwmsg *cwmsg, int seqnum);
|
||||
extern struct cwrmsg *conn_get_response(struct conn *conn);
|
||||
|
||||
|
||||
#define conn_get_next_seqnum(conn) (conn->seqnum=((conn->seqnum+1)&0xff))
|
||||
@ -171,38 +178,38 @@ extern struct cwrmsg * conn_get_response(struct conn * conn);
|
||||
struct connlist {
|
||||
/* struct conn ** connlist; */
|
||||
|
||||
struct avltree * t;
|
||||
struct avltree *t;
|
||||
int len;
|
||||
pthread_mutex_t connlist_mutex;
|
||||
};
|
||||
|
||||
|
||||
struct connlist * connlist_create(int len);
|
||||
void connlist_lock(struct connlist * cl);
|
||||
void connlist_unlock(struct connlist * cl);
|
||||
void conlist_destroy(struct connlist * cl);
|
||||
struct conn * connlist_get(struct connlist * cl, const struct sockaddr * addr);
|
||||
struct conn * connlist_add(struct connlist * cl, struct conn * conn);
|
||||
void connlist_remove(struct connlist *cl,struct conn * conn);
|
||||
void connlist_destroy(struct connlist * cl);
|
||||
void conn_q_add_packet(struct conn * conn,uint8_t *packet,int len);
|
||||
struct connlist *connlist_create(int len);
|
||||
void connlist_lock(struct connlist *cl);
|
||||
void connlist_unlock(struct connlist *cl);
|
||||
void conlist_destroy(struct connlist *cl);
|
||||
struct conn *connlist_get(struct connlist *cl, const struct sockaddr *addr);
|
||||
struct conn *connlist_add(struct connlist *cl, struct conn *conn);
|
||||
void connlist_remove(struct connlist *cl, struct conn *conn);
|
||||
void connlist_destroy(struct connlist *cl);
|
||||
void conn_q_add_packet(struct conn *conn, uint8_t * packet, int len);
|
||||
|
||||
struct image_identifier;
|
||||
struct cwimage_data;
|
||||
|
||||
extern void conn_prepare_request(struct conn * conn, int type);
|
||||
extern int conn_prepare_image_data_request(struct conn * conn, struct cwimage_data *, struct image_identifier *id );
|
||||
extern void conn_detect_capwap(struct conn * conn, struct wtpinfo * wtpinfo);
|
||||
struct cwrmsg * conn_send_request(struct conn * conn);
|
||||
struct cwrmsg * conn_wait_for_message(struct conn * conn, time_t timer);
|
||||
extern void conn_prepare_request(struct conn *conn, int type);
|
||||
extern int conn_prepare_image_data_request(struct conn *conn, struct cwimage_data *,
|
||||
struct image_identifier *id);
|
||||
extern void conn_detect_capwap(struct conn *conn, struct wtpinfo *wtpinfo);
|
||||
struct cwrmsg *conn_send_request(struct conn *conn);
|
||||
struct cwrmsg *conn_wait_for_message(struct conn *conn, time_t timer);
|
||||
|
||||
struct cwrmsg * conn_wait_for_request(struct conn * conn, int *msglist, time_t timer);
|
||||
struct cwrmsg *conn_wait_for_request(struct conn *conn, int *msglist, time_t timer);
|
||||
|
||||
|
||||
#define conn_is_error(conn) (conn->dtls_error)
|
||||
|
||||
void conn_init(struct conn * conn);
|
||||
void conn_init(struct conn *conn);
|
||||
|
||||
|
||||
#endif /* __CONLIST_H */
|
||||
|
||||
#endif /* __CONLIST_H */
|
||||
|
Reference in New Issue
Block a user