-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
221 changed files
with
341,531 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
INCLUDE=-I./ -I./gsoap/ | ||
CXX=${HOST}-g++ | ||
CFLAGS= ${INCLUDE} -DLINUX_NAS -fPIC -c | ||
|
||
LIBS= -L/lib -lssl -lcrypto -ldl | ||
|
||
all: | ||
$(CXX) $(CFLAGS) gsoap/duration.cpp | ||
$(CXX) $(CFLAGS) gsoap/soapC.cpp | ||
$(CXX) $(CFLAGS) gsoap/soapClient.cpp | ||
$(CXX) $(CFLAGS) gsoap/stdsoap2.cpp | ||
$(CXX) $(CFLAGS) gsoap/dom.cpp | ||
$(CXX) $(CFLAGS) gsoap/mecevp.cpp | ||
$(CXX) $(CFLAGS) gsoap/smdevp.cpp | ||
$(CXX) $(CFLAGS) gsoap/wsseapi.cpp | ||
$(CXX) $(CFLAGS) gsoap/threads.cpp | ||
$(CXX) $(CFLAGS) devmng.cpp | ||
$(CXX) $(LIBS) -shared -o libsoapdevmng.so duration.o soapC.o soapClient.o stdsoap2.o dom.o mecevp.o smdevp.o wsseapi.o threads.o devmng.o -Wl,--version-script=devmng.map | ||
|
||
cp -f libsoapdevmng.so /work/bluecherry/bluecherry-apps/onvif/lib | ||
cp -f libsoapdevmng.so /usr/lib | ||
echo Successfully Finished!!! | ||
clean: | ||
rm -rf *.o *.a *.so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
#include "stdafx.h" | ||
#ifdef LINUX_NAS | ||
#include <string> | ||
using namespace std; | ||
|
||
#include "devmng.h" | ||
#include "gsoap/soapH.h" | ||
#include "gsoap/DeviceBinding.nsmap" | ||
#include "gsoap/smdevp.h" | ||
#include "gsoap/wsseapi.h" | ||
|
||
/************************************************************************************/ | ||
/* Function Name : getMediaUrl */ | ||
/* Function Desc : get media service url */ | ||
/* Author : ruminsam */ | ||
/************************************************************************************/ | ||
bool getMediaUrl(char* xAddress, char* userId, char* password, char* mediaUrl) | ||
{ | ||
int authFlag = 1; // 1 : UsernameTokenDigest, 0: UsernameTokenText | ||
|
||
sprintf(mediaUrl, "%s", xAddress); | ||
|
||
struct soap* soap = new struct soap; | ||
|
||
soap_init2(soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE); | ||
soap->connect_timeout = 7; | ||
soap->recv_timeout = 7; | ||
|
||
struct _ns1__GetCapabilities getCapabilitiesRequest; | ||
struct _ns1__GetCapabilitiesResponse getCapabilitiesResponse; | ||
|
||
getCapabilitiesRequest.__sizeCategory = 1; | ||
|
||
enum ns2__CapabilityCategory category; | ||
category = ns2__CapabilityCategory__All; | ||
getCapabilitiesRequest.Category = &category; | ||
|
||
soap_wsse_add_UsernameTokenDigest(soap, NULL, userId, password); | ||
soap_call___ns1__GetCapabilities(soap, xAddress, "", &getCapabilitiesRequest, &getCapabilitiesResponse); | ||
|
||
if (soap->error) | ||
{ | ||
soap_wsse_add_UsernameTokenText(soap, NULL, userId, password); | ||
soap_call___ns1__GetCapabilities(soap, xAddress, "", &getCapabilitiesRequest, &getCapabilitiesResponse); | ||
if (soap->error) | ||
{ | ||
soap_destroy(soap); | ||
soap_end(soap); | ||
soap_done(soap); | ||
delete soap; | ||
return false; | ||
} | ||
|
||
authFlag = 0; | ||
} | ||
|
||
if (getCapabilitiesResponse.Capabilities == NULL) | ||
{ | ||
soap_destroy(soap); | ||
soap_end(soap); | ||
soap_done(soap); | ||
delete soap; | ||
return false; | ||
} | ||
|
||
if (getCapabilitiesResponse.Capabilities->Media != NULL && getCapabilitiesResponse.Capabilities->Media->XAddr != NULL) | ||
{ | ||
sprintf(mediaUrl, "%s", getCapabilitiesResponse.Capabilities->Media->XAddr); | ||
} | ||
|
||
soap_destroy(soap); | ||
soap_end(soap); | ||
soap_done(soap); | ||
delete soap; | ||
return true; | ||
} | ||
|
||
bool getDeviceInfo(char* xAddress, char* userId, char* password, char* make, char* model, char* firmware) | ||
{ | ||
int authFlag = 1; // 1 : UsernameTokenDigest, 0: UsernameTokenText | ||
|
||
sprintf(make, "%s", ""); | ||
sprintf(model, "%s", ""); | ||
sprintf(firmware, "%s", ""); | ||
|
||
struct soap* soap = new struct soap; | ||
|
||
char serverUri[100]; | ||
|
||
sprintf(serverUri, "%s", xAddress); | ||
|
||
soap_init2(soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE); | ||
|
||
soap_wsse_add_UsernameTokenDigest(soap, NULL, userId, password); | ||
soap->connect_timeout = 7; | ||
soap->recv_timeout = 7; | ||
|
||
struct _ns1__GetDeviceInformation request; | ||
struct _ns1__GetDeviceInformationResponse result; | ||
|
||
soap_call___ns1__GetDeviceInformation(soap, serverUri, "", &request, &result); | ||
|
||
if (soap->error) | ||
{ | ||
soap_wsse_add_UsernameTokenText(soap, NULL, userId, password); | ||
soap_call___ns1__GetDeviceInformation(soap, serverUri, "", &request, &result); | ||
if (soap->error) | ||
{ | ||
soap_destroy(soap); | ||
soap_end(soap); | ||
soap_done(soap); | ||
delete soap; | ||
return false; | ||
} | ||
|
||
authFlag = 0; | ||
} | ||
|
||
if (result.Manufacturer != NULL) | ||
sprintf(make, "%s", result.Manufacturer); | ||
if (result.Model != NULL) | ||
sprintf(model, "%s", result.Model); | ||
if (result.FirmwareVersion != NULL) | ||
sprintf(firmware, "%s", result.FirmwareVersion); | ||
|
||
soap_destroy(soap); | ||
soap_end(soap); | ||
soap_done(soap); | ||
delete soap; | ||
|
||
return true; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
extern "C" { | ||
bool getMediaUrl(char* xAddress, char* userId, char* password, char* mediaUrl); | ||
bool getDeviceInfo(char* xAddress, char* userId, char* password, char* make, char* model, char* firmware); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
global: getMediaUrl;getDeviceInfo; | ||
local: *; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
#include "soapH.h" | ||
SOAP_NMAC struct Namespace namespaces[] = | ||
{ | ||
{"SOAP-ENV", "http://www.w3.org/2003/05/soap-envelope", "http://www.w3.org/2003/05/soap-envelope", NULL}, | ||
{"SOAP-ENC", "http://www.w3.org/2003/05/soap-encoding", "http://www.w3.org/2003/05/soap-encoding", NULL}, | ||
{"xsi", "http://www.w3.org/2001/XMLSchema-instance", "http://www.w3.org/*/XMLSchema-instance", NULL}, | ||
{"xsd", "http://www.w3.org/2001/XMLSchema", "http://www.w3.org/*/XMLSchema", NULL}, | ||
{"c14n", "http://www.w3.org/2001/10/xml-exc-c14n#", NULL, NULL}, | ||
{"wsu", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd", NULL, NULL}, | ||
{"xenc", "http://www.w3.org/2001/04/xmlenc#", NULL, NULL}, | ||
{"ds", "http://www.w3.org/2000/09/xmldsig#", NULL, NULL}, | ||
{"wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd", NULL}, | ||
{"xmime", "http://tempuri.org/xmime.xsd", NULL, NULL}, | ||
{"xop", "http://www.w3.org/2004/08/xop/include", NULL, NULL}, | ||
{"ns2", "http://www.onvif.org/ver10/schema", NULL, NULL}, | ||
{"ns1", "http://www.onvif.org/ver10/device/wsdl", NULL, NULL}, | ||
{NULL, NULL, NULL, NULL} | ||
}; |
Oops, something went wrong.