# HG changeset patch # User Mike Pavone # Date 1376037155 25200 # Node ID 9bce890a7ff2a17d972732a92a90dfaee6de1789 # Parent 966a09d226e3c1a6ca2fcb36c9c89d6d077793df Old work on a socket module diff -r 966a09d226e3 -r 9bce890a7ff2 modules/socket.tp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/socket.tp Fri Aug 09 01:32:35 2013 -0700 @@ -0,0 +1,67 @@ +#{ + llMessage: AF_INET withVars: { + intret <- obj_int32 ptr + } andCode: { + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: AF_INET + intret + } + llMessage: AF_UNIX withVars: { + intret <- obj_int32 ptr + } andCode: { + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: AF_UNIX + intret + } + llMessage: STREAM withVars: { + intret <- obj_int32 ptr + } andCode: { + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: SOCK_STREAM + intret + } + llMessage: DGRAM withVars: { + intret <- obj_int32 ptr + } andCode: { + intret <- make_object: (addr_of: obj_int32_meta) NULL 0 + intret num!: SOCK_DGRAM + intret + } + llMessage: socket withVars: { + fd <- obj_int32 ptr + domain <- obj_int32 ptr + type <- obj_int32 ptr + protocol <- obj_int32 ptr + } andCode: :domain type protocol { + fd <- make_object: (addr_of: obj_int32_meta) NULL 0 + fd num!: (socket: (domain num) (type num) (protocol num)) + fd + } + + llMessage: getaddrinfo withVars: { + + } andCode: { + } + + new <- :domain type protocol { + sfd <- socket: domain type protocol + #{ + fd <- {sfd} + llMessage: close withVars: { + sfd <- obj_int32 ptr + } andCode: { + sfd <- mcall: fd 1 self + close: (sfd num) + self + } + } + } + + connectTo:onPort <- :host :port { + + } + listenOn: <- :port { + } + listenAt:onPort <- :host :port { + } +}