comparison modules/socket.tp @ 139:9bce890a7ff2

Old work on a socket module
author Mike Pavone <pavone@retrodev.com>
date Fri, 09 Aug 2013 01:32:35 -0700
parents
children 7db37f040a6f
comparison
equal deleted inserted replaced
133:966a09d226e3 139:9bce890a7ff2
1 #{
2 llMessage: AF_INET withVars: {
3 intret <- obj_int32 ptr
4 } andCode: {
5 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
6 intret num!: AF_INET
7 intret
8 }
9 llMessage: AF_UNIX withVars: {
10 intret <- obj_int32 ptr
11 } andCode: {
12 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
13 intret num!: AF_UNIX
14 intret
15 }
16 llMessage: STREAM withVars: {
17 intret <- obj_int32 ptr
18 } andCode: {
19 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
20 intret num!: SOCK_STREAM
21 intret
22 }
23 llMessage: DGRAM withVars: {
24 intret <- obj_int32 ptr
25 } andCode: {
26 intret <- make_object: (addr_of: obj_int32_meta) NULL 0
27 intret num!: SOCK_DGRAM
28 intret
29 }
30 llMessage: socket withVars: {
31 fd <- obj_int32 ptr
32 domain <- obj_int32 ptr
33 type <- obj_int32 ptr
34 protocol <- obj_int32 ptr
35 } andCode: :domain type protocol {
36 fd <- make_object: (addr_of: obj_int32_meta) NULL 0
37 fd num!: (socket: (domain num) (type num) (protocol num))
38 fd
39 }
40
41 llMessage: getaddrinfo withVars: {
42
43 } andCode: {
44 }
45
46 new <- :domain type protocol {
47 sfd <- socket: domain type protocol
48 #{
49 fd <- {sfd}
50 llMessage: close withVars: {
51 sfd <- obj_int32 ptr
52 } andCode: {
53 sfd <- mcall: fd 1 self
54 close: (sfd num)
55 self
56 }
57 }
58 }
59
60 connectTo:onPort <- :host :port {
61
62 }
63 listenOn: <- :port {
64 }
65 listenAt:onPort <- :host :port {
66 }
67 }