// File: /workspace/github_c_makefile_star2_O1/hkshenSmart[P]ONVIF-discovery_cs/discovery-nvt.c
// Function: _dndl__Probe
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 = MessageID;
			soap->header->wsa__To = "http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous";
			soap->header->wsa__Action = "http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches";
		}
	}

	scopes.__item =  "onvif://www.onvif.org/type/video_encoder onvif://www.onvif.org/type/audio_encoder onvif://www.onvif.org/hardware/IPC-model onvif://www.onvif.org/name/IPC-model";
	
	ProbeMatch.wsa__EndpointReference.Address = szEndpointReference;                 //"urn:uuid:464A4854-4656-5242-4530-313035394100";
	ProbeMatch.Types = "dn:NetworkVideoTransmitter";
	ProbeMatch.Scopes = &scopes;
	ProbeMatch.XAddrs = szXAddr;                                                    //"http://192.168.7.97/onvif/device_service";
	ProbeMatch.MetadataVersion = 1;

	d__ProbeMatches->__sizeProbeMatch = 1;
	d__ProbeMatches->ProbeMatch = &ProbeMatch;

    return SOAP_OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rdi, %r15
leaq 0x21b70(%rip), %rdi     # 0x25004
callq 0x31f0
movl %eax, %edi
callq 0x30f0
leaq 0x30f79(%rip), %r14     # 0x34420
leaq 0x21b63(%rip), %rsi     # 0x25011
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x3310
leaq 0x30f9e(%rip), %r12     # 0x34460
leaq 0x21b67(%rip), %rsi     # 0x25030
movq %r12, %rdi
xorl %edx, %edx
movl $0x16, %ecx
movl $0xe8, %r8d
movl $0x53, %r9d
xorl %eax, %eax
pushq $0xc7
pushq $0x13
callq 0x3310
addq $0x10, %rsp
movq 0x8(%rbx), %rdx
movl (%rbx), %ecx
leaq 0x21b6c(%rip), %rdi     # 0x2506a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x3150
leaq 0x30e11(%rip), %r13     # 0x34320
movq %r15, %rdi
movq %r13, %rsi
callq 0xe20f
leaq 0x30e6f(%rip), %rbp     # 0x34390
movq %r15, %rdi
movq %rbp, %rsi
callq 0xe509
movq 0xbf30(%r15), %rax
testq %rax, %rax
je 0x359c
movabsq $0x646975753a6e7275, %rcx # imm = 0x646975753A6E7275
movq %rcx, 0x30e67(%rip)     # 0x343b0
movw $0x3a, 0x30e66(%rip)    # 0x343b8
cmpq $0x0, (%rax)
je 0x359c
leaq 0x30f41(%rip), %rsi     # 0x344a0
movq %rsi, 0x8(%rax)
movq %r15, %rdi
callq 0xe70b
movq 0xbf30(%r15), %rax
movq (%rax), %rcx
movq 0x8(%rax), %rdx
movq %rcx, (%rdx)
leaq 0x30e2d(%rip), %rcx     # 0x343b0
movq %rcx, (%rax)
leaq 0x21b01(%rip), %rcx     # 0x2508e
movq %rcx, 0x28(%rax)
leaq 0x21b36(%rip), %rcx     # 0x250ce
movq %rcx, 0x30(%rax)
leaq 0x21b68(%rip), %rax     # 0x2510b
movq %rax, 0x30de6(%rip)     # 0x34390
movq %r12, 0x30d6f(%rip)     # 0x34320
leaq 0x21bf3(%rip), %rax     # 0x251ab
movq %rax, 0x30da1(%rip)     # 0x34360
movq %rbp, 0x30da2(%rip)     # 0x34368
movq %r14, 0x30da3(%rip)     # 0x34370
movl $0x1, %eax
movl %eax, 0x30da0(%rip)     # 0x34378
movl %eax, (%rbx)
movq %r13, 0x8(%rbx)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq