完整代码:http://download.youkuaiyun.com/detail/shenhuaikun/5234203
github:完整代码
用gosap生成C代码框架在这里忽略。
1.服务端需要添加的代码:首先对Probe、Hello、Bye进行了定义,然后对编写main函数。
//#include <uuid/uuid.h>
#include "soapH.h"
#include "soapStub.h"
SOAP_FMAC5 int SOAP_FMAC6 __dndl__Probe(struct soap* soap, struct d__ProbeType *d__Probe, struct d__ProbeMatchesType *d__ProbeMatches)
{
static struct d__ProbeMatchType ProbeMatch;
static struct d__ScopesType scopes;
static char MessageID[100];
static char szXAddr[64];
static char szEndpointReference[64];
static struct wsa__Relationship wsa_RelatesTo;
unsigned char MacAddr[8] ={0x00, 0x16, 0xe8, 0x53, 0x13, 0xc7};
int localIP = inet_addr("192.168.7.33"); //0x6207A8C0
//localIP = niGetLocalIPAddr(g_netEthNi);
//memcpy(MacAddr, niGetHwAddr(g_netEthNi), 6);
// if(d__Probe->Types && strcasecmp(d__Probe->Types,"dn:NetworkVideoTransmitter")==0)
sprintf(szXAddr, "http://%s/onvif/device_service", inet_ntoa(*((struct in_addr *)&localIP)));
sprintf(szEndpointReference, "urn:uuid:11229344-5566-7788-99aa-%02x%02x%02x%02x%02x%02x",
MacAddr[0],MacAddr[1],MacAddr[2],MacAddr[3],MacAddr[4],MacAddr[5]);
printf("__dndl__Probe %p, %p, %d\n", d__ProbeMatches, d__ProbeMatches->ProbeMatch, d__ProbeMatches->__sizeProbeMatch);
soap_default_d__ProbeMatchType(soap, &ProbeMatch);
soap_default_d__ScopesType(soap, &scopes);
if (soap->header)
{
//uuid_t uuid;
//uuid_generate(uuid);
strcpy(MessageID, "urn:uuid:");//urn:uuid:
//uuid_unparse(uuid, MessageID+9);
if(soap->header->wsa__MessageID)
{
//printf("remote wsa__MessageID : %s\n",soap->header->wsa__MessageID);
soap->header->wsa__RelatesTo =&wsa_RelatesTo;
soap_default__wsa__RelatesTo(soap, soap->header->wsa__RelatesTo);
soap->header->wsa__RelatesTo->__item = soap->header->wsa__MessageID;
soap->header->wsa__MessageID = MessageI