renamed capwap directory to cw.
FossilOrigin-Name: 8a43dd9d05a4cb73210243ddd8df2a26f16c7ef2c4d4e36ab446de1f65d88223
This commit is contained in:
55
src/cw/cw_out_image_data.c
Normal file
55
src/cw/cw_out_image_data.c
Normal file
@ -0,0 +1,55 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "capwap.h"
|
||||
#include "capwap_items.h"
|
||||
|
||||
#include "log.h"
|
||||
#include "dbg.h"
|
||||
|
||||
|
||||
#include "sock.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
int cw_out_image_data(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
|
||||
{
|
||||
mbag_item_t * item = mbag_get(conn->outgoing,CW_ITEM_IMAGE_FILEHANDLE);
|
||||
if (!item) {
|
||||
cw_log(LOG_ERR,"Can't put element Image Data, no image filehandle found");
|
||||
return 0;
|
||||
}
|
||||
|
||||
FILE *infile = item->data;
|
||||
if (infile==NULL){
|
||||
cw_log(LOG_ERR,"Image Data Request infile = NULL");
|
||||
return 0;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ferror(infile)){
|
||||
cw_log(LOG_ERROR,"Aborting image data transfer: %s",strerror(errno));
|
||||
}
|
||||
|
||||
return bytes + cw_put_elem_hdr(dst,a->elem_id,bytes);
|
||||
}
|
||||
|
Reference in New Issue
Block a user