@girs/nice-0.1 0.1.0-3.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/nice-0.1.d.ts ADDED
@@ -0,0 +1,2569 @@
1
+
2
+ /*
3
+ * Type Definitions for Gjs (https://gjs.guide/)
4
+ *
5
+ * These type definitions are automatically generated, do not edit them by hand.
6
+ * If you found a bug fix it in `ts-for-gir` or create a bug report on https://github.com/gjsify/ts-for-gjs
7
+ */
8
+ /**
9
+ * Nice-0.1
10
+ */
11
+
12
+ import type Gio from '@girs/gio-2.0';
13
+ import type GObject from '@girs/gobject-2.0';
14
+ import type GLib from '@girs/glib-2.0';
15
+
16
+ export namespace Nice {
17
+
18
+ /**
19
+ * An enum representing the type of transport to use
20
+ */
21
+ enum CandidateTransport {
22
+ /**
23
+ * UDP transport
24
+ */
25
+ UDP,
26
+ /**
27
+ * TCP Active transport
28
+ */
29
+ TCP_ACTIVE,
30
+ /**
31
+ * TCP Passive transport
32
+ */
33
+ TCP_PASSIVE,
34
+ /**
35
+ * TCP Simultaneous-Open transport
36
+ */
37
+ TCP_SO,
38
+ }
39
+ /**
40
+ * An enum represneting the type of a candidate
41
+ */
42
+ enum CandidateType {
43
+ /**
44
+ * A host candidate
45
+ */
46
+ HOST,
47
+ /**
48
+ * A server reflexive candidate
49
+ */
50
+ SERVER_REFLEXIVE,
51
+ /**
52
+ * A peer reflexive candidate
53
+ */
54
+ PEER_REFLEXIVE,
55
+ /**
56
+ * A relay candidate
57
+ */
58
+ RELAYED,
59
+ }
60
+ /**
61
+ * An enum to specify which compatible specifications the #NiceAgent should use.
62
+ * Use with nice_agent_new()
63
+ *
64
+ * <warning>`NICE_COMPATIBILITY_DRAFT1`9 is deprecated and should not be used
65
+ * in newly-written code. It is kept for compatibility reasons and
66
+ * represents the same compatibility as `NICE_COMPATIBILITY_RFC5`245 </warning>
67
+ * <note>
68
+ * <para>
69
+ * If `NICE_COMPATIBILITY_RFC5`245 compatibility mode is used for a non-reliable
70
+ * agent, then ICE-UDP will be used with higher priority and ICE-TCP will also
71
+ * be used when the UDP connectivity fails. If it is used with a reliable agent,
72
+ * then ICE-UDP will be used with the TCP-Over-UDP (#PseudoTcpSocket) if ICE-TCP
73
+ * fails and ICE-UDP succeeds.
74
+ * </para>
75
+ * </note>
76
+ */
77
+ enum Compatibility {
78
+ /**
79
+ * Use compatibility with the RFC5245 ICE-UDP specs
80
+ * and RFC6544 ICE-TCP specs
81
+ */
82
+ RFC5245,
83
+ /**
84
+ * Use compatibility for ICE Draft 19 specs
85
+ */
86
+ DRAFT19,
87
+ /**
88
+ * Use compatibility for Google Talk specs
89
+ */
90
+ GOOGLE,
91
+ /**
92
+ * Use compatibility for MSN Messenger specs
93
+ */
94
+ MSN,
95
+ /**
96
+ * Use compatibility with Windows Live Messenger
97
+ * 2009
98
+ */
99
+ WLM2009,
100
+ /**
101
+ * Use compatibility with Microsoft Office Communicator 2007
102
+ */
103
+ OC2007,
104
+ /**
105
+ * Use compatibility with Microsoft Office Communicator 2007 R2
106
+ */
107
+ OC2007R2,
108
+ /**
109
+ * Dummy last compatibility mode
110
+ */
111
+ LAST,
112
+ }
113
+ /**
114
+ * An enum representing the state of a component.
115
+ * <para> See also: #NiceAgent::component-state-changed </para>
116
+ */
117
+ enum ComponentState {
118
+ /**
119
+ * No activity scheduled
120
+ */
121
+ DISCONNECTED,
122
+ /**
123
+ * Gathering local candidates
124
+ */
125
+ GATHERING,
126
+ /**
127
+ * Establishing connectivity
128
+ */
129
+ CONNECTING,
130
+ /**
131
+ * At least one working candidate pair
132
+ */
133
+ CONNECTED,
134
+ /**
135
+ * ICE concluded, candidate pair selection
136
+ * is now final
137
+ */
138
+ READY,
139
+ /**
140
+ * Connectivity checks have been completed,
141
+ * but connectivity was not established
142
+ */
143
+ FAILED,
144
+ /**
145
+ * Dummy state
146
+ */
147
+ LAST,
148
+ }
149
+ /**
150
+ * Convenience enum representing the type of a component for use as the
151
+ * component_id for RTP/RTCP usages.
152
+ * <example>
153
+ * <title>Example of use.</title>
154
+ * <programlisting>
155
+ * nice_agent_send (agent, stream_id, NICE_COMPONENT_TYPE_RTP, len, buf);
156
+ * </programlisting>
157
+ * </example>
158
+ */
159
+ enum ComponentType {
160
+ /**
161
+ * RTP Component type
162
+ */
163
+ RTP,
164
+ /**
165
+ * RTCP Component type
166
+ */
167
+ RTCP,
168
+ }
169
+ /**
170
+ * An enum to specity the kind of nomination mode to use by
171
+ * the agent, as described in RFC 5245. Two modes exists,
172
+ * regular and aggressive. They differ by the way the controlling
173
+ * agent chooses to put the USE-CANDIDATE attribute in its STUN
174
+ * messages. The aggressive mode is supposed to nominate a pair
175
+ * faster, than the regular mode, potentially causing the nominated
176
+ * pair to change until the connection check completes.
177
+ */
178
+ enum NominationMode {
179
+ /**
180
+ * Regular nomination mode
181
+ */
182
+ REGULAR,
183
+ /**
184
+ * Aggressive nomination mode
185
+ */
186
+ AGGRESSIVE,
187
+ }
188
+ /**
189
+ * An enum to specify which proxy type to use for relaying.
190
+ * Note that the proxies will only be used with TCP TURN relaying.
191
+ * <para> See also: #NiceAgent:proxy-type </para>
192
+ */
193
+ enum ProxyType {
194
+ /**
195
+ * Do not use a proxy
196
+ */
197
+ NONE,
198
+ /**
199
+ * Use a SOCKS5 proxy
200
+ */
201
+ SOCKS5,
202
+ /**
203
+ * Use an HTTP proxy
204
+ */
205
+ HTTP,
206
+ /**
207
+ * Dummy last proxy type
208
+ */
209
+ LAST,
210
+ }
211
+ /**
212
+ * Valid values of debug levels to be set.
213
+ */
214
+ enum PseudoTcpDebugLevel {
215
+ /**
216
+ * Disable debug messages
217
+ */
218
+ NONE,
219
+ /**
220
+ * Enable basic debug messages
221
+ */
222
+ NORMAL,
223
+ /**
224
+ * Enable verbose debug messages
225
+ */
226
+ VERBOSE,
227
+ }
228
+ /**
229
+ * Options for which parts of a connection to shut down when calling
230
+ * pseudo_tcp_socket_shutdown(). These correspond to the values passed to POSIX
231
+ * shutdown().
232
+ */
233
+ enum PseudoTcpShutdown {
234
+ /**
235
+ * Shut down the local reader only
236
+ */
237
+ RD,
238
+ /**
239
+ * Shut down the local writer only
240
+ */
241
+ WR,
242
+ /**
243
+ * Shut down both reading and writing
244
+ */
245
+ RDWR,
246
+ }
247
+ /**
248
+ * An enum representing the state of the #PseudoTcpSocket. These states
249
+ * correspond to the TCP states in RFC 793.
250
+ * <para> See also: #PseudoTcpSocket:state </para>
251
+ */
252
+ enum PseudoTcpState {
253
+ /**
254
+ * The socket's initial state. The socket isn't connected and is
255
+ * listening for an incoming connection
256
+ */
257
+ LISTEN,
258
+ /**
259
+ * The socket has sent a connection request (SYN) packet and is
260
+ * waiting for an answer
261
+ */
262
+ SYN_SENT,
263
+ /**
264
+ * The socket has received a connection request (SYN) packet.
265
+ */
266
+ SYN_RECEIVED,
267
+ /**
268
+ * The socket is connected
269
+ */
270
+ ESTABLISHED,
271
+ /**
272
+ * The socket has been closed
273
+ */
274
+ CLOSED,
275
+ /**
276
+ * The socket has been closed locally but not remotely
277
+ * (Since: 0.1.8)
278
+ */
279
+ FIN_WAIT_1,
280
+ /**
281
+ * The socket has been closed locally but not remotely
282
+ * (Since: 0.1.8)
283
+ */
284
+ FIN_WAIT_2,
285
+ /**
286
+ * The socket has been closed locally and remotely
287
+ * (Since: 0.1.8)
288
+ */
289
+ CLOSING,
290
+ /**
291
+ * The socket has been closed locally and remotely
292
+ * (Since: 0.1.8)
293
+ */
294
+ TIME_WAIT,
295
+ /**
296
+ * The socket has been closed remotely but not locally
297
+ * (Since: 0.1.8)
298
+ */
299
+ CLOSE_WAIT,
300
+ /**
301
+ * The socket has been closed locally and remotely
302
+ * (Since: 0.1.8)
303
+ */
304
+ LAST_ACK,
305
+ }
306
+ /**
307
+ * An enum representing the result value of the write operation requested by
308
+ * the #PseudoTcpSocket.
309
+ * <para> See also: %PseudoTcpCallbacks:WritePacket </para>
310
+ */
311
+ enum PseudoTcpWriteResult {
312
+ /**
313
+ * The write operation was successful
314
+ */
315
+ SUCCESS,
316
+ /**
317
+ * The socket type requires that message be sent atomically
318
+ * and the size of the message to be sent made this impossible.
319
+ */
320
+ TOO_LARGE,
321
+ /**
322
+ * There was an error sending the message
323
+ */
324
+ FAIL,
325
+ }
326
+ /**
327
+ * An enum representing the type of relay to use
328
+ */
329
+ enum RelayType {
330
+ /**
331
+ * A TURN relay using UDP
332
+ */
333
+ UDP,
334
+ /**
335
+ * A TURN relay using TCP
336
+ */
337
+ TCP,
338
+ /**
339
+ * A TURN relay using TLS over TCP
340
+ */
341
+ TLS,
342
+ }
343
+ /**
344
+ * These are options that can be passed to nice_agent_new_full(). They set
345
+ * various properties on the agent. Not including them sets the property to
346
+ * the other value.
347
+ * @bitfield
348
+ */
349
+ enum AgentOption {
350
+ /**
351
+ * Enables regular nomination, default
352
+ * is aggrssive mode (see #NiceNominationMode).
353
+ */
354
+ REGULAR_NOMINATION,
355
+ /**
356
+ * Enables reliable mode, possibly using PseudoTCP, * see nice_agent_new_reliable().
357
+ */
358
+ RELIABLE,
359
+ /**
360
+ * Enable lite mode
361
+ */
362
+ LITE_MODE,
363
+ /**
364
+ * Enable ICE trickle mode
365
+ */
366
+ ICE_TRICKLE,
367
+ /**
368
+ * Enable renomination triggered by NOMINATION STUN attribute
369
+ * proposed here: https://tools.ietf.org/html/draft-thatcher-ice-renomination-00
370
+ */
371
+ SUPPORT_RENOMINATION,
372
+ /**
373
+ * Enable RFC 7675 consent freshness support. (Since: 0.1.19)
374
+ */
375
+ CONSENT_FRESHNESS,
376
+ }
377
+ /**
378
+ * A hard limit for the number of remote candidates. This
379
+ * limit is enforced to protect against malevolent remote
380
+ * clients.
381
+ */
382
+ const AGENT_MAX_REMOTE_CANDIDATES: number
383
+ /**
384
+ * The maximum size a candidate foundation can have.
385
+ */
386
+ const CANDIDATE_MAX_FOUNDATION: number
387
+ /**
388
+ * The maximum number of local addresses. The constraint is that the
389
+ * maximum number of local addresses and number of turn servers must
390
+ * fit on 9 bits, to ensure candidate priority uniqueness. See also
391
+ * `NICE_CANDIDATE_MAX_TURN_SERVERS`. We choose 6 bits for the number of
392
+ * local addresses, and 3 bits for the number of turn servers.
393
+ */
394
+ const CANDIDATE_MAX_LOCAL_ADDRESSES: number
395
+ /**
396
+ * The maximum number of turns servers.
397
+ */
398
+ const CANDIDATE_MAX_TURN_SERVERS: number
399
+ /**
400
+ * Useful for debugging functions, just returns a static string with the
401
+ * candidate transport.
402
+ * @param transport a #NiceCandidateTransport
403
+ * @returns a static string with the candidate transport
404
+ */
405
+ function candidate_transport_to_string(transport: CandidateTransport): string | null
406
+ /**
407
+ * Useful for debugging functions, just returns a static string with the
408
+ * candidate type.
409
+ * @param type a #NiceCandidateType
410
+ * @returns a static string with the candidate type
411
+ */
412
+ function candidate_type_to_string(type: CandidateType): string | null
413
+ /**
414
+ * Returns a string representation of the state, generally to use in debug
415
+ * messages.
416
+ * @param state a #NiceComponentState
417
+ * @returns a string representation of @state
418
+ */
419
+ function component_state_to_string(state: ComponentState): string | null
420
+ /**
421
+ * Disables libnice debug output to the terminal
422
+ * @param with_stun Also disable stun debugging messages
423
+ */
424
+ function debug_disable(with_stun: boolean): void
425
+ /**
426
+ * Enables libnice debug output to the terminal. Note that the
427
+ * `G_MESSAGES_DEBUG` and `NICE_DEBUG` environment variables must be set to the
428
+ * set of logging domains to print, in order for any output to be printed. Set
429
+ * them to `all` to print all debugging messages, or any of the following
430
+ * domains:
431
+ * - `libnice-stun`
432
+ * - `libnice-tests`
433
+ * - `libnice-socket`
434
+ * - `libnice`
435
+ * - `libnice-pseudotcp`
436
+ * - `libnice-pseudotcp-verbose`
437
+ * @param with_stun Also enable STUN debugging messages
438
+ */
439
+ function debug_enable(with_stun: boolean): void
440
+ /**
441
+ * Retrieves the IP address of an interface by its name. If this fails, %NULL
442
+ * is returned.
443
+ * @param interface_name name of local interface
444
+ * @returns a newly-allocated string with the IP address
445
+ */
446
+ function interfaces_get_ip_for_interface(interface_name: string | null): string | null
447
+ /**
448
+ * Get the list of local interfaces
449
+ * @returns a newly-allocated #GList of strings. The caller must free it.
450
+ */
451
+ function interfaces_get_local_interfaces(): string[]
452
+ /**
453
+ * Get a list of local ipv4 interface addresses
454
+ * @param include_loopback Include any loopback devices
455
+ * @returns a newly-allocated #GList of strings. The caller must free it.
456
+ */
457
+ function interfaces_get_local_ips(include_loopback: boolean): string[]
458
+ /**
459
+ * Sets the debug level to enable/disable normal/verbose debug messages.
460
+ * @param level The level of debug to set
461
+ */
462
+ function pseudo_tcp_set_debug_level(level: PseudoTcpDebugLevel): void
463
+ /**
464
+ * Callback function when data is received on a component
465
+ * @callback
466
+ * @param agent The #NiceAgent Object
467
+ * @param stream_id The id of the stream
468
+ * @param component_id The id of the component of the stream which received the data
469
+ * @param len The length of the data
470
+ * @param buf The buffer containing the data received
471
+ */
472
+ interface AgentRecvFunc {
473
+ (agent: Agent, stream_id: number, component_id: number, len: number, buf: string | null): void
474
+ }
475
+ module Agent {
476
+
477
+ // Signal callback interfaces
478
+
479
+ /**
480
+ * Signal callback interface for `candidate-gathering-done`
481
+ */
482
+ interface CandidateGatheringDoneSignalCallback {
483
+ ($obj: Agent, stream_id: number): void
484
+ }
485
+
486
+ /**
487
+ * Signal callback interface for `component-state-changed`
488
+ */
489
+ interface ComponentStateChangedSignalCallback {
490
+ ($obj: Agent, stream_id: number, component_id: number, state: number): void
491
+ }
492
+
493
+ /**
494
+ * Signal callback interface for `initial-binding-request-received`
495
+ */
496
+ interface InitialBindingRequestReceivedSignalCallback {
497
+ ($obj: Agent, stream_id: number): void
498
+ }
499
+
500
+ /**
501
+ * Signal callback interface for `new-candidate`
502
+ */
503
+ interface NewCandidateSignalCallback {
504
+ ($obj: Agent, stream_id: number, component_id: number, foundation: string | null): void
505
+ }
506
+
507
+ /**
508
+ * Signal callback interface for `new-candidate-full`
509
+ */
510
+ interface NewCandidateFullSignalCallback {
511
+ ($obj: Agent, candidate: Candidate): void
512
+ }
513
+
514
+ /**
515
+ * Signal callback interface for `new-remote-candidate`
516
+ */
517
+ interface NewRemoteCandidateSignalCallback {
518
+ ($obj: Agent, stream_id: number, component_id: number, foundation: string | null): void
519
+ }
520
+
521
+ /**
522
+ * Signal callback interface for `new-remote-candidate-full`
523
+ */
524
+ interface NewRemoteCandidateFullSignalCallback {
525
+ ($obj: Agent, candidate: Candidate): void
526
+ }
527
+
528
+ /**
529
+ * Signal callback interface for `new-selected-pair`
530
+ */
531
+ interface NewSelectedPairSignalCallback {
532
+ ($obj: Agent, stream_id: number, component_id: number, lfoundation: string | null, rfoundation: string | null): void
533
+ }
534
+
535
+ /**
536
+ * Signal callback interface for `new-selected-pair-full`
537
+ */
538
+ interface NewSelectedPairFullSignalCallback {
539
+ ($obj: Agent, stream_id: number, component_id: number, lcandidate: Candidate, rcandidate: Candidate): void
540
+ }
541
+
542
+ /**
543
+ * Signal callback interface for `reliable-transport-writable`
544
+ */
545
+ interface ReliableTransportWritableSignalCallback {
546
+ ($obj: Agent, stream_id: number, component_id: number): void
547
+ }
548
+
549
+ /**
550
+ * Signal callback interface for `streams-removed`
551
+ */
552
+ interface StreamsRemovedSignalCallback {
553
+ ($obj: Agent, stream_ids: number[]): void
554
+ }
555
+
556
+
557
+ // Constructor properties interface
558
+
559
+ interface ConstructorProperties extends GObject.Object.ConstructorProperties {
560
+
561
+ // Own constructor properties of Nice-0.1.Nice.Agent
562
+
563
+ /**
564
+ * The Nice agent can work in various compatibility modes depending on
565
+ * what the application/peer needs.
566
+ * <para> See also: #NiceCompatibility</para>
567
+ */
568
+ compatibility?: number | null
569
+ /**
570
+ * Whether to perform periodic consent freshness checks as specified in
571
+ * RFC 7675. When %TRUE, the agent will periodically send binding requests
572
+ * to the peer to maintain the consent to send with the peer. On receipt
573
+ * of any authenticated error response, a component will immediately move
574
+ * to the failed state.
575
+ *
576
+ * Setting this property to %TRUE implies that 'keepalive-conncheck' should
577
+ * be %TRUE as well.
578
+ */
579
+ consent_freshness?: boolean | null
580
+ /**
581
+ * Whether the agent has the controlling role. This property should
582
+ * be modified before gathering candidates, any modification occuring
583
+ * later will be hold until ICE is restarted.
584
+ */
585
+ controlling_mode?: boolean | null
586
+ /**
587
+ * Force all traffic to go through a relay for added privacy, this
588
+ * allows hiding the local IP address. When this is enabled, so
589
+ * local candidates are available before relay servers have been set
590
+ * with nice_agent_set_relay_info().
591
+ */
592
+ force_relay?: boolean | null
593
+ full_mode?: boolean | null
594
+ /**
595
+ * Whether the agent should use ICE-TCP when gathering candidates.
596
+ * If the option is disabled, no TCP candidates will be generated. If the
597
+ * agent is in reliable mode, then pseudotcp will need to be used over UDP
598
+ * candidates.
599
+ * <para>
600
+ * This option should be set before gathering candidates and should not be
601
+ * modified afterwards.
602
+ * </para>
603
+ * The #NiceAgent:ice-tcp property can be set at the same time as the
604
+ * #NiceAgent:ice-udp property, but both cannot be unset at the same time.
605
+ * If #NiceAgent:ice-udp is set to %FALSE, then this property cannot be set
606
+ * to %FALSE as well.
607
+ * <note>
608
+ * <para>
609
+ * ICE-TCP is only supported for %NICE_COMPATIBILITY_RFC5245,
610
+ * %NICE_COMPATIBILITY_OC2007 and %NICE_COMPATIBILITY_OC2007R2 compatibility
611
+ * modes.
612
+ * </para>
613
+ * </note>
614
+ */
615
+ ice_tcp?: boolean | null
616
+ /**
617
+ * Whether to perform Trickle ICE as per draft-ietf-ice-trickle-ice-21.
618
+ * When %TRUE, the agent will postpone changing a component state to
619
+ * %NICE_COMPONENT_STATE_FAILED until nice_agent_peer_candidate_gathering_done()
620
+ * has been called with the ID of the component's stream.
621
+ */
622
+ ice_trickle?: boolean | null
623
+ /**
624
+ * Whether the agent should use ICE-UDP when gathering candidates.
625
+ * If the option is disabled, no UDP candidates will be generated. If the
626
+ * agent is in reliable mode, then pseudotcp will not be used since pseudotcp
627
+ * works on top of UDP candidates.
628
+ * <para>
629
+ * This option should be set before gathering candidates and should not be
630
+ * modified afterwards.
631
+ * </para>
632
+ * The #NiceAgent:ice-udp property can be set at the same time as the
633
+ * #NiceAgent:ice-tcp property, but both cannot be unset at the same time.
634
+ * If #NiceAgent:ice-tcp is set to %FALSE, then this property cannot be set
635
+ * to %FALSE as well.
636
+ */
637
+ ice_udp?: boolean | null
638
+ /**
639
+ * A final timeout in msec, launched when the agent becomes idle,
640
+ * before stopping its activity.
641
+ *
642
+ * This timer will delay the decision to set a component as failed.
643
+ * This delay is added to reduce the chance to see the agent receiving
644
+ * new stun activity just after the conncheck list has been declared
645
+ * failed (some valid pairs, no nominated pair, and no in-progress
646
+ * pairs), reactiviting conncheck activity, and causing a (valid)
647
+ * state transitions like that: connecting -> failed -> connecting ->
648
+ * connected -> ready. Such transitions are not buggy per-se, but may
649
+ * break the test-suite, that counts precisely the number of time each
650
+ * state has been set, and doesnt expect these transcient failed
651
+ * states.
652
+ *
653
+ * This timer is also useful when the agent is in controlled mode and
654
+ * the other controlling peer takes some time to elect its nominated
655
+ * pair (this may be the case for SfB peers).
656
+ *
657
+ * This timer is *NOT* part if the RFC5245, as this situation is not
658
+ * covered in sect 8.1.2 "Updating States", but deals with a real
659
+ * use-case, where a controlled agent can not wait forever for the
660
+ * other peer to make a nomination decision.
661
+ *
662
+ * Also note that the value of this timeout will not delay the
663
+ * emission of 'connected' and 'ready' agent signals, and will not
664
+ * slow down the behaviour of the agent when the peer agent works
665
+ * in a timely manner.
666
+ */
667
+ idle_timeout?: number | null
668
+ /**
669
+ * Use binding requests as keepalives instead of binding
670
+ * indications. This means that the keepalives may time out which
671
+ * will change the component state to %NICE_COMPONENT_STATE_FAILED.
672
+ *
673
+ * Enabing this is a slight violation of RFC 5245 section 10 which
674
+ * recommends using Binding Indications for keepalives.
675
+ *
676
+ * This is always enabled if the compatibility mode is
677
+ * %NICE_COMPATIBILITY_GOOGLE.
678
+ *
679
+ * This is always enabled if the 'consent-freshness' property is %TRUE
680
+ */
681
+ keepalive_conncheck?: boolean | null
682
+ /**
683
+ * A GLib main context is needed for all timeouts used by libnice.
684
+ * This is a property being set by the nice_agent_new() call.
685
+ */
686
+ main_context?: any | null
687
+ max_connectivity_checks?: number | null
688
+ /**
689
+ * The proxy server IP used to bypass a proxy firewall
690
+ */
691
+ proxy_ip?: string | null
692
+ /**
693
+ * The password used to authenticate with the proxy
694
+ */
695
+ proxy_password?: string | null
696
+ /**
697
+ * The proxy server port used to bypass a proxy firewall
698
+ */
699
+ proxy_port?: number | null
700
+ /**
701
+ * The type of proxy set in the proxy-ip property
702
+ */
703
+ proxy_type?: number | null
704
+ /**
705
+ * The username used to authenticate with the proxy
706
+ */
707
+ proxy_username?: string | null
708
+ /**
709
+ * Whether the agent is providing a reliable transport of messages (through
710
+ * ICE-TCP or PseudoTCP over ICE-UDP)
711
+ */
712
+ reliable?: boolean | null
713
+ /**
714
+ * The initial timeout (msecs) of the STUN binding requests
715
+ * used in the gathering stage, to find our local candidates.
716
+ * This property is described as 'RTO' in the RFC 5389 and RFC 5245.
717
+ * This timeout is doubled for each retransmission, until
718
+ * #NiceAgent:stun-max-retransmissions have been done,
719
+ * with an exception for the last restransmission, where the timeout is
720
+ * divided by two instead (RFC 5389 indicates that a customisable
721
+ * multiplier 'Rm' to 'RTO' should be used).
722
+ */
723
+ stun_initial_timeout?: number | null
724
+ /**
725
+ * The maximum number of retransmissions of the STUN binding requests
726
+ * used in the gathering stage, to find our local candidates, and used
727
+ * in the connection check stage, to test the validity of each
728
+ * constructed pair. This property is described as 'Rc' in the RFC
729
+ * 5389, with a default value of 7. The timeout of each STUN request
730
+ * is doubled for each retransmission, so the choice of this value has
731
+ * a direct impact on the time needed to move from the CONNECTED state
732
+ * to the READY state, and on the time needed to complete the GATHERING
733
+ * state.
734
+ */
735
+ stun_max_retransmissions?: number | null
736
+ stun_pacing_timer?: number | null
737
+ /**
738
+ * The initial timeout of the STUN binding requests used
739
+ * for a reliable timer.
740
+ */
741
+ stun_reliable_timeout?: number | null
742
+ stun_server?: string | null
743
+ stun_server_port?: number | null
744
+ /**
745
+ * Support RENOMINATION STUN attribute proposed here:
746
+ * https://tools.ietf.org/html/draft-thatcher-ice-renomination-00 As
747
+ * soon as RENOMINATION attribute is received from remote
748
+ * candidate's address, corresponding candidates pair gets
749
+ * selected. This is specific to Google Chrome/libWebRTC.
750
+ */
751
+ support_renomination?: boolean | null
752
+ /**
753
+ * Whether the agent should use UPnP to open a port in the router and
754
+ * get the external IP
755
+ */
756
+ upnp?: boolean | null
757
+ /**
758
+ * The maximum amount of time (in milliseconds) to wait for UPnP discovery to
759
+ * finish before signaling the #NiceAgent::candidate-gathering-done signal
760
+ */
761
+ upnp_timeout?: number | null
762
+ }
763
+
764
+ }
765
+
766
+ interface Agent {
767
+
768
+ // Own properties of Nice-0.1.Nice.Agent
769
+
770
+ /**
771
+ * This property defines whether receive/send over a TCP or pseudo-TCP, in
772
+ * reliable mode, are considered as packetized or as bytestream.
773
+ * In unreliable mode, every send/recv is considered as packetized, and
774
+ * this property is ignored and cannot be set.
775
+ * <para>
776
+ * In reliable mode, this property will always return %TRUE in the
777
+ * %NICE_COMPATIBILITY_GOOGLE compatibility mode.
778
+ * </para>
779
+ * If the property is %TRUE, the stream is considered in bytestream mode
780
+ * and data can be read with any receive size. If the property is %FALSE, then
781
+ * the stream is considred packetized and each receive will return one packet
782
+ * of the same size as what was sent from the peer. If in packetized mode,
783
+ * then doing a receive with a size smaller than the packet, will cause the
784
+ * remaining bytes in the packet to be dropped, breaking the reliability
785
+ * of the stream.
786
+ * <para>
787
+ * This property is currently read-only, and will become read/write once
788
+ * bytestream mode will be supported.
789
+ * </para>
790
+ */
791
+ readonly bytestream_tcp: boolean
792
+ /**
793
+ * The Nice agent can work in various compatibility modes depending on
794
+ * what the application/peer needs.
795
+ * <para> See also: #NiceCompatibility</para>
796
+ */
797
+ readonly compatibility: number
798
+ /**
799
+ * Whether to perform periodic consent freshness checks as specified in
800
+ * RFC 7675. When %TRUE, the agent will periodically send binding requests
801
+ * to the peer to maintain the consent to send with the peer. On receipt
802
+ * of any authenticated error response, a component will immediately move
803
+ * to the failed state.
804
+ *
805
+ * Setting this property to %TRUE implies that 'keepalive-conncheck' should
806
+ * be %TRUE as well.
807
+ */
808
+ readonly consent_freshness: boolean
809
+ /**
810
+ * Whether the agent has the controlling role. This property should
811
+ * be modified before gathering candidates, any modification occuring
812
+ * later will be hold until ICE is restarted.
813
+ */
814
+ controlling_mode: boolean
815
+ /**
816
+ * Force all traffic to go through a relay for added privacy, this
817
+ * allows hiding the local IP address. When this is enabled, so
818
+ * local candidates are available before relay servers have been set
819
+ * with nice_agent_set_relay_info().
820
+ */
821
+ force_relay: boolean
822
+ readonly full_mode: boolean
823
+ /**
824
+ * Whether the agent should use ICE-TCP when gathering candidates.
825
+ * If the option is disabled, no TCP candidates will be generated. If the
826
+ * agent is in reliable mode, then pseudotcp will need to be used over UDP
827
+ * candidates.
828
+ * <para>
829
+ * This option should be set before gathering candidates and should not be
830
+ * modified afterwards.
831
+ * </para>
832
+ * The #NiceAgent:ice-tcp property can be set at the same time as the
833
+ * #NiceAgent:ice-udp property, but both cannot be unset at the same time.
834
+ * If #NiceAgent:ice-udp is set to %FALSE, then this property cannot be set
835
+ * to %FALSE as well.
836
+ * <note>
837
+ * <para>
838
+ * ICE-TCP is only supported for %NICE_COMPATIBILITY_RFC5245,
839
+ * %NICE_COMPATIBILITY_OC2007 and %NICE_COMPATIBILITY_OC2007R2 compatibility
840
+ * modes.
841
+ * </para>
842
+ * </note>
843
+ */
844
+ ice_tcp: boolean
845
+ /**
846
+ * Whether to perform Trickle ICE as per draft-ietf-ice-trickle-ice-21.
847
+ * When %TRUE, the agent will postpone changing a component state to
848
+ * %NICE_COMPONENT_STATE_FAILED until nice_agent_peer_candidate_gathering_done()
849
+ * has been called with the ID of the component's stream.
850
+ */
851
+ ice_trickle: boolean
852
+ /**
853
+ * Whether the agent should use ICE-UDP when gathering candidates.
854
+ * If the option is disabled, no UDP candidates will be generated. If the
855
+ * agent is in reliable mode, then pseudotcp will not be used since pseudotcp
856
+ * works on top of UDP candidates.
857
+ * <para>
858
+ * This option should be set before gathering candidates and should not be
859
+ * modified afterwards.
860
+ * </para>
861
+ * The #NiceAgent:ice-udp property can be set at the same time as the
862
+ * #NiceAgent:ice-tcp property, but both cannot be unset at the same time.
863
+ * If #NiceAgent:ice-tcp is set to %FALSE, then this property cannot be set
864
+ * to %FALSE as well.
865
+ */
866
+ ice_udp: boolean
867
+ /**
868
+ * A final timeout in msec, launched when the agent becomes idle,
869
+ * before stopping its activity.
870
+ *
871
+ * This timer will delay the decision to set a component as failed.
872
+ * This delay is added to reduce the chance to see the agent receiving
873
+ * new stun activity just after the conncheck list has been declared
874
+ * failed (some valid pairs, no nominated pair, and no in-progress
875
+ * pairs), reactiviting conncheck activity, and causing a (valid)
876
+ * state transitions like that: connecting -> failed -> connecting ->
877
+ * connected -> ready. Such transitions are not buggy per-se, but may
878
+ * break the test-suite, that counts precisely the number of time each
879
+ * state has been set, and doesnt expect these transcient failed
880
+ * states.
881
+ *
882
+ * This timer is also useful when the agent is in controlled mode and
883
+ * the other controlling peer takes some time to elect its nominated
884
+ * pair (this may be the case for SfB peers).
885
+ *
886
+ * This timer is *NOT* part if the RFC5245, as this situation is not
887
+ * covered in sect 8.1.2 "Updating States", but deals with a real
888
+ * use-case, where a controlled agent can not wait forever for the
889
+ * other peer to make a nomination decision.
890
+ *
891
+ * Also note that the value of this timeout will not delay the
892
+ * emission of 'connected' and 'ready' agent signals, and will not
893
+ * slow down the behaviour of the agent when the peer agent works
894
+ * in a timely manner.
895
+ */
896
+ idle_timeout: number
897
+ /**
898
+ * Use binding requests as keepalives instead of binding
899
+ * indications. This means that the keepalives may time out which
900
+ * will change the component state to %NICE_COMPONENT_STATE_FAILED.
901
+ *
902
+ * Enabing this is a slight violation of RFC 5245 section 10 which
903
+ * recommends using Binding Indications for keepalives.
904
+ *
905
+ * This is always enabled if the compatibility mode is
906
+ * %NICE_COMPATIBILITY_GOOGLE.
907
+ *
908
+ * This is always enabled if the 'consent-freshness' property is %TRUE
909
+ */
910
+ keepalive_conncheck: boolean
911
+ /**
912
+ * A GLib main context is needed for all timeouts used by libnice.
913
+ * This is a property being set by the nice_agent_new() call.
914
+ */
915
+ readonly main_context: any
916
+ max_connectivity_checks: number
917
+ /**
918
+ * The proxy server IP used to bypass a proxy firewall
919
+ */
920
+ proxy_ip: string | null
921
+ /**
922
+ * The password used to authenticate with the proxy
923
+ */
924
+ proxy_password: string | null
925
+ /**
926
+ * The proxy server port used to bypass a proxy firewall
927
+ */
928
+ proxy_port: number
929
+ /**
930
+ * The type of proxy set in the proxy-ip property
931
+ */
932
+ proxy_type: number
933
+ /**
934
+ * The username used to authenticate with the proxy
935
+ */
936
+ proxy_username: string | null
937
+ /**
938
+ * Whether the agent is providing a reliable transport of messages (through
939
+ * ICE-TCP or PseudoTCP over ICE-UDP)
940
+ */
941
+ readonly reliable: boolean
942
+ /**
943
+ * The initial timeout (msecs) of the STUN binding requests
944
+ * used in the gathering stage, to find our local candidates.
945
+ * This property is described as 'RTO' in the RFC 5389 and RFC 5245.
946
+ * This timeout is doubled for each retransmission, until
947
+ * #NiceAgent:stun-max-retransmissions have been done,
948
+ * with an exception for the last restransmission, where the timeout is
949
+ * divided by two instead (RFC 5389 indicates that a customisable
950
+ * multiplier 'Rm' to 'RTO' should be used).
951
+ */
952
+ stun_initial_timeout: number
953
+ /**
954
+ * The maximum number of retransmissions of the STUN binding requests
955
+ * used in the gathering stage, to find our local candidates, and used
956
+ * in the connection check stage, to test the validity of each
957
+ * constructed pair. This property is described as 'Rc' in the RFC
958
+ * 5389, with a default value of 7. The timeout of each STUN request
959
+ * is doubled for each retransmission, so the choice of this value has
960
+ * a direct impact on the time needed to move from the CONNECTED state
961
+ * to the READY state, and on the time needed to complete the GATHERING
962
+ * state.
963
+ */
964
+ stun_max_retransmissions: number
965
+ stun_pacing_timer: number
966
+ /**
967
+ * The initial timeout of the STUN binding requests used
968
+ * for a reliable timer.
969
+ */
970
+ stun_reliable_timeout: number
971
+ stun_server: string | null
972
+ stun_server_port: number
973
+ /**
974
+ * Support RENOMINATION STUN attribute proposed here:
975
+ * https://tools.ietf.org/html/draft-thatcher-ice-renomination-00 As
976
+ * soon as RENOMINATION attribute is received from remote
977
+ * candidate's address, corresponding candidates pair gets
978
+ * selected. This is specific to Google Chrome/libWebRTC.
979
+ */
980
+ support_renomination: boolean
981
+ /**
982
+ * Whether the agent should use UPnP to open a port in the router and
983
+ * get the external IP
984
+ */
985
+ upnp: boolean
986
+ /**
987
+ * The maximum amount of time (in milliseconds) to wait for UPnP discovery to
988
+ * finish before signaling the #NiceAgent::candidate-gathering-done signal
989
+ */
990
+ upnp_timeout: number
991
+
992
+ // Owm methods of Nice-0.1.Nice.Agent
993
+
994
+ /**
995
+ * Add a local address from which to derive local host candidates for
996
+ * candidate gathering.
997
+ * <para>
998
+ * Since 0.0.5, if this method is not called, libnice will automatically
999
+ * discover the local addresses available
1000
+ * </para>
1001
+ *
1002
+ * See also: nice_agent_gather_candidates()
1003
+ * @param addr The address to listen to If the port is 0, then a random port will be chosen by the system
1004
+ * @returns %TRUE on success, %FALSE on fatal (memory allocation) errors
1005
+ */
1006
+ add_local_address(addr: Address): boolean
1007
+ /**
1008
+ * Adds a data stream to `agent` containing `n_components` components. The
1009
+ * returned stream ID is guaranteed to be positive on success.
1010
+ * @param n_components The number of components to add to the stream
1011
+ * @returns The ID of the new stream, 0 on failure
1012
+ */
1013
+ add_stream(n_components: number): number
1014
+ /**
1015
+ * Asynchronously closes resources the agent has allocated on remote servers.
1016
+ *
1017
+ * The agent will call the callback in the current #GMainContext in
1018
+ * which this function is called. The #GAsyncResult in the callback
1019
+ * can be ignored as this operation never fails.
1020
+ *
1021
+ * Calling this function before freeing the agent makes sure the allocated relay
1022
+ * ports aren't left behind on TURN server but properly removed.
1023
+ * @param callback A callback that will be called when the closing is complete
1024
+ */
1025
+ close_async(callback: Gio.AsyncReadyCallback<this> | null): void
1026
+ /**
1027
+ * Notifies the agent that consent to receive has been revoked. This will
1028
+ * cause the component to fail with 403 'Forbidden' all incoming STUN binding
1029
+ * requests as specified in RFC 7675.
1030
+ *
1031
+ * A stream with a component in the consent-lost state can be reused by
1032
+ * performing an ice restart with nice_agent_restart() or
1033
+ * nice_agent_restart_stream().
1034
+ *
1035
+ * Calling the function only has an effect when `agent` has been created with
1036
+ * `NICE_AGENT_OPTION_CONSENT_FRESHNESS`.
1037
+ * @param stream_id The ID of the stream
1038
+ * @param component_id The ID of the component
1039
+ * @returns %FALSE if the stream or component could not be found or consent freshness is not enabled, %TRUE otherwise
1040
+ */
1041
+ consent_lost(stream_id: number, component_id: number): boolean
1042
+ /**
1043
+ * Forget all the relay servers previously added using
1044
+ * nice_agent_set_relay_info(). Currently connected streams will keep
1045
+ * using the relay as long as they have not been restarted and haven't
1046
+ * succesfully negotiated a different path.
1047
+ * @param stream_id The ID of the stream
1048
+ * @param component_id The ID of the component
1049
+ * @returns %FALSE if the component could not be found, %TRUE otherwise
1050
+ */
1051
+ forget_relays(stream_id: number, component_id: number): boolean
1052
+ /**
1053
+ * Allocate and start listening on local candidate ports and start the remote
1054
+ * candidate gathering process.
1055
+ * Once done, #NiceAgent::candidate-gathering-done is called for the stream.
1056
+ * As soon as this function is called, #NiceAgent::new-candidate signals may be
1057
+ * emitted, even before this function returns.
1058
+ *
1059
+ * nice_agent_get_local_candidates() will only return non-empty results after
1060
+ * calling this function.
1061
+ *
1062
+ * <para>See also: nice_agent_add_local_address()</para>
1063
+ * <para>See also: nice_agent_set_port_range()</para>
1064
+ * @param stream_id The ID of the stream to start
1065
+ * @returns %FALSE if the stream ID is invalid or if a host candidate couldn't be allocated on the requested interfaces/ports; %TRUE otherwise <note> <para> Local addresses can be previously set with nice_agent_add_local_address() </para> <para> Since 0.0.5, If no local address was previously added, then the nice agent will automatically detect the local address using nice_interfaces_get_local_ips() </para> </note>
1066
+ */
1067
+ gather_candidates(stream_id: number): boolean
1068
+ /**
1069
+ * Generate an SDP string representing a local candidate.
1070
+ *
1071
+ * <para>See also: nice_agent_parse_remote_candidate_sdp() </para>
1072
+ * <para>See also: nice_agent_generate_local_sdp() </para>
1073
+ * <para>See also: nice_agent_generate_local_stream_sdp() </para>
1074
+ * @param candidate The candidate to generate
1075
+ * @returns A string representing the SDP for the candidate. Must be freed with g_free() once done.
1076
+ */
1077
+ generate_local_candidate_sdp(candidate: Candidate): string | null
1078
+ /**
1079
+ * Generate an SDP string containing the local candidates and credentials for
1080
+ * all streams and components in the agent.
1081
+ *
1082
+ * <note>
1083
+ * <para>
1084
+ * The SDP will not contain any codec lines and the 'm' line will not list
1085
+ * any payload types.
1086
+ * </para>
1087
+ * <para>
1088
+ * It is highly recommended to set names on the streams prior to calling this
1089
+ * function. Unnamed streams will show up as '-' in the 'm' line, but the SDP
1090
+ * will not be parseable with nice_agent_parse_remote_sdp() if a stream is
1091
+ * unnamed.
1092
+ * </para>
1093
+ * <para>
1094
+ * The default candidate in the SDP will be selected based on the lowest
1095
+ * priority candidate for the first component.
1096
+ * </para>
1097
+ * </note>
1098
+ *
1099
+ * <para>See also: nice_agent_set_stream_name() </para>
1100
+ * <para>See also: nice_agent_parse_remote_sdp() </para>
1101
+ * <para>See also: nice_agent_generate_local_stream_sdp() </para>
1102
+ * <para>See also: nice_agent_generate_local_candidate_sdp() </para>
1103
+ * <para>See also: nice_agent_get_default_local_candidate() </para>
1104
+ * @returns A string representing the local SDP. Must be freed with g_free() once done.
1105
+ */
1106
+ generate_local_sdp(): string | null
1107
+ /**
1108
+ * Generate an SDP string containing the local candidates and credentials
1109
+ * for a stream.
1110
+ *
1111
+ * <note>
1112
+ * <para>
1113
+ * The SDP will not contain any codec lines and the 'm' line will not list
1114
+ * any payload types.
1115
+ * </para>
1116
+ * <para>
1117
+ * It is highly recommended to set the name of the stream prior to calling this
1118
+ * function. Unnamed streams will show up as '-' in the 'm' line.
1119
+ * </para>
1120
+ * <para>
1121
+ * The default candidate in the SDP will be selected based on the lowest
1122
+ * priority candidate.
1123
+ * </para>
1124
+ * </note>
1125
+ *
1126
+ * <para>See also: nice_agent_set_stream_name() </para>
1127
+ * <para>See also: nice_agent_parse_remote_stream_sdp() </para>
1128
+ * <para>See also: nice_agent_generate_local_sdp() </para>
1129
+ * <para>See also: nice_agent_generate_local_candidate_sdp() </para>
1130
+ * <para>See also: nice_agent_get_default_local_candidate() </para>
1131
+ * @param stream_id The ID of the stream
1132
+ * @param include_non_ice Whether or not to include non ICE specific lines (m=, c= and a=rtcp: lines)
1133
+ * @returns A string representing the local SDP for the stream. Must be freed with g_free() once done.
1134
+ */
1135
+ generate_local_stream_sdp(stream_id: number, include_non_ice: boolean): string | null
1136
+ /**
1137
+ * Retrieves the current state of a component.
1138
+ * @param stream_id The ID of the stream
1139
+ * @param component_id The ID of the component
1140
+ * @returns the #NiceComponentState of the component and %NICE_COMPONENT_STATE_FAILED if the component was invalid.
1141
+ */
1142
+ get_component_state(stream_id: number, component_id: number): ComponentState
1143
+ /**
1144
+ * This helper function will return the recommended default candidate to be
1145
+ * used for non-ICE compatible clients. This will usually be the candidate
1146
+ * with the lowest priority, since it will be the longest path but the one with
1147
+ * the most chances of success.
1148
+ * <note>
1149
+ * <para>
1150
+ * This function is only useful in order to manually generate the
1151
+ * local SDP
1152
+ * </para>
1153
+ * </note>
1154
+ * @param stream_id The ID of the stream
1155
+ * @param component_id The ID of the component
1156
+ * @returns The candidate to be used as the default candidate, or %NULL in case of error. Must be freed with nice_candidate_free() once done.
1157
+ */
1158
+ get_default_local_candidate(stream_id: number, component_id: number): Candidate
1159
+ /**
1160
+ * Gets a #GIOStream wrapper around the given stream and component in
1161
+ * `agent`. The I/O stream will be valid for as long as `stream_id` is valid.
1162
+ * The #GInputStream and #GOutputStream implement #GPollableInputStream and
1163
+ * #GPollableOutputStream.
1164
+ *
1165
+ * This function may only be called on reliable #NiceAgents. It is a
1166
+ * programming error to try and create an I/O stream wrapper for an
1167
+ * unreliable stream.
1168
+ * @param stream_id The ID of the stream to wrap
1169
+ * @param component_id The ID of the component to wrap
1170
+ * @returns A #GIOStream.
1171
+ */
1172
+ get_io_stream(stream_id: number, component_id: number): Gio.IOStream
1173
+ /**
1174
+ * Retrieve from the agent the list of all local candidates
1175
+ * for a stream's component
1176
+ *
1177
+ * <note>
1178
+ * <para>
1179
+ * The caller owns the returned GSList as well as the candidates contained
1180
+ * within it.
1181
+ * To get full results, the client should wait for the
1182
+ * #NiceAgent::candidate-gathering-done signal.
1183
+ * </para>
1184
+ * </note>
1185
+ * @param stream_id The ID of the stream
1186
+ * @param component_id The ID of the component
1187
+ * @returns a #GSList of #NiceCandidate objects representing the local candidates of @agent
1188
+ */
1189
+ get_local_candidates(stream_id: number, component_id: number): Candidate[]
1190
+ /**
1191
+ * Gets the local credentials for stream `stream_id`. This may be called any time
1192
+ * after creating a stream using nice_agent_add_stream().
1193
+ *
1194
+ * An error will be returned if this is called for a non-existent stream, or if
1195
+ * either of `ufrag` or `pwd` are %NULL.
1196
+ * @param stream_id The ID of the stream
1197
+ * @returns %TRUE on success, %FALSE on error.
1198
+ */
1199
+ get_local_credentials(stream_id: number): [ /* returnType */ boolean, /* ufrag */ string | null, /* pwd */ string | null ]
1200
+ /**
1201
+ * Get a list of the remote candidates set on a stream's component
1202
+ *
1203
+ * <note>
1204
+ * <para>
1205
+ * The caller owns the returned GSList as well as the candidates contained
1206
+ * within it.
1207
+ * </para>
1208
+ * <para>
1209
+ * The list of remote candidates can change during processing.
1210
+ * The client should register for the #NiceAgent::new-remote-candidate signal
1211
+ * to get notified of new remote candidates.
1212
+ * </para>
1213
+ * </note>
1214
+ * @param stream_id The ID of the stream
1215
+ * @param component_id The ID of the component
1216
+ * @returns a #GSList of #NiceCandidates objects representing the remote candidates set on the @agent
1217
+ */
1218
+ get_remote_candidates(stream_id: number, component_id: number): Candidate[]
1219
+ /**
1220
+ * Retreive the selected candidate pair for media transmission
1221
+ * for a given stream's component.
1222
+ * @param stream_id The ID of the stream
1223
+ * @param component_id The ID of the component
1224
+ * @param local The local selected candidate
1225
+ * @param remote The remote selected candidate
1226
+ * @returns %TRUE on success, %FALSE if there is no selected candidate pair
1227
+ */
1228
+ get_selected_pair(stream_id: number, component_id: number, local: Candidate, remote: Candidate): boolean
1229
+ /**
1230
+ * Retreive the local socket associated with the selected candidate pair
1231
+ * for media transmission for a given stream's component.
1232
+ *
1233
+ * This is useful for adding ICE support to legacy applications that already
1234
+ * have a protocol that maintains a connection. If the socket is duplicated
1235
+ * before unrefing the agent, the application can take over and continue to use
1236
+ * it. New applications are encouraged to use the built in libnice stream
1237
+ * handling instead and let libnice handle the connection maintenance.
1238
+ *
1239
+ * Users of this method are encouraged to not use a TURN relay or any kind
1240
+ * of proxy, as in this case, the socket will not be available to the
1241
+ * application because the packets are encapsulated.
1242
+ * @param stream_id The ID of the stream
1243
+ * @param component_id The ID of the component
1244
+ * @returns pointer to the #GSocket, or %NULL if there is no selected candidate or if the selected candidate is a relayed candidate.
1245
+ */
1246
+ get_selected_socket(stream_id: number, component_id: number): Gio.Socket | null
1247
+ /**
1248
+ * Each component can have multiple sockets, this is an API to retrieve them all
1249
+ * to be able to set properties. Most of the sockets for a component are created when
1250
+ * calling nice_agent_gather_candidates(), so this API should be called right after to
1251
+ * able to set properties on the sockets before they are used.
1252
+ *
1253
+ * These sockets can be a mix of UDP & TCP sockets depending on the compatibility mode
1254
+ * and options that have been set.
1255
+ * @param stream_id The ID of the stream
1256
+ * @param component_id The ID of the component
1257
+ * @returns An array containing all of the sockets for this component. Free with g_ptr_array_unref() when done.
1258
+ */
1259
+ get_sockets(stream_id: number, component_id: number): Gio.Socket[]
1260
+ /**
1261
+ * This function will return the name assigned to a stream.
1262
+ *
1263
+ * <para>See also: nice_agent_set_stream_name()</para>
1264
+ * @param stream_id The ID of the stream to change
1265
+ * @returns The name of the stream. The name is only valid while the stream exists or until it changes through a call to nice_agent_set_stream_name().
1266
+ */
1267
+ get_stream_name(stream_id: number): string | null
1268
+ /**
1269
+ * Parse an SDP string and extracts the candidate from it.
1270
+ *
1271
+ * <para>See also: nice_agent_generate_local_candidate_sdp() </para>
1272
+ * <para>See also: nice_agent_parse_remote_sdp() </para>
1273
+ * <para>See also: nice_agent_parse_remote_stream_sdp() </para>
1274
+ * @param stream_id The ID of the stream the candidate belongs to
1275
+ * @param sdp The remote SDP to parse
1276
+ * @returns The parsed candidate or %NULL if there was an error.
1277
+ */
1278
+ parse_remote_candidate_sdp(stream_id: number, sdp: string | null): Candidate
1279
+ /**
1280
+ * Parse an SDP string and extracts candidates and credentials from it and sets
1281
+ * them on the agent.
1282
+ *
1283
+ * <para>See also: nice_agent_set_stream_name() </para>
1284
+ * <para>See also: nice_agent_generate_local_sdp() </para>
1285
+ * <para>See also: nice_agent_parse_remote_stream_sdp() </para>
1286
+ * <para>See also: nice_agent_parse_remote_candidate_sdp() </para>
1287
+ * @param sdp The remote SDP to parse
1288
+ * @returns The number of candidates added, negative on errors
1289
+ */
1290
+ parse_remote_sdp(sdp: string | null): number
1291
+ /**
1292
+ * Parse an SDP string representing a single stream and extracts candidates
1293
+ * and credentials from it.
1294
+ *
1295
+ * <para>See also: nice_agent_generate_local_stream_sdp() </para>
1296
+ * <para>See also: nice_agent_parse_remote_sdp() </para>
1297
+ * <para>See also: nice_agent_parse_remote_candidate_sdp() </para>
1298
+ * @param stream_id The ID of the stream to parse
1299
+ * @param sdp The remote SDP to parse
1300
+ * @param ufrag Pointer to store the ice ufrag if non %NULL. Must be freed with g_free() after use
1301
+ * @param pwd Pointer to store the ice password if non %NULL. Must be freed with g_free() after use
1302
+ * @returns A #GSList of candidates parsed from the SDP, or %NULL in case of errors
1303
+ */
1304
+ parse_remote_stream_sdp(stream_id: number, sdp: string | null, ufrag: string | null, pwd: string | null): Candidate[]
1305
+ /**
1306
+ * Notifies the agent that the remote peer has concluded candidate gathering and
1307
+ * thus no more remote candidates are expected to arrive for `stream_id`.
1308
+ *
1309
+ * This will allow the stream components without a successful connectivity check
1310
+ * to stop waiting for more candidates to come and finally transit into
1311
+ * %NICE_COMPONENT_STATE_FAILED.
1312
+ *
1313
+ * Calling the function has an effect only when #NiceAgent:trickle-ice is %TRUE.
1314
+ * @param stream_id The ID of the stream
1315
+ * @returns %FALSE if the stream could not be found, %TRUE otherwise
1316
+ */
1317
+ peer_candidate_gathering_done(stream_id: number): boolean
1318
+ /**
1319
+ * A single-message version of nice_agent_recv_messages().
1320
+ * @param stream_id the ID of the stream to receive on
1321
+ * @param component_id the ID of the component to receive on
1322
+ * @param cancellable a #GCancellable to allow the operation to be cancelled from another thread, or %NULL
1323
+ * @returns the number of bytes written to @buf on success (guaranteed to be greater than 0 unless @buf_len is 0), 0 if in reliable mode and the remote peer closed the stream, or -1 on error
1324
+ */
1325
+ recv(stream_id: number, component_id: number, cancellable: Gio.Cancellable | null): [ /* returnType */ number, /* buf */ Uint8Array ]
1326
+ /**
1327
+ * Block on receiving data from the given stream/component combination on
1328
+ * `agent,` returning only once exactly `n_messages` messages have been received
1329
+ * and written into `messages,` the stream is closed by the other end or by
1330
+ * calling nice_agent_remove_stream(), or `cancellable` is cancelled.
1331
+ *
1332
+ * Any STUN packets received will not be added to `messages;` instead,
1333
+ * they'll be passed for processing to #NiceAgent itself. Since #NiceAgent
1334
+ * does not poll for messages on its own, it's therefore essential to keep
1335
+ * calling this function for ICE connection establishment to work.
1336
+ *
1337
+ * In the non-error case, in reliable mode, this will block until all buffers in
1338
+ * all `n_messages` have been filled with received data (i.e. `messages` is
1339
+ * treated as a large, flat array of buffers). In non-reliable mode, it will
1340
+ * block until `n_messages` messages have been received, each of which does not
1341
+ * have to fill all the buffers in its #NiceInputMessage. In the non-reliable
1342
+ * case, each #NiceInputMessage must have enough buffers to contain an entire
1343
+ * message (65536 bytes), or any excess data may be silently dropped.
1344
+ *
1345
+ * For each received message, #NiceInputMessage::length will be set to the
1346
+ * number of valid bytes stored in the message’s buffers. The bytes are stored
1347
+ * sequentially in the buffers; there are no gaps apart from at the end of the
1348
+ * buffer array (in non-reliable mode). If non-%NULL on input,
1349
+ * #NiceInputMessage::from will have the address of the sending peer stored in
1350
+ * it. The base addresses, sizes, and number of buffers in each message will not
1351
+ * be modified in any case.
1352
+ *
1353
+ * This must not be used in combination with nice_agent_attach_recv() on the
1354
+ * same stream/component pair.
1355
+ *
1356
+ * If the stream/component pair doesn’t exist, or if a suitable candidate socket
1357
+ * hasn’t yet been selected for it, a %G_IO_ERROR_BROKEN_PIPE error will be
1358
+ * returned. A %G_IO_ERROR_CANCELLED error will be returned if the operation was
1359
+ * cancelled. %G_IO_ERROR_FAILED will be returned for other errors.
1360
+ * @param stream_id the ID of the stream to receive on
1361
+ * @param component_id the ID of the component to receive on
1362
+ * @param cancellable a #GCancellable to allow the operation to be cancelled from another thread, or %NULL
1363
+ * @returns the number of valid messages written to @messages on success (guaranteed to be greater than 0 unless @n_messages is 0), 0 if the remote peer closed the stream, or -1 on error
1364
+ */
1365
+ recv_messages(stream_id: number, component_id: number, cancellable: Gio.Cancellable | null): [ /* returnType */ number, /* messages */ InputMessage[] ]
1366
+ /**
1367
+ * Try to receive data from the given stream/component combination on `agent,`
1368
+ * without blocking. If receiving data would block, -1 is returned and
1369
+ * %G_IO_ERROR_WOULD_BLOCK is set in `error`. If any other error occurs, -1 is
1370
+ * returned and `error` is set accordingly. Otherwise, 0 is returned if (and only
1371
+ * if) `n_messages` is 0. In all other cases, the number of valid messages stored
1372
+ * in `messages` is returned, and will be greater than 0.
1373
+ *
1374
+ * This function behaves similarly to nice_agent_recv_messages(), except that it
1375
+ * will not block on filling (in reliable mode) or receiving (in non-reliable
1376
+ * mode) exactly `n_messages` messages. In reliable mode, it will receive bytes
1377
+ * into `messages` until it would block; in non-reliable mode, it will receive
1378
+ * messages until it would block.
1379
+ *
1380
+ * Any STUN packets received will not be added to `messages;` instead,
1381
+ * they'll be passed for processing to #NiceAgent itself. Since #NiceAgent
1382
+ * does not poll for messages on its own, it's therefore essential to keep
1383
+ * calling this function for ICE connection establishment to work.
1384
+ *
1385
+ * As this function is non-blocking, `cancellable` is included only for parity
1386
+ * with nice_agent_recv_messages(). If `cancellable` is cancelled before this
1387
+ * function is called, a %G_IO_ERROR_CANCELLED error will be returned
1388
+ * immediately.
1389
+ *
1390
+ * This must not be used in combination with nice_agent_attach_recv() on the
1391
+ * same stream/component pair.
1392
+ * @param stream_id the ID of the stream to receive on
1393
+ * @param component_id the ID of the component to receive on
1394
+ * @param cancellable a #GCancellable to allow the operation to be cancelled from another thread, or %NULL
1395
+ * @returns the number of valid messages written to @messages on success (guaranteed to be greater than 0 unless @n_messages is 0), 0 if in reliable mode and the remote peer closed the stream, or -1 on error
1396
+ */
1397
+ recv_messages_nonblocking(stream_id: number, component_id: number, cancellable: Gio.Cancellable | null): [ /* returnType */ number, /* messages */ InputMessage[] ]
1398
+ /**
1399
+ * A single-message version of nice_agent_recv_messages_nonblocking().
1400
+ * @param stream_id the ID of the stream to receive on
1401
+ * @param component_id the ID of the component to receive on
1402
+ * @param cancellable a #GCancellable to allow the operation to be cancelled from another thread, or %NULL
1403
+ * @returns the number of bytes received into @buf on success (guaranteed to be greater than 0 unless @buf_len is 0), 0 if in reliable mode and the remote peer closed the stream, or -1 on error
1404
+ */
1405
+ recv_nonblocking(stream_id: number, component_id: number, cancellable: Gio.Cancellable | null): [ /* returnType */ number, /* buf */ Uint8Array ]
1406
+ /**
1407
+ * Remove and free a previously created data stream from `agent`. If any I/O
1408
+ * streams have been created using nice_agent_get_io_stream(), they should be
1409
+ * closed completely using g_io_stream_close() before this is called, or they
1410
+ * will get broken pipe errors.
1411
+ * @param stream_id The ID of the stream to remove
1412
+ */
1413
+ remove_stream(stream_id: number): void
1414
+ /**
1415
+ * Restarts the session as defined in ICE draft 19. This function
1416
+ * needs to be called both when initiating (ICE spec section 9.1.1.1.
1417
+ * "ICE Restarts"), as well as when reacting (spec section 9.2.1.1.
1418
+ * "Detecting ICE Restart") to a restart.
1419
+ *
1420
+ * If consent-freshness has been enabled on `agent,` as specified in RFC7675
1421
+ * then restarting streams will restore the local consent.
1422
+ * @returns %TRUE on success %FALSE on error
1423
+ */
1424
+ restart(): boolean
1425
+ /**
1426
+ * Restarts a single stream as defined in RFC 5245. This function
1427
+ * needs to be called both when initiating (ICE spec section 9.1.1.1.
1428
+ * "ICE Restarts"), as well as when reacting (spec section 9.2.1.1.
1429
+ * "Detecting ICE Restart") to a restart.
1430
+ *
1431
+ * Unlike nice_agent_restart(), this applies to a single stream. It also
1432
+ * does not generate a new tie breaker.
1433
+ *
1434
+ * If consent-freshness has been enabled on `agent,` as specified in RFC7675
1435
+ * then restart `stream_id` will restore the local consent for that stream.
1436
+ * @param stream_id The ID of the stream
1437
+ * @returns %TRUE on success %FALSE on error
1438
+ */
1439
+ restart_stream(stream_id: number): boolean
1440
+ /**
1441
+ * Sends a data payload over a stream's component.
1442
+ *
1443
+ * <note>
1444
+ * <para>
1445
+ * Component state MUST be NICE_COMPONENT_STATE_READY, or as a special case,
1446
+ * in any state if component was in READY state before and was then restarted
1447
+ * </para>
1448
+ * <para>
1449
+ * In reliable mode, the -1 error value means either that you are not yet
1450
+ * connected or that the send buffer is full (equivalent to EWOULDBLOCK).
1451
+ * In both cases, you simply need to wait for the
1452
+ * #NiceAgent::reliable-transport-writable signal to be fired before resending
1453
+ * the data.
1454
+ * </para>
1455
+ * <para>
1456
+ * In non-reliable mode, it will virtually never happen with UDP sockets, but
1457
+ * it might happen if the active candidate is a TURN-TCP connection that got
1458
+ * disconnected.
1459
+ * </para>
1460
+ * <para>
1461
+ * In both reliable and non-reliable mode, a -1 error code could also mean that
1462
+ * the stream_id and/or component_id are invalid.
1463
+ * </para>
1464
+ * </note>
1465
+ * @param stream_id The ID of the stream to send to
1466
+ * @param component_id The ID of the component to send to
1467
+ * @param len The length of the buffer to send
1468
+ * @param buf The buffer of data to send
1469
+ * @returns The number of bytes sent, or negative error code
1470
+ */
1471
+ send(stream_id: number, component_id: number, len: number, buf: string | null): number
1472
+ /**
1473
+ * Sends multiple messages on the socket identified by the given
1474
+ * stream/component pair. Transmission is non-blocking, so a
1475
+ * %G_IO_ERROR_WOULD_BLOCK error may be returned if the send buffer is full.
1476
+ *
1477
+ * As with nice_agent_send(), the given component must be in
1478
+ * %NICE_COMPONENT_STATE_READY or, as a special case, in any state if it was
1479
+ * previously ready and was then restarted.
1480
+ *
1481
+ * On success, the number of messages written to the socket will be returned,
1482
+ * which may be less than `n_messages` if transmission would have blocked
1483
+ * part-way through. Zero will be returned if `n_messages` is zero, or if
1484
+ * transmission would have blocked on the first message.
1485
+ *
1486
+ * In reliable mode, it is instead recommended to use
1487
+ * nice_agent_send(). The return value can be less than `n_messages`
1488
+ * or 0 even if it is still possible to send a partial message. In
1489
+ * this case, "nice-agent-writable" will never be triggered, so the
1490
+ * application would have to use nice_agent_sent() to fill the buffer or have
1491
+ * to retry sending at a later point.
1492
+ *
1493
+ * On failure, -1 will be returned and `error` will be set. If the #NiceAgent is
1494
+ * reliable and the socket is not yet connected, %G_IO_ERROR_BROKEN_PIPE will be
1495
+ * returned; if the write buffer is full, %G_IO_ERROR_WOULD_BLOCK will be
1496
+ * returned. In both cases, wait for the #NiceAgent::reliable-transport-writable
1497
+ * signal before trying again. If the given `stream_id` or `component_id` are
1498
+ * invalid or not yet connected, %G_IO_ERROR_BROKEN_PIPE will be returned.
1499
+ * %G_IO_ERROR_FAILED will be returned for other errors.
1500
+ * @param stream_id the ID of the stream to send to
1501
+ * @param component_id the ID of the component to send to
1502
+ * @param messages array of messages to send, of at least `n_messages` entries in length
1503
+ * @param cancellable a #GCancellable to cancel the operation from another thread, or %NULL
1504
+ * @returns the number of messages sent (may be zero), or -1 on error
1505
+ */
1506
+ send_messages_nonblocking(stream_id: number, component_id: number, messages: OutputMessage[], cancellable: Gio.Cancellable | null): number
1507
+ /**
1508
+ * Sets the local credentials for stream `stream_id`.
1509
+ *
1510
+ * <note>
1511
+ * <para>
1512
+ * This is only effective before ICE negotiation has started.
1513
+ * </para>
1514
+ * </note>
1515
+ *
1516
+ * Since 0.1.11
1517
+ * @param stream_id The ID of the stream
1518
+ * @param ufrag nul-terminated string containing an ICE username fragment (length must be between 22 and 256 chars)
1519
+ * @param pwd nul-terminated string containing an ICE password (length must be between 4 and 256 chars)
1520
+ * @returns %TRUE on success, %FALSE on error.
1521
+ */
1522
+ set_local_credentials(stream_id: number, ufrag: string | null, pwd: string | null): boolean
1523
+ /**
1524
+ * Sets a preferred port range for allocating host candidates.
1525
+ * <para>
1526
+ * If a local host candidate cannot be created on that port
1527
+ * range, then the nice_agent_gather_candidates() call will fail.
1528
+ * </para>
1529
+ * <para>
1530
+ * This MUST be called before nice_agent_gather_candidates()
1531
+ * </para>
1532
+ * @param stream_id The ID of the stream
1533
+ * @param component_id The ID of the component
1534
+ * @param min_port The minimum port to use
1535
+ * @param max_port The maximum port to use
1536
+ */
1537
+ set_port_range(stream_id: number, component_id: number, min_port: number, max_port: number): void
1538
+ /**
1539
+ * Sets the settings for using a relay server during the candidate discovery.
1540
+ * This may be called multiple times to add multiple relay servers to the
1541
+ * discovery process; one TCP and one UDP, for example.
1542
+ * @param stream_id The ID of the stream
1543
+ * @param component_id The ID of the component
1544
+ * @param server_ip The IP address of the TURN server
1545
+ * @param server_port The port of the TURN server
1546
+ * @param username The TURN username to use for the allocate
1547
+ * @param password The TURN password to use for the allocate
1548
+ * @param type The type of relay to use
1549
+ * @returns %TRUE if the TURN settings were accepted. %FALSE if the address was invalid.
1550
+ */
1551
+ set_relay_info(stream_id: number, component_id: number, server_ip: string | null, server_port: number, username: string | null, password: string | null, type: RelayType): boolean
1552
+ /**
1553
+ * Sets, adds or updates the remote candidates for a component of a stream.
1554
+ *
1555
+ * <note>
1556
+ * <para>
1557
+ * NICE_AGENT_MAX_REMOTE_CANDIDATES is the absolute maximum limit
1558
+ * for remote candidates.
1559
+ * </para>
1560
+ * <para>
1561
+ * You must first call nice_agent_gather_candidates() and wait for the
1562
+ * #NiceAgent::candidate-gathering-done signale before
1563
+ * calling nice_agent_set_remote_candidates()
1564
+ * </para>
1565
+ * <para>
1566
+ * Since 0.1.3, there is no need to wait for the candidate-gathering-done signal.
1567
+ * Remote candidates can be set even while gathering local candidates.
1568
+ * Newly discovered local candidates will automatically be paired with
1569
+ * existing remote candidates.
1570
+ * </para>
1571
+ * </note>
1572
+ * @param stream_id The ID of the stream the candidates are for
1573
+ * @param component_id The ID of the component the candidates are for
1574
+ * @param candidates a #GSList of #NiceCandidate items describing each candidate to add
1575
+ * @returns The number of candidates added, negative on errors (memory allocation error or invalid component)
1576
+ */
1577
+ set_remote_candidates(stream_id: number, component_id: number, candidates: Candidate[]): number
1578
+ /**
1579
+ * Sets the remote credentials for stream `stream_id`.
1580
+ *
1581
+ * <note>
1582
+ * <para>
1583
+ * Stream credentials do not override per-candidate credentials if set
1584
+ * </para>
1585
+ * <para>
1586
+ * Due to the native of peer-reflexive candidates, any agent using a per-stream
1587
+ * credentials (RFC5245, WLM2009, OC2007R2 and DRAFT19) instead of
1588
+ * per-candidate credentials (GOOGLE, MSN, OC2007), must
1589
+ * use the nice_agent_set_remote_credentials() API instead of setting the
1590
+ * username and password on the candidates.
1591
+ * </para>
1592
+ * </note>
1593
+ * @param stream_id The ID of the stream
1594
+ * @param ufrag nul-terminated string containing an ICE username fragment (length must be between 22 and 256 chars)
1595
+ * @param pwd nul-terminated string containing an ICE password (length must be between 4 and 256 chars)
1596
+ * @returns %TRUE on success, %FALSE on error.
1597
+ */
1598
+ set_remote_credentials(stream_id: number, ufrag: string | null, pwd: string | null): boolean
1599
+ /**
1600
+ * Sets the selected candidate pair for media transmission
1601
+ * for a given stream's component. Calling this function will
1602
+ * disable all further ICE processing (connection check,
1603
+ * state machine updates, etc). Note that keepalives will
1604
+ * continue to be sent.
1605
+ * @param stream_id The ID of the stream
1606
+ * @param component_id The ID of the component
1607
+ * @param lfoundation The local foundation of the candidate to use
1608
+ * @param rfoundation The remote foundation of the candidate to use
1609
+ * @returns %TRUE on success, %FALSE if the candidate pair cannot be found
1610
+ */
1611
+ set_selected_pair(stream_id: number, component_id: number, lfoundation: string | null, rfoundation: string | null): boolean
1612
+ /**
1613
+ * Sets the selected remote candidate for media transmission
1614
+ * for a given stream's component. This is used to force the selection of
1615
+ * a specific remote candidate even when connectivity checks are failing
1616
+ * (e.g. non-ICE compatible candidates).
1617
+ * Calling this function will disable all further ICE processing
1618
+ * (connection check, state machine updates, etc). Note that keepalives will
1619
+ * continue to be sent.
1620
+ * @param stream_id The ID of the stream
1621
+ * @param component_id The ID of the component
1622
+ * @param candidate The #NiceCandidate to select
1623
+ * @returns %TRUE on success, %FALSE on failure
1624
+ */
1625
+ set_selected_remote_candidate(stream_id: number, component_id: number, candidate: Candidate): boolean
1626
+ /**
1627
+ * This function will set the value of the SOFTWARE attribute to be added to
1628
+ * STUN requests, responses and error responses sent during connectivity checks.
1629
+ * <para>
1630
+ * The SOFTWARE attribute will only be added in the #NICE_COMPATIBILITY_RFC5245
1631
+ * and #NICE_COMPATIBILITY_WLM2009 compatibility modes.
1632
+ *
1633
+ * </para>
1634
+ * <note>
1635
+ * <para>
1636
+ * The `software` argument will be appended with the libnice version before
1637
+ * being sent.
1638
+ * </para>
1639
+ * <para>
1640
+ * The `software` argument must be in UTF-8 encoding and only the first
1641
+ * 128 characters will be sent.
1642
+ * </para>
1643
+ * </note>
1644
+ * @param software The value of the SOFTWARE attribute to add.
1645
+ */
1646
+ set_software(software: string | null): void
1647
+ /**
1648
+ * This function will assign a media type to a stream. The only values
1649
+ * that can be used to produce a valid SDP are: "audio", "video",
1650
+ * "text", "application", "image" and "message".
1651
+ *
1652
+ * This is only useful when parsing and generating an SDP of the
1653
+ * candidates.
1654
+ *
1655
+ * <para>See also: nice_agent_generate_local_sdp()</para>
1656
+ * <para>See also: nice_agent_parse_remote_sdp()</para>
1657
+ * <para>See also: nice_agent_get_stream_name()</para>
1658
+ * @param stream_id The ID of the stream to change
1659
+ * @param name The new name of the stream or %NULL
1660
+ * @returns %TRUE if the name has been set. %FALSE in case of error (invalid stream or duplicate name).
1661
+ */
1662
+ set_stream_name(stream_id: number, name: string | null): boolean
1663
+ /**
1664
+ * Sets the IP_TOS and/or IPV6_TCLASS field on the stream's sockets' options
1665
+ * @param stream_id The ID of the stream
1666
+ * @param tos The ToS to set
1667
+ */
1668
+ set_stream_tos(stream_id: number, tos: number): void
1669
+
1670
+ // Own signals of Nice-0.1.Nice.Agent
1671
+
1672
+ connect(sigName: "candidate-gathering-done", callback: Agent.CandidateGatheringDoneSignalCallback): number
1673
+ connect_after(sigName: "candidate-gathering-done", callback: Agent.CandidateGatheringDoneSignalCallback): number
1674
+ emit(sigName: "candidate-gathering-done", stream_id: number, ...args: any[]): void
1675
+ connect(sigName: "component-state-changed", callback: Agent.ComponentStateChangedSignalCallback): number
1676
+ connect_after(sigName: "component-state-changed", callback: Agent.ComponentStateChangedSignalCallback): number
1677
+ emit(sigName: "component-state-changed", stream_id: number, component_id: number, state: number, ...args: any[]): void
1678
+ connect(sigName: "initial-binding-request-received", callback: Agent.InitialBindingRequestReceivedSignalCallback): number
1679
+ connect_after(sigName: "initial-binding-request-received", callback: Agent.InitialBindingRequestReceivedSignalCallback): number
1680
+ emit(sigName: "initial-binding-request-received", stream_id: number, ...args: any[]): void
1681
+ connect(sigName: "new-candidate", callback: Agent.NewCandidateSignalCallback): number
1682
+ connect_after(sigName: "new-candidate", callback: Agent.NewCandidateSignalCallback): number
1683
+ emit(sigName: "new-candidate", stream_id: number, component_id: number, foundation: string | null, ...args: any[]): void
1684
+ connect(sigName: "new-candidate-full", callback: Agent.NewCandidateFullSignalCallback): number
1685
+ connect_after(sigName: "new-candidate-full", callback: Agent.NewCandidateFullSignalCallback): number
1686
+ emit(sigName: "new-candidate-full", candidate: Candidate, ...args: any[]): void
1687
+ connect(sigName: "new-remote-candidate", callback: Agent.NewRemoteCandidateSignalCallback): number
1688
+ connect_after(sigName: "new-remote-candidate", callback: Agent.NewRemoteCandidateSignalCallback): number
1689
+ emit(sigName: "new-remote-candidate", stream_id: number, component_id: number, foundation: string | null, ...args: any[]): void
1690
+ connect(sigName: "new-remote-candidate-full", callback: Agent.NewRemoteCandidateFullSignalCallback): number
1691
+ connect_after(sigName: "new-remote-candidate-full", callback: Agent.NewRemoteCandidateFullSignalCallback): number
1692
+ emit(sigName: "new-remote-candidate-full", candidate: Candidate, ...args: any[]): void
1693
+ connect(sigName: "new-selected-pair", callback: Agent.NewSelectedPairSignalCallback): number
1694
+ connect_after(sigName: "new-selected-pair", callback: Agent.NewSelectedPairSignalCallback): number
1695
+ emit(sigName: "new-selected-pair", stream_id: number, component_id: number, lfoundation: string | null, rfoundation: string | null, ...args: any[]): void
1696
+ connect(sigName: "new-selected-pair-full", callback: Agent.NewSelectedPairFullSignalCallback): number
1697
+ connect_after(sigName: "new-selected-pair-full", callback: Agent.NewSelectedPairFullSignalCallback): number
1698
+ emit(sigName: "new-selected-pair-full", stream_id: number, component_id: number, lcandidate: Candidate, rcandidate: Candidate, ...args: any[]): void
1699
+ connect(sigName: "reliable-transport-writable", callback: Agent.ReliableTransportWritableSignalCallback): number
1700
+ connect_after(sigName: "reliable-transport-writable", callback: Agent.ReliableTransportWritableSignalCallback): number
1701
+ emit(sigName: "reliable-transport-writable", stream_id: number, component_id: number, ...args: any[]): void
1702
+ connect(sigName: "streams-removed", callback: Agent.StreamsRemovedSignalCallback): number
1703
+ connect_after(sigName: "streams-removed", callback: Agent.StreamsRemovedSignalCallback): number
1704
+ emit(sigName: "streams-removed", stream_ids: number[], ...args: any[]): void
1705
+
1706
+ // Class property signals of Nice-0.1.Nice.Agent
1707
+
1708
+ connect(sigName: "notify::bytestream-tcp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1709
+ connect_after(sigName: "notify::bytestream-tcp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1710
+ emit(sigName: "notify::bytestream-tcp", ...args: any[]): void
1711
+ connect(sigName: "notify::compatibility", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1712
+ connect_after(sigName: "notify::compatibility", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1713
+ emit(sigName: "notify::compatibility", ...args: any[]): void
1714
+ connect(sigName: "notify::consent-freshness", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1715
+ connect_after(sigName: "notify::consent-freshness", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1716
+ emit(sigName: "notify::consent-freshness", ...args: any[]): void
1717
+ connect(sigName: "notify::controlling-mode", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1718
+ connect_after(sigName: "notify::controlling-mode", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1719
+ emit(sigName: "notify::controlling-mode", ...args: any[]): void
1720
+ connect(sigName: "notify::force-relay", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1721
+ connect_after(sigName: "notify::force-relay", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1722
+ emit(sigName: "notify::force-relay", ...args: any[]): void
1723
+ connect(sigName: "notify::full-mode", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1724
+ connect_after(sigName: "notify::full-mode", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1725
+ emit(sigName: "notify::full-mode", ...args: any[]): void
1726
+ connect(sigName: "notify::ice-tcp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1727
+ connect_after(sigName: "notify::ice-tcp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1728
+ emit(sigName: "notify::ice-tcp", ...args: any[]): void
1729
+ connect(sigName: "notify::ice-trickle", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1730
+ connect_after(sigName: "notify::ice-trickle", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1731
+ emit(sigName: "notify::ice-trickle", ...args: any[]): void
1732
+ connect(sigName: "notify::ice-udp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1733
+ connect_after(sigName: "notify::ice-udp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1734
+ emit(sigName: "notify::ice-udp", ...args: any[]): void
1735
+ connect(sigName: "notify::idle-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1736
+ connect_after(sigName: "notify::idle-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1737
+ emit(sigName: "notify::idle-timeout", ...args: any[]): void
1738
+ connect(sigName: "notify::keepalive-conncheck", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1739
+ connect_after(sigName: "notify::keepalive-conncheck", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1740
+ emit(sigName: "notify::keepalive-conncheck", ...args: any[]): void
1741
+ connect(sigName: "notify::main-context", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1742
+ connect_after(sigName: "notify::main-context", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1743
+ emit(sigName: "notify::main-context", ...args: any[]): void
1744
+ connect(sigName: "notify::max-connectivity-checks", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1745
+ connect_after(sigName: "notify::max-connectivity-checks", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1746
+ emit(sigName: "notify::max-connectivity-checks", ...args: any[]): void
1747
+ connect(sigName: "notify::proxy-ip", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1748
+ connect_after(sigName: "notify::proxy-ip", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1749
+ emit(sigName: "notify::proxy-ip", ...args: any[]): void
1750
+ connect(sigName: "notify::proxy-password", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1751
+ connect_after(sigName: "notify::proxy-password", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1752
+ emit(sigName: "notify::proxy-password", ...args: any[]): void
1753
+ connect(sigName: "notify::proxy-port", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1754
+ connect_after(sigName: "notify::proxy-port", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1755
+ emit(sigName: "notify::proxy-port", ...args: any[]): void
1756
+ connect(sigName: "notify::proxy-type", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1757
+ connect_after(sigName: "notify::proxy-type", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1758
+ emit(sigName: "notify::proxy-type", ...args: any[]): void
1759
+ connect(sigName: "notify::proxy-username", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1760
+ connect_after(sigName: "notify::proxy-username", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1761
+ emit(sigName: "notify::proxy-username", ...args: any[]): void
1762
+ connect(sigName: "notify::reliable", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1763
+ connect_after(sigName: "notify::reliable", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1764
+ emit(sigName: "notify::reliable", ...args: any[]): void
1765
+ connect(sigName: "notify::stun-initial-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1766
+ connect_after(sigName: "notify::stun-initial-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1767
+ emit(sigName: "notify::stun-initial-timeout", ...args: any[]): void
1768
+ connect(sigName: "notify::stun-max-retransmissions", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1769
+ connect_after(sigName: "notify::stun-max-retransmissions", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1770
+ emit(sigName: "notify::stun-max-retransmissions", ...args: any[]): void
1771
+ connect(sigName: "notify::stun-pacing-timer", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1772
+ connect_after(sigName: "notify::stun-pacing-timer", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1773
+ emit(sigName: "notify::stun-pacing-timer", ...args: any[]): void
1774
+ connect(sigName: "notify::stun-reliable-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1775
+ connect_after(sigName: "notify::stun-reliable-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1776
+ emit(sigName: "notify::stun-reliable-timeout", ...args: any[]): void
1777
+ connect(sigName: "notify::stun-server", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1778
+ connect_after(sigName: "notify::stun-server", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1779
+ emit(sigName: "notify::stun-server", ...args: any[]): void
1780
+ connect(sigName: "notify::stun-server-port", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1781
+ connect_after(sigName: "notify::stun-server-port", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1782
+ emit(sigName: "notify::stun-server-port", ...args: any[]): void
1783
+ connect(sigName: "notify::support-renomination", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1784
+ connect_after(sigName: "notify::support-renomination", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1785
+ emit(sigName: "notify::support-renomination", ...args: any[]): void
1786
+ connect(sigName: "notify::upnp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1787
+ connect_after(sigName: "notify::upnp", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1788
+ emit(sigName: "notify::upnp", ...args: any[]): void
1789
+ connect(sigName: "notify::upnp-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1790
+ connect_after(sigName: "notify::upnp-timeout", callback: (($obj: Agent, pspec: GObject.ParamSpec) => void)): number
1791
+ emit(sigName: "notify::upnp-timeout", ...args: any[]): void
1792
+ connect(sigName: string, callback: (...args: any[]) => void): number
1793
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
1794
+ emit(sigName: string, ...args: any[]): void
1795
+ disconnect(id: number): void
1796
+ }
1797
+
1798
+ /**
1799
+ * The #NiceAgent is the main GObject of the libnice library and represents
1800
+ * the ICE agent.
1801
+ * @class
1802
+ */
1803
+ class Agent extends GObject.Object {
1804
+
1805
+ // Own properties of Nice-0.1.Nice.Agent
1806
+
1807
+ static name: string
1808
+ static $gtype: GObject.GType<Agent>
1809
+
1810
+ // Constructors of Nice-0.1.Nice.Agent
1811
+
1812
+ constructor(config?: Agent.ConstructorProperties)
1813
+ /**
1814
+ * Create a new #NiceAgent.
1815
+ * The returned object must be freed with g_object_unref()
1816
+ * @constructor
1817
+ * @param ctx The Glib Mainloop Context to use for timers
1818
+ * @param compat The compatibility mode of the agent
1819
+ * @returns The new agent GObject
1820
+ */
1821
+ constructor(ctx: GLib.MainContext, compat: Compatibility)
1822
+ /**
1823
+ * Create a new #NiceAgent.
1824
+ * The returned object must be freed with g_object_unref()
1825
+ * @constructor
1826
+ * @param ctx The Glib Mainloop Context to use for timers
1827
+ * @param compat The compatibility mode of the agent
1828
+ * @returns The new agent GObject
1829
+ */
1830
+ static new(ctx: GLib.MainContext, compat: Compatibility): Agent
1831
+ /**
1832
+ * Create a new #NiceAgent with parameters that must be be defined at
1833
+ * construction time.
1834
+ * The returned object must be freed with g_object_unref()
1835
+ * <para> See also: #NiceNominationMode and #NiceAgentOption</para>
1836
+ * @constructor
1837
+ * @param ctx The Glib Mainloop Context to use for timers
1838
+ * @param compat The compatibility mode of the agent
1839
+ * @param flags Flags to set the properties
1840
+ * @returns The new agent GObject
1841
+ */
1842
+ static new_full(ctx: GLib.MainContext, compat: Compatibility, flags: AgentOption): Agent
1843
+ /**
1844
+ * Create a new #NiceAgent in reliable mode. If the connectivity is established
1845
+ * through ICE-UDP, then a #PseudoTcpSocket will be transparently used to
1846
+ * ensure reliability of the messages.
1847
+ * The returned object must be freed with g_object_unref()
1848
+ * <para> See also: #NiceAgent::reliable-transport-writable </para>
1849
+ * @constructor
1850
+ * @param ctx The Glib Mainloop Context to use for timers
1851
+ * @param compat The compatibility mode of the agent
1852
+ * @returns The new agent GObject
1853
+ */
1854
+ static new_reliable(ctx: GLib.MainContext, compat: Compatibility): Agent
1855
+ _init(config?: Agent.ConstructorProperties): void
1856
+ }
1857
+
1858
+ module PseudoTcpSocket {
1859
+
1860
+ // Constructor properties interface
1861
+
1862
+ interface ConstructorProperties extends GObject.Object.ConstructorProperties {
1863
+
1864
+ // Own constructor properties of Nice-0.1.Nice.PseudoTcpSocket
1865
+
1866
+ ack_delay?: number | null
1867
+ callbacks?: any | null
1868
+ conversation?: number | null
1869
+ no_delay?: boolean | null
1870
+ rcv_buf?: number | null
1871
+ snd_buf?: number | null
1872
+ /**
1873
+ * Whether to support the FIN–ACK extension to the pseudo-TCP protocol for
1874
+ * this socket. The extension is only compatible with other libnice pseudo-TCP
1875
+ * stacks, and not with Jingle pseudo-TCP stacks. If enabled, support is
1876
+ * negotiatied on connection setup, so it is safe for a #PseudoTcpSocket with
1877
+ * support enabled to be used with one with it disabled, or with a Jingle
1878
+ * pseudo-TCP socket which doesn’t support it at all.
1879
+ *
1880
+ * Support is enabled by default.
1881
+ */
1882
+ support_fin_ack?: boolean | null
1883
+ }
1884
+
1885
+ }
1886
+
1887
+ interface PseudoTcpSocket {
1888
+
1889
+ // Own properties of Nice-0.1.Nice.PseudoTcpSocket
1890
+
1891
+ ack_delay: number
1892
+ callbacks: any
1893
+ readonly conversation: number
1894
+ no_delay: boolean
1895
+ rcv_buf: number
1896
+ snd_buf: number
1897
+ readonly state: number
1898
+ /**
1899
+ * Whether to support the FIN–ACK extension to the pseudo-TCP protocol for
1900
+ * this socket. The extension is only compatible with other libnice pseudo-TCP
1901
+ * stacks, and not with Jingle pseudo-TCP stacks. If enabled, support is
1902
+ * negotiatied on connection setup, so it is safe for a #PseudoTcpSocket with
1903
+ * support enabled to be used with one with it disabled, or with a Jingle
1904
+ * pseudo-TCP socket which doesn’t support it at all.
1905
+ *
1906
+ * Support is enabled by default.
1907
+ */
1908
+ readonly support_fin_ack: boolean
1909
+
1910
+ // Owm methods of Nice-0.1.Nice.PseudoTcpSocket
1911
+
1912
+ /**
1913
+ * Returns if there is space in the send buffer to send any data.
1914
+ * @returns %TRUE if data can be sent, %FALSE otherwise
1915
+ */
1916
+ can_send(): boolean
1917
+ /**
1918
+ * Close the socket for sending. If `force` is set to %FALSE, the socket will
1919
+ * finish sending pending data before closing. If it is set to %TRUE, the socket
1920
+ * will discard pending data and close the connection immediately (sending a TCP
1921
+ * RST segment).
1922
+ *
1923
+ * The socket will be closed in both directions – sending and receiving – and
1924
+ * any pending received data must be read before calling this function, by
1925
+ * calling pseudo_tcp_socket_recv() until it blocks. If any pending data is in
1926
+ * the receive buffer when pseudo_tcp_socket_close() is called, a TCP RST
1927
+ * segment will be sent to the peer to notify it of the data loss.
1928
+ *
1929
+ * <note>
1930
+ * <para>
1931
+ * The %PseudoTcpCallbacks:PseudoTcpClosed callback will not be called once
1932
+ * the socket gets closed. It is only used for aborted connection.
1933
+ * Instead, the socket gets closed when the pseudo_tcp_socket_get_next_clock()
1934
+ * function returns FALSE.
1935
+ * </para>
1936
+ * </note>
1937
+ *
1938
+ * <para> See also: pseudo_tcp_socket_get_next_clock() </para>
1939
+ * @param force %TRUE to close the socket forcefully, %FALSE to close it gracefully
1940
+ */
1941
+ close(force: boolean): void
1942
+ /**
1943
+ * Connects the #PseudoTcpSocket to the peer with the same conversation id.
1944
+ * The connection will only be successful after the
1945
+ * %PseudoTcpCallbacks:PseudoTcpOpened callback is called
1946
+ * @returns %TRUE on success, %FALSE on failure (not in %TCP_LISTEN state) <para> See also: pseudo_tcp_socket_get_error() </para>
1947
+ */
1948
+ connect(): boolean
1949
+ /**
1950
+ * Gets the number of bytes of data in the buffer that can be read without
1951
+ * receiving more packets from the network.
1952
+ * @returns The number of bytes or -1 if the connection is not established
1953
+ */
1954
+ get_available_bytes(): number
1955
+ /**
1956
+ * Gets the number of bytes of space available in the transmission buffer.
1957
+ * @returns The number of bytes, or 0 if the connection is not established.
1958
+ */
1959
+ get_available_send_space(): number
1960
+ /**
1961
+ * Return the last encountered error.
1962
+ *
1963
+ * <note>
1964
+ * <para>
1965
+ * The return value can be :
1966
+ * <para>
1967
+ * EINVAL (for pseudo_tcp_socket_connect()).
1968
+ * </para>
1969
+ * <para>
1970
+ * EWOULDBLOCK or ENOTCONN (for pseudo_tcp_socket_recv() and
1971
+ * pseudo_tcp_socket_send()).
1972
+ * </para>
1973
+ * </para>
1974
+ * </note>
1975
+ * @returns The error code <para> See also: pseudo_tcp_socket_connect() </para> <para> See also: pseudo_tcp_socket_recv() </para> <para> See also: pseudo_tcp_socket_send() </para>
1976
+ */
1977
+ get_error(): number
1978
+ /**
1979
+ * Call this to determine the timeout needed before the next time call
1980
+ * to pseudo_tcp_socket_notify_clock() should be made.
1981
+ * @param timeout A pointer to be filled with the new timeout.
1982
+ * @returns %TRUE if @timeout was filled, %FALSE if the socket is closed and ready to be destroyed. <para> See also: pseudo_tcp_socket_notify_clock() </para>
1983
+ */
1984
+ get_next_clock(timeout: number): boolean
1985
+ /**
1986
+ * Gets whether the socket is closed, with the shutdown handshake completed,
1987
+ * and both peers no longer able to read or write data to the connection.
1988
+ * @returns %TRUE if the socket is closed in both directions, %FALSE otherwise
1989
+ */
1990
+ is_closed(): boolean
1991
+ /**
1992
+ * Gets whether the socket has been closed on the remote peer’s side of the
1993
+ * connection (i.e. whether pseudo_tcp_socket_close() has been called there).
1994
+ * This is guaranteed to return %TRUE if pseudo_tcp_socket_is_closed() returns
1995
+ * %TRUE. It will not return %TRUE after pseudo_tcp_socket_close() is called
1996
+ * until a FIN segment is received from the remote peer.
1997
+ * @returns %TRUE if the remote peer has closed its side of the connection, %FALSE otherwise
1998
+ */
1999
+ is_closed_remotely(): boolean
2000
+ /**
2001
+ * Start the processing of receiving data, pending data or syn/acks.
2002
+ * Call this based on timeout value returned by
2003
+ * pseudo_tcp_socket_get_next_clock().
2004
+ * It's ok to call this too frequently.
2005
+ *
2006
+ * <para> See also: pseudo_tcp_socket_get_next_clock() </para>
2007
+ */
2008
+ notify_clock(): void
2009
+ /**
2010
+ * Notify the #PseudoTcpSocket that a new message has arrived, and enqueue the
2011
+ * data in its buffers to the #PseudoTcpSocket’s receive buffer.
2012
+ * @param message A #NiceInputMessage containing the received data.
2013
+ * @returns %TRUE if the packet was processed successfully, %FALSE otherwise
2014
+ */
2015
+ notify_message(message: InputMessage): boolean
2016
+ /**
2017
+ * Set the MTU of the socket
2018
+ * @param mtu The new MTU of the socket
2019
+ */
2020
+ notify_mtu(mtu: number): void
2021
+ /**
2022
+ * Notify the #PseudoTcpSocket when a new packet arrives
2023
+ * @param buffer The buffer containing the received data
2024
+ * @param len The length of `buffer`
2025
+ * @returns %TRUE if the packet was processed successfully, %FALSE otherwise
2026
+ */
2027
+ notify_packet(buffer: string | null, len: number): boolean
2028
+ /**
2029
+ * Receive data from the socket.
2030
+ *
2031
+ * <note>
2032
+ * <para>
2033
+ * Only call this on the %PseudoTcpCallbacks:PseudoTcpReadable callback.
2034
+ * </para>
2035
+ * <para>
2036
+ * This function should be called in a loop. If this function does not
2037
+ * return -1 with EWOULDBLOCK as the error, the
2038
+ * %PseudoTcpCallbacks:PseudoTcpReadable callback will not be called again.
2039
+ * </para>
2040
+ * </note>
2041
+ * @param buffer The buffer to fill with received data
2042
+ * @param len The length of `buffer`
2043
+ * @returns The number of bytes received or -1 in case of error <para> See also: pseudo_tcp_socket_get_error() </para>
2044
+ */
2045
+ recv(buffer: string | null, len: number): number
2046
+ /**
2047
+ * Send data on the socket.
2048
+ *
2049
+ * <note>
2050
+ * <para>
2051
+ * If this function return -1 with EWOULDBLOCK as the error, or if the return
2052
+ * value is lower than `len,` then the %PseudoTcpCallbacks:PseudoTcpWritable
2053
+ * callback will be called when the socket will become writable.
2054
+ * </para>
2055
+ * </note>
2056
+ * @param buffer The buffer with data to send
2057
+ * @param len The length of `buffer`
2058
+ * @returns The number of bytes sent or -1 in case of error <para> See also: pseudo_tcp_socket_get_error() </para>
2059
+ */
2060
+ send(buffer: string | null, len: number): number
2061
+ /**
2062
+ * Sets the current monotonic time to be used by the TCP socket when calculating
2063
+ * timeouts and expiry times. If this function is not called, or is called with
2064
+ * `current_time` as zero, g_get_monotonic_time() will be used. Otherwise, the
2065
+ * specified `current_time` will be used until it is updated by calling this
2066
+ * function again.
2067
+ *
2068
+ * This function is intended for testing only, and should not be used in
2069
+ * production code.
2070
+ * @param current_time Current monotonic time, in milliseconds; or zero to use the system monotonic clock.
2071
+ */
2072
+ set_time(current_time: number): void
2073
+ /**
2074
+ * Shut down sending, receiving, or both on the socket, depending on the value
2075
+ * of `how`. The behaviour of pseudo_tcp_socket_send() and
2076
+ * pseudo_tcp_socket_recv() will immediately change after this function returns
2077
+ * (depending on the value of `how)`, though the socket may continue to process
2078
+ * network traffic in the background even if sending or receiving data is
2079
+ * forbidden.
2080
+ *
2081
+ * This is equivalent to the POSIX shutdown() function. Setting `how` to
2082
+ * %PSEUDO_TCP_SHUTDOWN_RDWR is equivalent to calling pseudo_tcp_socket_close().
2083
+ * @param how The directions of the connection to shut down.
2084
+ */
2085
+ shutdown(how: PseudoTcpShutdown): void
2086
+
2087
+ // Class property signals of Nice-0.1.Nice.PseudoTcpSocket
2088
+
2089
+ connect(sigName: "notify::ack-delay", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2090
+ connect_after(sigName: "notify::ack-delay", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2091
+ emit(sigName: "notify::ack-delay", ...args: any[]): void
2092
+ connect(sigName: "notify::callbacks", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2093
+ connect_after(sigName: "notify::callbacks", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2094
+ emit(sigName: "notify::callbacks", ...args: any[]): void
2095
+ connect(sigName: "notify::conversation", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2096
+ connect_after(sigName: "notify::conversation", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2097
+ emit(sigName: "notify::conversation", ...args: any[]): void
2098
+ connect(sigName: "notify::no-delay", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2099
+ connect_after(sigName: "notify::no-delay", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2100
+ emit(sigName: "notify::no-delay", ...args: any[]): void
2101
+ connect(sigName: "notify::rcv-buf", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2102
+ connect_after(sigName: "notify::rcv-buf", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2103
+ emit(sigName: "notify::rcv-buf", ...args: any[]): void
2104
+ connect(sigName: "notify::snd-buf", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2105
+ connect_after(sigName: "notify::snd-buf", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2106
+ emit(sigName: "notify::snd-buf", ...args: any[]): void
2107
+ connect(sigName: "notify::state", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2108
+ connect_after(sigName: "notify::state", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2109
+ emit(sigName: "notify::state", ...args: any[]): void
2110
+ connect(sigName: "notify::support-fin-ack", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2111
+ connect_after(sigName: "notify::support-fin-ack", callback: (($obj: PseudoTcpSocket, pspec: GObject.ParamSpec) => void)): number
2112
+ emit(sigName: "notify::support-fin-ack", ...args: any[]): void
2113
+ connect(sigName: string, callback: (...args: any[]) => void): number
2114
+ connect_after(sigName: string, callback: (...args: any[]) => void): number
2115
+ emit(sigName: string, ...args: any[]): void
2116
+ disconnect(id: number): void
2117
+ }
2118
+
2119
+ /**
2120
+ * The #PseudoTcpSocket is the GObject implementing the Pseudo TCP Socket
2121
+ * @class
2122
+ */
2123
+ class PseudoTcpSocket extends GObject.Object {
2124
+
2125
+ // Own properties of Nice-0.1.Nice.PseudoTcpSocket
2126
+
2127
+ static name: string
2128
+ static $gtype: GObject.GType<PseudoTcpSocket>
2129
+
2130
+ // Constructors of Nice-0.1.Nice.PseudoTcpSocket
2131
+
2132
+ constructor(config?: PseudoTcpSocket.ConstructorProperties)
2133
+ /**
2134
+ * Creates a new #PseudoTcpSocket for the specified conversation
2135
+ *
2136
+ * <note>
2137
+ * <para>
2138
+ * The `callbacks` must be non-NULL, in order to get notified of packets the
2139
+ * socket needs to send.
2140
+ * </para>
2141
+ * <para>
2142
+ * If the `callbacks` structure was dynamicly allocated, it can be freed
2143
+ * after the call `pseudo_tcp_socket_new`
2144
+ * </para>
2145
+ * </note>
2146
+ * @constructor
2147
+ * @param conversation The conversation id for the socket.
2148
+ * @param callbacks A pointer to the #PseudoTcpCallbacks structure for getting notified of the #PseudoTcpSocket events.
2149
+ * @returns The new #PseudoTcpSocket object, %NULL on error
2150
+ */
2151
+ constructor(conversation: number, callbacks: PseudoTcpCallbacks)
2152
+ /**
2153
+ * Creates a new #PseudoTcpSocket for the specified conversation
2154
+ *
2155
+ * <note>
2156
+ * <para>
2157
+ * The `callbacks` must be non-NULL, in order to get notified of packets the
2158
+ * socket needs to send.
2159
+ * </para>
2160
+ * <para>
2161
+ * If the `callbacks` structure was dynamicly allocated, it can be freed
2162
+ * after the call `pseudo_tcp_socket_new`
2163
+ * </para>
2164
+ * </note>
2165
+ * @constructor
2166
+ * @param conversation The conversation id for the socket.
2167
+ * @param callbacks A pointer to the #PseudoTcpCallbacks structure for getting notified of the #PseudoTcpSocket events.
2168
+ * @returns The new #PseudoTcpSocket object, %NULL on error
2169
+ */
2170
+ static new(conversation: number, callbacks: PseudoTcpCallbacks): PseudoTcpSocket
2171
+ _init(config?: PseudoTcpSocket.ConstructorProperties): void
2172
+ }
2173
+
2174
+ interface Address {
2175
+
2176
+ // Owm methods of Nice-0.1.Nice.Address
2177
+
2178
+ /**
2179
+ * Fills the sockaddr structure `sin` with the address contained in `addr`
2180
+ * @param sin The sockaddr to fill
2181
+ */
2182
+ copy_to_sockaddr(sin: any | null): void
2183
+ /**
2184
+ * Compares two #NiceAddress structures to see if they contain the same address
2185
+ * and the same port.
2186
+ * @param b Second #NiceAddress to compare
2187
+ * @returns %TRUE if @a and @b are the same address, %FALSE if they are different
2188
+ */
2189
+ equal(b: Address): boolean
2190
+ /**
2191
+ * Compares two #NiceAddress structures to see if they contain the same address,
2192
+ * ignoring the port.
2193
+ * @param b Second #NiceAddress to compare
2194
+ * @returns %TRUE if @a and @b are the same address, %FALSE if they are different
2195
+ */
2196
+ equal_no_port(b: Address): boolean
2197
+ /**
2198
+ * Frees a #NiceAddress created with nice_address_new() or nice_address_dup()
2199
+ */
2200
+ free(): void
2201
+ /**
2202
+ * Retreive the port of `addr`
2203
+ * @returns The port of @addr
2204
+ */
2205
+ get_port(): number
2206
+ /**
2207
+ * Initialize a #NiceAddress into an undefined address
2208
+ */
2209
+ init(): void
2210
+ /**
2211
+ * Returns the IP version of the address
2212
+ * @returns 4 for IPv4, 6 for IPv6 and 0 for undefined address
2213
+ */
2214
+ ip_version(): number
2215
+ /**
2216
+ * Verifies if the address in `addr` is a private address or not
2217
+ * @returns %TRUE if @addr is a private address, %FALSE otherwise
2218
+ */
2219
+ is_private(): boolean
2220
+ /**
2221
+ * Validate whether the #NiceAddress `addr` is a valid IPv4 or IPv6 address
2222
+ * @returns %TRUE if @addr is valid, %FALSE otherwise
2223
+ */
2224
+ is_valid(): boolean
2225
+ /**
2226
+ * Sets an IPv4 or IPv6 address from the sockaddr structure `sin`
2227
+ * @param sin The sockaddr to set
2228
+ */
2229
+ set_from_sockaddr(sin: any | null): void
2230
+ /**
2231
+ * Sets an IPv4 or IPv6 address from the string `str`
2232
+ * @param str The string to set
2233
+ * @returns %TRUE if success, %FALSE on error
2234
+ */
2235
+ set_from_string(str: string | null): boolean
2236
+ /**
2237
+ * Set `addr` to an IPv4 address using the data from `addr_ipv4`
2238
+ *
2239
+ * <note>
2240
+ * <para>
2241
+ * This function will reset the port to 0, so make sure you call it before
2242
+ * nice_address_set_port()
2243
+ * </para>
2244
+ * </note>
2245
+ * @param addr_ipv4 The IPv4 address
2246
+ */
2247
+ set_ipv4(addr_ipv4: number): void
2248
+ /**
2249
+ * Set `addr` to an IPv6 address using the data from `addr_ipv6`
2250
+ *
2251
+ * <note>
2252
+ * <para>
2253
+ * This function will reset the port to 0, so make sure you call it before
2254
+ * nice_address_set_port()
2255
+ * </para>
2256
+ * </note>
2257
+ * @param addr_ipv6 The IPv6 address
2258
+ */
2259
+ set_ipv6(addr_ipv6: number): void
2260
+ /**
2261
+ * Set the port of `addr` to `port`
2262
+ * @param port The port to set
2263
+ */
2264
+ set_port(port: number): void
2265
+ /**
2266
+ * Transforms the address `addr` into a human readable string
2267
+ * @param dst The string to fill
2268
+ */
2269
+ to_string(dst: string | null): void
2270
+ }
2271
+
2272
+ /**
2273
+ * The #NiceAddress structure that represents an IPv4 or IPv6 address.
2274
+ * @record
2275
+ */
2276
+ class Address {
2277
+
2278
+ // Own properties of Nice-0.1.Nice.Address
2279
+
2280
+ static name: string
2281
+ }
2282
+
2283
+ interface AgentClass {
2284
+
2285
+ // Own fields of Nice-0.1.Nice.AgentClass
2286
+
2287
+ parent_class: GObject.ObjectClass
2288
+ }
2289
+
2290
+ abstract class AgentClass {
2291
+
2292
+ // Own properties of Nice-0.1.Nice.AgentClass
2293
+
2294
+ static name: string
2295
+ }
2296
+
2297
+ interface Candidate {
2298
+
2299
+ // Own fields of Nice-0.1.Nice.Candidate
2300
+
2301
+ /**
2302
+ * The type of candidate
2303
+ * @field
2304
+ */
2305
+ type: CandidateType
2306
+ /**
2307
+ * The transport being used for the candidate
2308
+ * @field
2309
+ */
2310
+ transport: CandidateTransport
2311
+ /**
2312
+ * The #NiceAddress of the candidate
2313
+ * @field
2314
+ */
2315
+ addr: Address
2316
+ /**
2317
+ * The #NiceAddress of the base address used by the candidate
2318
+ * @field
2319
+ */
2320
+ base_addr: Address
2321
+ /**
2322
+ * The priority of the candidate <emphasis> see note </emphasis>
2323
+ * @field
2324
+ */
2325
+ priority: number
2326
+ /**
2327
+ * The ID of the stream to which belongs the candidate
2328
+ * @field
2329
+ */
2330
+ stream_id: number
2331
+ /**
2332
+ * The ID of the component to which belongs the candidate
2333
+ * @field
2334
+ */
2335
+ component_id: number
2336
+ /**
2337
+ * The foundation of the candidate
2338
+ * @field
2339
+ */
2340
+ foundation: number[]
2341
+ /**
2342
+ * The candidate-specific username to use (overrides the one set
2343
+ * by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())
2344
+ * @field
2345
+ */
2346
+ username: string | null
2347
+ /**
2348
+ * The candidate-specific password to use (overrides the one set
2349
+ * by nice_agent_set_local_credentials() or nice_agent_set_remote_credentials())
2350
+ * @field
2351
+ */
2352
+ password: string | null
2353
+
2354
+ // Owm methods of Nice-0.1.Nice.Candidate
2355
+
2356
+ /**
2357
+ * Makes a copy of a #NiceCandidate
2358
+ * @returns A new #NiceCandidate, a copy of @candidate
2359
+ */
2360
+ copy(): Candidate
2361
+ /**
2362
+ * Verifies that the candidates point to the same place, meaning they have
2363
+ * the same transport and the same address. It ignores all other aspects.
2364
+ * @param candidate2 A candidate
2365
+ * @returns %TRUE if the candidates point to the same place
2366
+ */
2367
+ equal_target(candidate2: Candidate): boolean
2368
+ /**
2369
+ * Frees a #NiceCandidate
2370
+ */
2371
+ free(): void
2372
+ }
2373
+
2374
+ /**
2375
+ * A structure to represent an ICE candidate
2376
+ * <note>
2377
+ * <para>
2378
+ * The `priority` is an integer as specified in the ICE draft 19. If you are
2379
+ * using the MSN or the GOOGLE compatibility mode (which are based on ICE
2380
+ * draft 6, which uses a floating point qvalue as priority), then the `priority`
2381
+ * value will represent the qvalue multiplied by 1000.
2382
+ * </para>
2383
+ * </note>
2384
+ * @record
2385
+ */
2386
+ class Candidate {
2387
+
2388
+ // Own properties of Nice-0.1.Nice.Candidate
2389
+
2390
+ static name: string
2391
+
2392
+ // Constructors of Nice-0.1.Nice.Candidate
2393
+
2394
+ /**
2395
+ * Creates a new candidate. Must be freed with nice_candidate_free()
2396
+ * @constructor
2397
+ * @param type The #NiceCandidateType of the candidate to create
2398
+ * @returns A new #NiceCandidate
2399
+ */
2400
+ constructor(type: CandidateType)
2401
+ /**
2402
+ * Creates a new candidate. Must be freed with nice_candidate_free()
2403
+ * @constructor
2404
+ * @param type The #NiceCandidateType of the candidate to create
2405
+ * @returns A new #NiceCandidate
2406
+ */
2407
+ static new(type: CandidateType): Candidate
2408
+ /**
2409
+ * Useful for debugging functions, just returns a static string with the
2410
+ * candidate transport.
2411
+ * @param transport a #NiceCandidateTransport
2412
+ * @returns a static string with the candidate transport
2413
+ */
2414
+ static transport_to_string(transport: CandidateTransport): string | null
2415
+ /**
2416
+ * Useful for debugging functions, just returns a static string with the
2417
+ * candidate type.
2418
+ * @param type a #NiceCandidateType
2419
+ * @returns a static string with the candidate type
2420
+ */
2421
+ static type_to_string(type: CandidateType): string | null
2422
+ }
2423
+
2424
+ interface InputMessage {
2425
+
2426
+ // Own fields of Nice-0.1.Nice.InputMessage
2427
+
2428
+ /**
2429
+ * unowned array of #GInputVector buffers to
2430
+ * store data in for this message
2431
+ * @field
2432
+ */
2433
+ buffers: Gio.InputVector[]
2434
+ /**
2435
+ * number of #GInputVectors in `buffers,` or -1 to indicate `buffers`
2436
+ * is %NULL-terminated
2437
+ * @field
2438
+ */
2439
+ n_buffers: number
2440
+ /**
2441
+ * return location to store the address of the peer who
2442
+ * transmitted the message, or %NULL
2443
+ * @field
2444
+ */
2445
+ from: Address
2446
+ /**
2447
+ * total number of valid bytes contiguously stored in `buffers`
2448
+ * @field
2449
+ */
2450
+ length: number
2451
+ }
2452
+
2453
+ /**
2454
+ * Represents a single message received off the network. For reliable
2455
+ * connections, this is essentially just an array of buffers (specifically,
2456
+ * `from` can be ignored). for non-reliable connections, it represents a single
2457
+ * packet as received from the OS.
2458
+ *
2459
+ * `n_buffers` may be -1 to indicate that `buffers` is terminated by a
2460
+ * #GInputVector with a %NULL buffer pointer.
2461
+ *
2462
+ * By providing arrays of #NiceInputMessages to functions like
2463
+ * nice_agent_recv_messages(), multiple messages may be received with a single
2464
+ * call, which is more efficient than making multiple calls in a loop. In this
2465
+ * manner, nice_agent_recv_messages() is analogous to recvmmsg(); and
2466
+ * #NiceInputMessage to struct mmsghdr.
2467
+ * @record
2468
+ */
2469
+ class InputMessage {
2470
+
2471
+ // Own properties of Nice-0.1.Nice.InputMessage
2472
+
2473
+ static name: string
2474
+ }
2475
+
2476
+ interface OutputMessage {
2477
+
2478
+ // Own fields of Nice-0.1.Nice.OutputMessage
2479
+
2480
+ /**
2481
+ * unowned array of #GOutputVector buffers
2482
+ * which contain data to transmit for this message
2483
+ * @field
2484
+ */
2485
+ buffers: Gio.OutputVector[]
2486
+ /**
2487
+ * number of #GOutputVectors in `buffers,` or -1 to indicate `buffers`
2488
+ * is %NULL-terminated
2489
+ * @field
2490
+ */
2491
+ n_buffers: number
2492
+ }
2493
+
2494
+ /**
2495
+ * Represents a single message to transmit on the network. For
2496
+ * reliable connections, this is essentially just an array of
2497
+ * buffer. for non-reliable connections, it represents a single packet
2498
+ * to send to the OS.
2499
+ *
2500
+ * `n_buffers` may be -1 to indicate that `buffers` is terminated by a
2501
+ * #GOutputVector with a %NULL buffer pointer.
2502
+ *
2503
+ * By providing arrays of #NiceOutputMessages to functions like
2504
+ * nice_agent_send_messages_nonblocking(), multiple messages may be transmitted
2505
+ * with a single call, which is more efficient than making multiple calls in a
2506
+ * loop. In this manner, nice_agent_send_messages_nonblocking() is analogous to
2507
+ * sendmmsg(); and #NiceOutputMessage to struct mmsghdr.
2508
+ * @record
2509
+ */
2510
+ class OutputMessage {
2511
+
2512
+ // Own properties of Nice-0.1.Nice.OutputMessage
2513
+
2514
+ static name: string
2515
+ }
2516
+
2517
+ interface PseudoTcpCallbacks {
2518
+
2519
+ // Own fields of Nice-0.1.Nice.PseudoTcpCallbacks
2520
+
2521
+ /**
2522
+ * A user defined pointer to be passed to the callbacks
2523
+ * @field
2524
+ */
2525
+ user_data: any
2526
+ PseudoTcpOpened: (tcp: PseudoTcpSocket, data: any) => void
2527
+ PseudoTcpReadable: (tcp: PseudoTcpSocket, data: any) => void
2528
+ PseudoTcpWritable: (tcp: PseudoTcpSocket, data: any) => void
2529
+ PseudoTcpClosed: (tcp: PseudoTcpSocket, error: number, data: any) => void
2530
+ WritePacket: (tcp: PseudoTcpSocket, buffer: string | null, len: number, data: any) => PseudoTcpWriteResult
2531
+ }
2532
+
2533
+ /**
2534
+ * A structure containing callbacks functions that will be called by the
2535
+ * #PseudoTcpSocket when some events happen.
2536
+ * <para> See also: #PseudoTcpWriteResult </para>
2537
+ * @record
2538
+ */
2539
+ class PseudoTcpCallbacks {
2540
+
2541
+ // Own properties of Nice-0.1.Nice.PseudoTcpCallbacks
2542
+
2543
+ static name: string
2544
+ }
2545
+
2546
+ interface PseudoTcpSocketClass {
2547
+ }
2548
+
2549
+ abstract class PseudoTcpSocketClass {
2550
+
2551
+ // Own properties of Nice-0.1.Nice.PseudoTcpSocketClass
2552
+
2553
+ static name: string
2554
+ }
2555
+
2556
+ /**
2557
+ * Name of the imported GIR library
2558
+ * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L188
2559
+ */
2560
+ const __name__: string
2561
+ /**
2562
+ * Version of the imported GIR library
2563
+ * @see https://gitlab.gnome.org/GNOME/gjs/-/blob/master/gi/ns.cpp#L189
2564
+ */
2565
+ const __version__: string
2566
+ }
2567
+
2568
+ export default Nice;
2569
+ // END