2015-04-11 19:02:21 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
2016-03-11 22:23:00 +01:00
|
|
|
#include "cw.h"
|
2018-03-17 17:29:09 +01:00
|
|
|
|
2015-04-11 19:02:21 +02:00
|
|
|
|
|
|
|
#include "log.h"
|
2015-04-13 11:00:46 +02:00
|
|
|
#include "dbg.h"
|
2015-04-11 19:02:21 +02:00
|
|
|
|
|
|
|
|
2015-04-12 10:19:02 +02:00
|
|
|
#include "sock.h"
|
|
|
|
|
2018-02-23 18:37:51 +01:00
|
|
|
#include "lwapp.h"
|
2015-04-11 19:02:21 +02:00
|
|
|
|
|
|
|
|
2015-04-13 11:00:46 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int cw_out_image_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
2015-04-11 19:02:21 +02:00
|
|
|
{
|
2018-03-06 18:28:31 +01:00
|
|
|
/*
|
2015-04-19 23:27:44 +02:00
|
|
|
mbag_item_t * item = mbag_get(conn->outgoing,CW_ITEM_IMAGE_FILEHANDLE);
|
2015-04-11 19:02:21 +02:00
|
|
|
if (!item) {
|
|
|
|
cw_log(LOG_ERR,"Can't put element Image Data, no image filehandle found");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-03-03 17:42:28 +01:00
|
|
|
FILE *infile = item->u2.data;
|
2015-04-13 11:00:46 +02:00
|
|
|
if (infile==NULL){
|
|
|
|
cw_log(LOG_ERR,"Image Data Request infile = NULL");
|
|
|
|
return 0;
|
2015-04-11 19:02:21 +02:00
|
|
|
}
|
2015-04-13 11:00:46 +02:00
|
|
|
|
|
|
|
int bytes=0;
|
|
|
|
switch ( conn->capwap_mode_out){
|
|
|
|
case CW_MODE_CISCO:
|
|
|
|
bytes = lw_put_image_data(dst+4,infile);
|
|
|
|
if ( bytes != LW_BLOCKSIZE_IMAGE_DATA + 3) {
|
|
|
|
avltree_del(conn->outgoing, item);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bytes = cw_put_image_data(dst+4,infile);
|
|
|
|
if (dst[4] != 1){
|
|
|
|
avltree_del(conn->outgoing, item);
|
|
|
|
}
|
2015-04-11 19:02:21 +02:00
|
|
|
}
|
|
|
|
|
2015-04-13 11:00:46 +02:00
|
|
|
if ( ferror(infile)){
|
|
|
|
cw_log(LOG_ERROR,"Aborting image data transfer: %s",strerror(errno));
|
|
|
|
}
|
2015-04-11 19:02:21 +02:00
|
|
|
|
2015-04-13 11:00:46 +02:00
|
|
|
return bytes + cw_put_elem_hdr(dst,a->elem_id,bytes);
|
2018-03-06 18:28:31 +01:00
|
|
|
*/
|
|
|
|
return 0;
|
2015-04-11 19:02:21 +02:00
|
|
|
}
|
|
|
|
|