summaryrefslogtreecommitdiff
path: root/src/lib/ecore_con/efl_net_socket_udp.eo
blob: 97caebc282542f6dd1bb97f5baa3f214594fdbfc (plain)
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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
import efl_net_ip_address;

class Efl.Net.Socket_Udp (Efl.Net.Socket_Fd) {
    [[A base UDP socket.

      This is the common class and takes an existing FD, usually
      created by an dialer.

      Since for the server 'clients' there is no accepted connection
      it will reuse the same file decriptor. To avoid it being
      closed, another class Efl.Net.Server_Udp_Client is used instead.

      @since 1.19
    ]]

    methods {
        next_datagram_size_query {
            [[Queries the next datagram size.

              This will use system calls to determine the next
              datagram size, in bytes.
            ]]
            return: size; [[Size in bytes]]
        }

        @property cork {
            [[Controls UDP's cork using UDP_CORK]]
            get { }
            set {
                return: bool (false); [[$true on success, $false otherwise]]
            }
            values {
                cork: bool; [[$true if cork is enabled for this socket, $false otherwise]]
            }
        }

        @property dont_route {
            [[Avoids sent UDP packets being routed by a gateway, limiting them to the local network.

              This will use SO_DONTROUTE option to avoid gateways
              routing sent packets outside the local network. It's
              useful for some protocols that only want the local area to
              be affected.
            ]]
            get { }
            set {
                return: bool (false); [[$true on success]]
            }
            values {
                dont_route: bool; [[$true if do not route is enabled, $false otherwise]]
            }
        }

        @property reuse_address {
            [[Controls address reuse() using SO_REUSEADDR]]
            get { }
            set {
                return: bool (false); [[$true on success]]
            }
            values {
                reuse_address: bool; [[$true if address reuse is enabled, $false otherwise]]
            }
        }

        @property reuse_port {
            [[Controls port reuse() using SO_REUSEPORT (since Linux 3.9)]]
            get { }
            set {
                return: bool (false); [[$true on success]]
            }
            values {
                reuse_port: bool; [[$true if port reuse is enabled, $false otherwise]]
            }
        }

        multicast_join {
            [[Joins a multicast group.

              The multicast address should be in the format:

                 IP\@INTERFACE

              With '\@INTERFACE' being optional, such as:

                 224.0.0.1 - use any interface (ie: 0.0.0.0)
                 224.0.0.1@0.0.0.0
                 224.0.0.1@192.168.0.1 - use the interface assigned to 192.168.0.1
                 ff02::1@0 - use any interface
                 ff02::1@1 - use loopback interface (idx=1)
            ]]
            params {
                address: string @nonull; [[Multicast address to join]]
            }
            return: Eina.Error; [[$0 on success, error code otherwise]]
        }

        multicast_leave {
            [[Leaves a multicast group.

              This reverses the effect of @.multicast_join.
            ]]
            params {
                address: string @nonull; [[Multicast address to leave]]
            }
            return: Eina.Error; [[$0 on success, error code otherwise]]
        }

        multicast_groups_get {
            [[Returns the multicast groups this server has joined.

              The iterator is only valid until a new group is joined
              or left using @.multicast_join or @.multicast_leave.
            ]]
            return: iterator<string> @owned; [[Iterator to multicast groups]]
        }

        @property multicast_time_to_live {
            [[Controls time to live in number of hops.

              If 1 (default), packets are only delivered to the local network.
            ]]
            get { }
            set {
                return: Eina.Error; [[$0 on success, error code otherwise]]
            }
            values {
                ttl: uint8; [[Time to live]]
            }
        }

        @property multicast_loopback {
            [[Controls whenever multicast will loopback packets locally.

              If $false, then packets won't be looped back locally,
              just delivered for remote peers.
            ]]
            get { }
            set {
                return: Eina.Error; [[$0 on success, error code otherwise]]
            }
            values {
                loopback: bool; [[$true multicast packets are loopbacked, $false otherwise]]
            }
        }

        @property bind {
            [[Forces binding to a specific address.

              Some servers may request packets being sent from a
              specific address, then one binds to that address
              before proceeding to dial.

              If no address is provided or bind is not called, a
              random port is bound automatically to any address.

              Note: IP and PORT must be all numeric, no name
              resolution is applied.
            ]]
            get { }
            set {
                return: Eina.Error; [[$0 on success, error code otherwise]]
            }
            values {
                address: string @nonull; [[Address to bind to]]
            }
        }

        init @protected {
            [[Initializes the socket to communicate with a given IP address]]
            params {
                remote_address: Efl.Net.Ip_Address; [[The remote address this socket will communicate with]]
            }
        }
    }

    implements {
        Efl.Object.constructor;
        Efl.Object.destructor;
        Efl.Loop_Fd.fd { set; }
        Efl.Io.Reader.read;
        Efl.Io.Writer.write;
    }
}