-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPeerUnixService.lmspc
More file actions
88 lines (65 loc) · 1.76 KB
/
PeerUnixService.lmspc
File metadata and controls
88 lines (65 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
namespace net.unitatem.libpeer
class LibPeerUnix
model Network{
protocol: binary
name: string
active: boolean
}
model Transport{
protocol: binary
name: string
}
model Address{
protocol: binary
address: binary
port: binary
label: binary
}
model Message{
address: Address
payload: binary
channel: binary
transport: binary
}
model Peer{
administrative_distance: uint16
last_seen: double
address: Address
}
// List available discoverers
method available_discoverers(): *string
// List available networks
method available_networks(): *Network
// List available discoverers
method available_transports(): *Transport
// Bind to an application namespace
method bind(application: binary)
// Toggle advertising the peer
method set_discoverable(discoverable: boolean)
// Add a label to advertise
method add_label(label: binary)
// Stop advertising with a label
method remove_label(label: binary)
// Clear all labels
method clear_labels()
// Get a list of available unlabelled peers
method get_peers(): *Peer
// Get a list of available peers with a label
method get_labelled_peers(label: binary): *Peer
// Send a message over the network
method send(message: Message)
// Stop accepting messages for this application
method close()
// Fires when a peer with a unique address is discovered
event new_peer(peer: Peer)
// Fires when a new message is received over the network
event receive(message: Message)
// Can occur on bind if the namespace has already been bound to
exception NamespaceOccupiedError
// When there was an error sending data
exception NetworkError
// Data inside a model is invalid
exception DataError
// Application ran a method that requires bind to have been called
// before calling bind()
exception UnboundError