Compiles now

FossilOrigin-Name: 30eb185e57ed49871e3371ec4bdec4637b8ec27be59d199e4118bb20bff50c7d
This commit is contained in:
7u83@mail.ru 2018-03-01 20:33:16 +00:00
parent 3cbe9445c2
commit 17c904ec5f
8 changed files with 28 additions and 183 deletions

View File

@ -80,7 +80,7 @@ all: $(AC_NAME)
$(AC_NAME): $(AC_OBJS)
# $(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS)
$(CC) $(AC_OBJS) -v -o $(AC_NAME) $(LDFLAGS) $(LIBS)
$(CC) $(AC_OBJS) -o $(AC_NAME) $(LDFLAGS) $(LIBS)
clean:

View File

@ -12,6 +12,31 @@ DNAME := $(LIBARCHDIR)/libcw.so
LDFLAGS+=-g -D_REENTRANT -L/usr/local/lib
LIBS=
ifeq ($(WITH_OPENSSL),1)
CFLAGS+=$(OPENSSL_CFLAGS)
CFLAGS+=-DWITH_OPENSSL
DTLSOBJS += dtls_openssl.o \
dtls_openssl_accept.o \
dtls_openssl_connect.o \
dtls_openssl_get_cipher.o \
dtls_openssl_bio.o
LIBS+=-lssl
endif
ifeq ($(WITH_GNUTLS),1)
CFLAGS+=$(GNUTLS_CFLAGS)
CFLAGS+=-DWITH_GNUTLS
DTLSOBJS+= dtls_gnutls.o \
dtls_gnutls_accept.o \
dtls_gnutls_connect.o \
dtls_gnutls_bio.o \
dtls_gnutls_get_cipher.o \
dtls_gnutls_get_peers_cert.o
LIBS+=-lgnutls
endif
SRC=$(wildcard *.c)
OBJS=$(patsubst %.c,%.o,$(SRC))

View File

@ -1,12 +0,0 @@
#include "conn.h"
#include "capwap.h"
void conn_prepare_configuration_update_request(struct conn * conn)
{
struct cwmsg * cwmsg = &conn->req_msg;
uint8_t * buffer = conn->req_buffer;
cwmsg_init(cwmsg,buffer,CW_MSG_CONFIGURATION_UPDATE_REQUEST,conn_get_next_seqnum(conn),0);
}

View File

@ -1,10 +0,0 @@
#include "conn.h"
#include "capwap.h"
void conn_prepare_request(struct conn * conn, int type)
{
struct cwmsg * cwmsg = &conn->req_msg;
uint8_t * buffer = conn->req_buffer;
cwmsg_init(cwmsg,buffer,type,conn_get_next_seqnum(conn),0);
cwmsg->capwap_mode=conn->capwap_mode;
}

View File

@ -1,24 +0,0 @@
#include "capwap.h"
#include "capwap_items.h"
#include "log.h"
#include "rand.h"
int cw_out_init_session_id(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
{
printf("Vendor ID: %d\n", a->vendor_id);
uint8_t session_id[16];
int l = cw_rand(session_id,16);
if ( l!=16 ) {
cw_log(LOG_ERR,"Can't init session ID.");
return -1;
}
cw_itemstore_set_bstrn(conn->local,CW_ITEM_SESSION_ID,session_id,16);
return 0;
}

View File

@ -1,76 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*@file
*@brief Image Data handling
*/
#include <string.h>
#include "capwap.h"
#include "log.h"
#include "dbg.h"
#include "cw_util.h"
#include <stdio.h>
int cw_readelem_image_identifier(struct cwimage_data *data, int type,uint8_t *msgelem, int len)
{
if (type != CW_ELEM_IMAGE_IDENTIFIER)
return 0;
data->vendor_id = ntohl(*((uint32_t*)msgelem));
if (len >= 1024) {
cw_dbg(DBG_MSG_ERR,"Image identifier too long (>1024), truncating");
len = 1024;
}
if ( data->identifier ){
memcpy(data->identifier,msgelem,len);
*(data->identifier+len)=0;
}
return 1;
}
static int imgdata_request(void * ptr,int type,uint8_t* msgelem,int len)
{
cw_dbg_msgelem(CW_MSG_IMAGE_DATA_REQUEST, type, msgelem, len);
//cw_dbg(DBG_ALL,"Reading image data req msgelem, type=%d - %s ,len=%d\n",type,cw_strelem(type),len);
if (cw_readelem_image_identifier(ptr,type,msgelem,len))
return 1;
return 0;
}
/**
* Read an image data request message
*/
void cw_read_image_data_request(struct cwimage_data *data, uint8_t * msg, int len)
{
cw_foreach_msgelem(msg,len,imgdata_request,data);
}

View File

@ -33,8 +33,8 @@
int cw_send_echo_response(struct conn * conn,int seqnum,struct radioinfo * radioinfo)
{
struct cwmsg * cwmsg = &conn->resp_msg;
cwmsg_init(cwmsg,conn->resp_buffer,CW_MSG_ECHO_RESPONSE,seqnum,radioinfo);
// cwmsg_init(cwmsg,conn->resp_buffer,CW_MSG_ECHO_RESPONSE,seqnum,radioinfo);
conn_send_response(conn,cwmsg,seqnum);
// conn_send_response(conn,cwmsg,seqnum);
return 1;
}

View File

@ -1,58 +0,0 @@
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <string.h>
#include "capwap.h"
#include "capwap_cisco.h"
#include "cwmsg.h"
#include "conn.h"
#include "sock.h"
void cwmsg_addelem_vendor_cisco_mwar_addr(struct cwmsg *msg, struct conn *conn)
{
uint8_t data [7];
switch (((struct sockaddr*)&conn->addr)->sa_family){
case AF_INET:
{
data[0]=2; /* mwar type */
data[5]=0;
data[6]=0;
printf("Adding mwar addr %s\n",sock_addr2str(&conn->addr));
struct sockaddr_in * sain = (struct sockaddr_in*)&conn->addr;
memcpy(data+1,(uint8_t*)&sain->sin_addr,4);
cwmsg_addelem_vendor_specific_payload(msg, CW_VENDOR_ID_CISCO,
CW_CISCO_MWAR_ADDR,
data,7);
break;
}
/* case AF_INET6:
{
int id;
if (cw_mode == CWMODE_CISCO)
id = CWMSGELEM_WTP_IPV6_IP_ADDR;
else
id = CWMSGELEM_CAPWAP_LOCAL_IPV6_ADDRESS;
struct sockaddr_in6 * sain = (struct sockaddr_in6*)&a;
return cwmsg_addelem(msg,id,(uint8_t*)&sain->sin6_addr,16);
}
break;
*/
}
}