MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / socketAddressName

Function socketAddressName

source/kernel/ksocket.cpp:32–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31
32BString socketAddressName(KMemory* memory, U32 address, U32 len) {
33 if (!address) {
34 return B("");
35 }
36 U16 family = memory->readw(address);
37 if (family == K_AF_UNIX) {
38 U32 sLen = (U32)memory->strlen(address + 2);
39 BString result(sLen + 1, 0);
40 memory->memcpy(result.str(), address + 2, sLen+1);
41 return result;
42 } else if (family == K_AF_NETLINK) {
43 BString result;
44 result.sprintf("port %u", memory->readd(address + 4));
45 return result;
46 } else if (family == K_AF_INET) {
47 BString result;
48 result.sprintf("AF_INET %u.%u.%u.%u:%u", memory->readb(address + 4), memory->readb(address + 5), memory->readb(address + 6), memory->readb(address + 7), memory->readb(address + 3) | (((U32)memory->readb(address + 2)) << 8));
49 return result;
50 }
51 return B("Unknown address family");
52}
53
54U32 ksocket(U32 domain, U32 type, U32 protocol) {
55 if (domain==K_AF_UNIX) {

Callers 8

bindMethod · 0.85
syscall_socketcallFunction · 0.85
syscall_bindFunction · 0.85
syscall_connectFunction · 0.85
syscall_accept4Function · 0.85
syscall_sendtoFunction · 0.85
syscall_recvfromFunction · 0.85
connectMethod · 0.85

Calls 8

BFunction · 0.85
strlenMethod · 0.80
memcpyMethod · 0.80
strMethod · 0.80
sprintfMethod · 0.80
readwMethod · 0.45
readdMethod · 0.45
readbMethod · 0.45

Tested by

no test coverage detected