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