json stuff added.

FossilOrigin-Name: 018a7253083e6a480bfcf282d892d13707f49353136106b336ec1ffbf3747614
This commit is contained in:
7u83@mail.ru
2015-04-17 05:38:44 +00:00
parent 57cd0a11b1
commit 8eeaa28ffb
7 changed files with 248 additions and 4 deletions

55
src/wtp/image_update.c Normal file
View File

@ -0,0 +1,55 @@
#include <errno.h>
#include "wtp.h"
#include "capwap/log.h"
#include "capwap/dbg.h"
#include "capwap/capwap.h"
#include "capwap/capwap_items.h"
int image_update()
{
struct conn *conn = get_conn();
if (conn->capwap_state != CW_STATE_CONFIGURE) {
cw_log(LOG_ERR, "Current state not image update");
return 0;
}
const char *ii = "/c1130";
cw_itemstore_set_vendorstr(conn->outgoing, CW_ITEM_IMAGE_IDENTIFIER,
CW_VENDOR_ID_CISCO, (uint8_t *) ii, strlen(ii));
int rc = cw_send_request(conn, CW_MSG_IMAGE_DATA_REQUEST);
if (rc < 0) {
}
if (rc != 0) {
cw_log(LOG_ERR, "AC rejected Image Data Request with code: %d - %s", rc,
cw_strresult(rc));
return 0;
}
cw_dbg(DBG_ELEM,"Ready to receive image ...\n");
conn->capwap_state=CW_STATE_IMAGE_DATA;
rc=-11;
while (conn->capwap_state == CW_STATE_IMAGE_DATA) {
rc = cw_read_messages(conn);
if (rc < 0) {
if (errno != EAGAIN)
break;
}
}
printf("RC: %d %s\n",rc,strerror(errno));
return 1;
}