Пример #1
0
N_NIMCALL(struct addrinfo*, getaddrinfo_510408)(NimStringDesc* address, NU16 port, NU8 af, NU8 typ, NU8 prot) {
	struct addrinfo* result;
	struct addrinfo hints;
	int gairesult;
	NimStringDesc* LOC1;
	result = 0;
	memset((void*)(&hints), 0, sizeof(hints));
	result = NIM_NIL;
	hints.ai_family = toint_509829(af);
	hints.ai_socktype = toint_509835(typ);
	hints.ai_protocol = toint_509841(prot);
	LOC1 = 0;
	LOC1 = HEX24_6401(port);
	gairesult = getaddrinfo(address->data, LOC1->data, (&hints), &result);
	{
		Oserror3433* e_510603;
		NCSTRING LOC6;
		if (!!((gairesult == ((NI32) 0)))) goto LA4;
		e_510603 = 0;
		e_510603 = (Oserror3433*) newObj((&NTI116812), sizeof(Oserror3433));
		(*e_510603).Sup.Sup.Sup.m_type = (&NTI3433);
		LOC6 = 0;
		LOC6 = gai_strerror(gairesult);
		asgnRefNoCycle((void**) (&(*e_510603).Sup.Sup.message), cstrToNimstr(LOC6));
		raiseException((Exception*)e_510603, "OSError");
	}
	LA4: ;
	return result;
}
Пример #2
0
N_NIMCALL(int, newrawsocket_510004)(NU8 domain, NU8 typ, NU8 protocol) {
	int result;
	int LOC1;
	int LOC2;
	int LOC3;
	result = 0;
	LOC1 = 0;
	LOC1 = toint_509829(domain);
	LOC2 = 0;
	LOC2 = toint_509835(typ);
	LOC3 = 0;
	LOC3 = toint_509841(protocol);
	result = socket(LOC1, LOC2, LOC3);
	return result;
}
Пример #3
0
N_NIMCALL(int, newrawsocket_510004)(NU8 domain, NU8 typ, NU8 protocol) {
	int result;
	int LOC1;
	int LOC2;
	int LOC3;
	nimfr("newRawSocket", "rawsockets.nim")
	result = 0;
	nimln(156, "rawsockets.nim");
	nimln(157, "rawsockets.nim");
	LOC1 = 0;
	LOC1 = toint_509829(domain);
	LOC2 = 0;
	LOC2 = toint_509835(typ);
	LOC3 = 0;
	LOC3 = toint_509841(protocol);
	result = socket(LOC1, LOC2, LOC3);
	popFrame();
	return result;
}
Пример #4
0
N_NIMCALL(void, bindaddr_515620)(Socketimpl514407* socket, NU16 port, NimStringDesc* address) {
	{
		struct sockaddr_in name;
		if (!((address) && (address)->Sup.len == 0)) goto LA3;
		memset((void*)(&name), 0, sizeof(name));
		name.sin_family = toint_509829(((NU8) 2));
		name.sin_port = htons_511017(((NI16) (port)));
		name.sin_addr.s_addr = htonl_511007(INADDR_ANY);
		{
			int LOC7;
			NI32 LOC10;
			LOC7 = 0;
			LOC7 = bindaddr_510214((*socket).fd, ((struct sockaddr*) ((&name))), ((socklen_t) (((NI)sizeof(struct sockaddr_in)))));
			if (!(LOC7 < ((NI32) 0))) goto LA8;
			LOC10 = 0;
			LOC10 = oslasterror_117033();
			raiseoserror_117009(LOC10);
		}
		LA8: ;
	}
	goto LA1;
	LA3: ;
	{
		struct addrinfo* ailist;
		ailist = getaddrinfo_510408(address, port, ((NU8) 2), ((NU8) 1), ((NU8) 6));
		{
			int LOC14;
			NI32 LOC17;
			LOC14 = 0;
			LOC14 = bindaddr_510214((*socket).fd, (*ailist).ai_addr, (*ailist).ai_addrlen);
			if (!(LOC14 < ((NI32) 0))) goto LA15;
			dealloc_510621(ailist);
			LOC17 = 0;
			LOC17 = oslasterror_117033();
			raiseoserror_117009(LOC17);
		}
		LA15: ;
		dealloc_510621(ailist);
	}
	LA1: ;
}