// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x40, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq 0x34b49(%rip), %rax     # 0x38004
movq %rax, -0x20(%rbp)
leaq 0x34b46(%rip), %rdi     # 0x3800c
callq 0x3200
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %edi
callq 0x30e0
movq %rax, %rdx
leaq 0x40f50(%rip), %rdi     # 0x44430
leaq 0x34b32(%rip), %rsi     # 0x38019
movb $0x0, %al
callq 0x3330
movzbl -0x20(%rbp), %edx
movzbl -0x1f(%rbp), %ecx
movzbl -0x1e(%rbp), %r8d
movzbl -0x1d(%rbp), %r9d
movzbl -0x1c(%rbp), %r10d
movzbl -0x1b(%rbp), %eax
leaq 0x40f60(%rip), %rdi     # 0x44470
leaq 0x34b21(%rip), %rsi     # 0x38038
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movb $0x0, %al
callq 0x3330
movq -0x18(%rbp), %rsi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
movq -0x18(%rbp), %rax
movl (%rax), %ecx
leaq 0x34b33(%rip), %rdi     # 0x38072
movb $0x0, %al
callq 0x3150
movq -0x8(%rbp), %rdi
leaq 0x40ddf(%rip), %rsi     # 0x44330
callq 0x13650
movq -0x8(%rbp), %rdi
leaq 0x40e3f(%rip), %rsi     # 0x443a0
callq 0x13c50
movq -0x8(%rbp), %rax
cmpq $0x0, 0xbf30(%rax)
je 0x3631
leaq 0x40e41(%rip), %rdi     # 0x443c0
leaq 0x34b06(%rip), %rsi     # 0x3808c
callq 0x3080
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
cmpq $0x0, (%rax)
je 0x362f
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
leaq 0x40efe(%rip), %rcx     # 0x444b0
movq %rcx, 0x8(%rax)
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
movq 0x8(%rax), %rsi
callq 0x14050
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
movq (%rax), %rcx
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
movq 0x8(%rax), %rax
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
leaq 0x40dc0(%rip), %rcx     # 0x443c0
movq %rcx, (%rax)
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
leaq 0x34a81(%rip), %rcx     # 0x38096
movq %rcx, 0x28(%rax)
movq -0x8(%rbp), %rax
movq 0xbf30(%rax), %rax
leaq 0x34aab(%rip), %rcx     # 0x380d6
movq %rcx, 0x30(%rax)
jmp 0x3631
leaq 0x34adb(%rip), %rax     # 0x38113
movq %rax, 0x40d61(%rip)     # 0x443a0
leaq 0x40e2a(%rip), %rax     # 0x44470
movq %rax, 0x40ce3(%rip)     # 0x44330
leaq 0x34b5f(%rip), %rax     # 0x381b3
movq %rax, 0x40d15(%rip)     # 0x44370
leaq 0x40d3e(%rip), %rax     # 0x443a0
movq %rax, 0x40d0f(%rip)     # 0x44378
leaq 0x40dc0(%rip), %rax     # 0x44430
movq %rax, 0x40d09(%rip)     # 0x44380
movl $0x1, 0x40d07(%rip)     # 0x44388
movq -0x18(%rbp), %rax
movl $0x1, (%rax)
movq -0x18(%rbp), %rax
leaq 0x40c9a(%rip), %rcx     # 0x44330
movq %rcx, 0x8(%rax)
xorl %eax, %eax
addq $0x40, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)