@gjsify/http2-native 0.4.3 → 0.4.5

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.
@@ -21,9 +21,21 @@
21
21
  <constant name="TYPE_HEADERS" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_HEADERS" value="0x01">
22
22
  <type name="gint" c:type="gint"/>
23
23
  </constant>
24
+ <constant name="TYPE_PRIORITY" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_PRIORITY" value="0x02">
25
+ <type name="gint" c:type="gint"/>
26
+ </constant>
27
+ <constant name="TYPE_RST_STREAM" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_RST_STREAM" value="0x03">
28
+ <type name="gint" c:type="gint"/>
29
+ </constant>
30
+ <constant name="TYPE_SETTINGS" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_SETTINGS" value="0x04">
31
+ <type name="gint" c:type="gint"/>
32
+ </constant>
24
33
  <constant name="TYPE_PUSH_PROMISE" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_PUSH_PROMISE" value="0x05">
25
34
  <type name="gint" c:type="gint"/>
26
35
  </constant>
36
+ <constant name="TYPE_PING" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_PING" value="0x06">
37
+ <type name="gint" c:type="gint"/>
38
+ </constant>
27
39
  <constant name="TYPE_GOAWAY" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_TYPE_GOAWAY" value="0x07">
28
40
  <type name="gint" c:type="gint"/>
29
41
  </constant>
@@ -33,6 +45,9 @@
33
45
  <constant name="FLAG_END_STREAM" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_FLAG_END_STREAM" value="0x01">
34
46
  <type name="gint" c:type="gint"/>
35
47
  </constant>
48
+ <constant name="FLAG_ACK" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_FLAG_ACK" value="0x01">
49
+ <type name="gint" c:type="gint"/>
50
+ </constant>
36
51
  <constant name="FLAG_END_HEADERS" c:identifier="GJSIFY_HTTP2_FRAME_ENCODER_FLAG_END_HEADERS" value="0x04">
37
52
  <type name="gint" c:type="gint"/>
38
53
  </constant>
@@ -122,6 +137,102 @@
122
137
  </parameter>
123
138
  </parameters>
124
139
  </method>
140
+ <method name="build_settings_frame" c:identifier="gjsify_http2_frame_encoder_build_settings_frame">
141
+ <return-value transfer-ownership="full">
142
+ <type name="GLib.Bytes" c:type="GBytes*"/>
143
+ </return-value>
144
+ <parameters>
145
+ <instance-parameter name="self" transfer-ownership="none">
146
+ <type name="GjsifyHttp2.FrameEncoder" c:type="GjsifyHttp2FrameEncoder*"/>
147
+ </instance-parameter>
148
+ <parameter name="ack" transfer-ownership="none">
149
+ <type name="gboolean" c:type="gboolean"/>
150
+ </parameter>
151
+ <parameter name="ids" transfer-ownership="none">
152
+ <array length="2" c:type="guint16*">
153
+ <type name="guint16" c:type="guint16"/>
154
+ </array>
155
+ </parameter>
156
+ <parameter name="ids_length1" transfer-ownership="none">
157
+ <type name="gint" c:type="gint"/>
158
+ </parameter>
159
+ <parameter name="values" transfer-ownership="none">
160
+ <array length="4" c:type="guint32*">
161
+ <type name="guint32" c:type="guint32"/>
162
+ </array>
163
+ </parameter>
164
+ <parameter name="values_length1" transfer-ownership="none">
165
+ <type name="gint" c:type="gint"/>
166
+ </parameter>
167
+ </parameters>
168
+ </method>
169
+ <method name="build_window_update_frame" c:identifier="gjsify_http2_frame_encoder_build_window_update_frame">
170
+ <return-value transfer-ownership="full">
171
+ <type name="GLib.Bytes" c:type="GBytes*"/>
172
+ </return-value>
173
+ <parameters>
174
+ <instance-parameter name="self" transfer-ownership="none">
175
+ <type name="GjsifyHttp2.FrameEncoder" c:type="GjsifyHttp2FrameEncoder*"/>
176
+ </instance-parameter>
177
+ <parameter name="stream_id" transfer-ownership="none">
178
+ <type name="guint32" c:type="guint32"/>
179
+ </parameter>
180
+ <parameter name="increment" transfer-ownership="none">
181
+ <type name="guint32" c:type="guint32"/>
182
+ </parameter>
183
+ </parameters>
184
+ </method>
185
+ <method name="build_ping_frame" c:identifier="gjsify_http2_frame_encoder_build_ping_frame">
186
+ <return-value transfer-ownership="full">
187
+ <type name="GLib.Bytes" c:type="GBytes*"/>
188
+ </return-value>
189
+ <parameters>
190
+ <instance-parameter name="self" transfer-ownership="none">
191
+ <type name="GjsifyHttp2.FrameEncoder" c:type="GjsifyHttp2FrameEncoder*"/>
192
+ </instance-parameter>
193
+ <parameter name="ack" transfer-ownership="none">
194
+ <type name="gboolean" c:type="gboolean"/>
195
+ </parameter>
196
+ <parameter name="payload" transfer-ownership="none" nullable="1">
197
+ <type name="GLib.Bytes" c:type="GBytes*"/>
198
+ </parameter>
199
+ </parameters>
200
+ </method>
201
+ <method name="build_rst_stream_frame" c:identifier="gjsify_http2_frame_encoder_build_rst_stream_frame">
202
+ <return-value transfer-ownership="full">
203
+ <type name="GLib.Bytes" c:type="GBytes*"/>
204
+ </return-value>
205
+ <parameters>
206
+ <instance-parameter name="self" transfer-ownership="none">
207
+ <type name="GjsifyHttp2.FrameEncoder" c:type="GjsifyHttp2FrameEncoder*"/>
208
+ </instance-parameter>
209
+ <parameter name="stream_id" transfer-ownership="none">
210
+ <type name="guint32" c:type="guint32"/>
211
+ </parameter>
212
+ <parameter name="error_code" transfer-ownership="none">
213
+ <type name="guint32" c:type="guint32"/>
214
+ </parameter>
215
+ </parameters>
216
+ </method>
217
+ <method name="build_goaway_frame" c:identifier="gjsify_http2_frame_encoder_build_goaway_frame">
218
+ <return-value transfer-ownership="full">
219
+ <type name="GLib.Bytes" c:type="GBytes*"/>
220
+ </return-value>
221
+ <parameters>
222
+ <instance-parameter name="self" transfer-ownership="none">
223
+ <type name="GjsifyHttp2.FrameEncoder" c:type="GjsifyHttp2FrameEncoder*"/>
224
+ </instance-parameter>
225
+ <parameter name="last_stream_id" transfer-ownership="none">
226
+ <type name="guint32" c:type="guint32"/>
227
+ </parameter>
228
+ <parameter name="error_code" transfer-ownership="none">
229
+ <type name="guint32" c:type="guint32"/>
230
+ </parameter>
231
+ <parameter name="debug_data" transfer-ownership="none" nullable="1">
232
+ <type name="GLib.Bytes" c:type="GBytes*"/>
233
+ </parameter>
234
+ </parameters>
235
+ </method>
125
236
  <method name="nghttp2_version" c:identifier="gjsify_http2_frame_encoder_nghttp2_version">
126
237
  <return-value transfer-ownership="none">
127
238
  <type name="utf8" c:type="const gchar*"/>
@@ -222,6 +333,16 @@
222
333
  <field name="priv" readable="0" private="1">
223
334
  <type name="SessionBridgePrivate" c:type="GjsifyHttp2SessionBridgePrivate*"/>
224
335
  </field>
336
+ <function name="new_server" c:identifier="gjsify_http2_session_bridge_new_server">
337
+ <return-value transfer-ownership="full" nullable="1">
338
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
339
+ </return-value>
340
+ </function>
341
+ <function name="new_client" c:identifier="gjsify_http2_session_bridge_new_client">
342
+ <return-value transfer-ownership="full" nullable="1">
343
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
344
+ </return-value>
345
+ </function>
225
346
  <function name="is_client_preface" c:identifier="gjsify_http2_session_bridge_is_client_preface">
226
347
  <return-value transfer-ownership="full">
227
348
  <type name="gboolean" c:type="gboolean"/>
@@ -237,11 +358,309 @@
237
358
  <type name="guint" c:type="guint"/>
238
359
  </return-value>
239
360
  </function>
361
+ <method name="feed_input" c:identifier="gjsify_http2_session_bridge_feed_input">
362
+ <return-value transfer-ownership="full">
363
+ <type name="glong" c:type="gssize"/>
364
+ </return-value>
365
+ <parameters>
366
+ <instance-parameter name="self" transfer-ownership="none">
367
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
368
+ </instance-parameter>
369
+ <parameter name="input" transfer-ownership="none">
370
+ <type name="GLib.Bytes" c:type="GBytes*"/>
371
+ </parameter>
372
+ </parameters>
373
+ </method>
374
+ <method name="drain_output" c:identifier="gjsify_http2_session_bridge_drain_output">
375
+ <return-value transfer-ownership="full">
376
+ <type name="GLib.Bytes" c:type="GBytes*"/>
377
+ </return-value>
378
+ <parameters>
379
+ <instance-parameter name="self" transfer-ownership="none">
380
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
381
+ </instance-parameter>
382
+ </parameters>
383
+ </method>
384
+ <method name="want_read" c:identifier="gjsify_http2_session_bridge_want_read">
385
+ <return-value transfer-ownership="full">
386
+ <type name="gboolean" c:type="gboolean"/>
387
+ </return-value>
388
+ <parameters>
389
+ <instance-parameter name="self" transfer-ownership="none">
390
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
391
+ </instance-parameter>
392
+ </parameters>
393
+ </method>
394
+ <method name="want_write" c:identifier="gjsify_http2_session_bridge_want_write">
395
+ <return-value transfer-ownership="full">
396
+ <type name="gboolean" c:type="gboolean"/>
397
+ </return-value>
398
+ <parameters>
399
+ <instance-parameter name="self" transfer-ownership="none">
400
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
401
+ </instance-parameter>
402
+ </parameters>
403
+ </method>
404
+ <method name="submit_settings" c:identifier="gjsify_http2_session_bridge_submit_settings">
405
+ <return-value transfer-ownership="full">
406
+ <type name="gint" c:type="gint"/>
407
+ </return-value>
408
+ <parameters>
409
+ <instance-parameter name="self" transfer-ownership="none">
410
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
411
+ </instance-parameter>
412
+ </parameters>
413
+ </method>
414
+ <method name="submit_response" c:identifier="gjsify_http2_session_bridge_submit_response">
415
+ <return-value transfer-ownership="full">
416
+ <type name="gint" c:type="gint"/>
417
+ </return-value>
418
+ <parameters>
419
+ <instance-parameter name="self" transfer-ownership="none">
420
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
421
+ </instance-parameter>
422
+ <parameter name="stream_id" transfer-ownership="none">
423
+ <type name="guint32" c:type="guint32"/>
424
+ </parameter>
425
+ <parameter name="names" transfer-ownership="none">
426
+ <array length="2" c:type="gchar**">
427
+ <type name="utf8" c:type="gchar*"/>
428
+ </array>
429
+ </parameter>
430
+ <parameter name="names_length1" transfer-ownership="none">
431
+ <type name="gint" c:type="gint"/>
432
+ </parameter>
433
+ <parameter name="values" transfer-ownership="none">
434
+ <array length="4" c:type="gchar**">
435
+ <type name="utf8" c:type="gchar*"/>
436
+ </array>
437
+ </parameter>
438
+ <parameter name="values_length1" transfer-ownership="none">
439
+ <type name="gint" c:type="gint"/>
440
+ </parameter>
441
+ <parameter name="end_stream" transfer-ownership="none">
442
+ <type name="gboolean" c:type="gboolean"/>
443
+ </parameter>
444
+ </parameters>
445
+ </method>
446
+ <method name="submit_request" c:identifier="gjsify_http2_session_bridge_submit_request">
447
+ <return-value transfer-ownership="full">
448
+ <type name="guint32" c:type="guint32"/>
449
+ </return-value>
450
+ <parameters>
451
+ <instance-parameter name="self" transfer-ownership="none">
452
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
453
+ </instance-parameter>
454
+ <parameter name="names" transfer-ownership="none">
455
+ <array length="1" c:type="gchar**">
456
+ <type name="utf8" c:type="gchar*"/>
457
+ </array>
458
+ </parameter>
459
+ <parameter name="names_length1" transfer-ownership="none">
460
+ <type name="gint" c:type="gint"/>
461
+ </parameter>
462
+ <parameter name="values" transfer-ownership="none">
463
+ <array length="3" c:type="gchar**">
464
+ <type name="utf8" c:type="gchar*"/>
465
+ </array>
466
+ </parameter>
467
+ <parameter name="values_length1" transfer-ownership="none">
468
+ <type name="gint" c:type="gint"/>
469
+ </parameter>
470
+ <parameter name="end_stream" transfer-ownership="none">
471
+ <type name="gboolean" c:type="gboolean"/>
472
+ </parameter>
473
+ </parameters>
474
+ </method>
475
+ <method name="submit_data" c:identifier="gjsify_http2_session_bridge_submit_data">
476
+ <return-value transfer-ownership="full">
477
+ <type name="gint" c:type="gint"/>
478
+ </return-value>
479
+ <parameters>
480
+ <instance-parameter name="self" transfer-ownership="none">
481
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
482
+ </instance-parameter>
483
+ <parameter name="stream_id" transfer-ownership="none">
484
+ <type name="guint32" c:type="guint32"/>
485
+ </parameter>
486
+ <parameter name="data" transfer-ownership="none">
487
+ <type name="GLib.Bytes" c:type="GBytes*"/>
488
+ </parameter>
489
+ <parameter name="end_stream" transfer-ownership="none">
490
+ <type name="gboolean" c:type="gboolean"/>
491
+ </parameter>
492
+ </parameters>
493
+ </method>
494
+ <method name="submit_push_promise" c:identifier="gjsify_http2_session_bridge_submit_push_promise">
495
+ <return-value transfer-ownership="full">
496
+ <type name="guint32" c:type="guint32"/>
497
+ </return-value>
498
+ <parameters>
499
+ <instance-parameter name="self" transfer-ownership="none">
500
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
501
+ </instance-parameter>
502
+ <parameter name="parent_id" transfer-ownership="none">
503
+ <type name="guint32" c:type="guint32"/>
504
+ </parameter>
505
+ <parameter name="names" transfer-ownership="none">
506
+ <array length="2" c:type="gchar**">
507
+ <type name="utf8" c:type="gchar*"/>
508
+ </array>
509
+ </parameter>
510
+ <parameter name="names_length1" transfer-ownership="none">
511
+ <type name="gint" c:type="gint"/>
512
+ </parameter>
513
+ <parameter name="values" transfer-ownership="none">
514
+ <array length="4" c:type="gchar**">
515
+ <type name="utf8" c:type="gchar*"/>
516
+ </array>
517
+ </parameter>
518
+ <parameter name="values_length1" transfer-ownership="none">
519
+ <type name="gint" c:type="gint"/>
520
+ </parameter>
521
+ </parameters>
522
+ </method>
523
+ <method name="submit_goaway" c:identifier="gjsify_http2_session_bridge_submit_goaway">
524
+ <return-value transfer-ownership="full">
525
+ <type name="gint" c:type="gint"/>
526
+ </return-value>
527
+ <parameters>
528
+ <instance-parameter name="self" transfer-ownership="none">
529
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
530
+ </instance-parameter>
531
+ <parameter name="last_stream_id" transfer-ownership="none">
532
+ <type name="guint32" c:type="guint32"/>
533
+ </parameter>
534
+ <parameter name="error_code" transfer-ownership="none">
535
+ <type name="guint32" c:type="guint32"/>
536
+ </parameter>
537
+ </parameters>
538
+ </method>
539
+ <method name="submit_rst_stream" c:identifier="gjsify_http2_session_bridge_submit_rst_stream">
540
+ <return-value transfer-ownership="full">
541
+ <type name="gint" c:type="gint"/>
542
+ </return-value>
543
+ <parameters>
544
+ <instance-parameter name="self" transfer-ownership="none">
545
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
546
+ </instance-parameter>
547
+ <parameter name="stream_id" transfer-ownership="none">
548
+ <type name="guint32" c:type="guint32"/>
549
+ </parameter>
550
+ <parameter name="error_code" transfer-ownership="none">
551
+ <type name="guint32" c:type="guint32"/>
552
+ </parameter>
553
+ </parameters>
554
+ </method>
555
+ <method name="close" c:identifier="gjsify_http2_session_bridge_close">
556
+ <return-value transfer-ownership="full">
557
+ <type name="none" c:type="void"/>
558
+ </return-value>
559
+ <parameters>
560
+ <instance-parameter name="self" transfer-ownership="none">
561
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
562
+ </instance-parameter>
563
+ </parameters>
564
+ </method>
565
+ <method name="dispatch_pending" c:identifier="gjsify_http2_session_bridge_dispatch_pending">
566
+ <return-value transfer-ownership="full">
567
+ <type name="none" c:type="void"/>
568
+ </return-value>
569
+ <parameters>
570
+ <instance-parameter name="self" transfer-ownership="none">
571
+ <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
572
+ </instance-parameter>
573
+ </parameters>
574
+ </method>
240
575
  <constructor name="new" c:identifier="gjsify_http2_session_bridge_new">
241
576
  <return-value transfer-ownership="full">
242
577
  <type name="GjsifyHttp2.SessionBridge" c:type="GjsifyHttp2SessionBridge*"/>
243
578
  </return-value>
244
579
  </constructor>
580
+ <glib:signal name="headers-received">
581
+ <return-value transfer-ownership="full">
582
+ <type name="none" c:type="void"/>
583
+ </return-value>
584
+ <parameters>
585
+ <parameter name="stream_id" transfer-ownership="none">
586
+ <type name="guint32" c:type="guint32"/>
587
+ </parameter>
588
+ <parameter name="headers" transfer-ownership="none">
589
+ <type name="GLib.Variant" c:type="GVariant*"/>
590
+ </parameter>
591
+ <parameter name="end_stream" transfer-ownership="none">
592
+ <type name="gboolean" c:type="gboolean"/>
593
+ </parameter>
594
+ </parameters>
595
+ </glib:signal>
596
+ <glib:signal name="data-received">
597
+ <return-value transfer-ownership="full">
598
+ <type name="none" c:type="void"/>
599
+ </return-value>
600
+ <parameters>
601
+ <parameter name="stream_id" transfer-ownership="none">
602
+ <type name="guint32" c:type="guint32"/>
603
+ </parameter>
604
+ <parameter name="chunk" transfer-ownership="none">
605
+ <type name="GLib.Bytes" c:type="GBytes*"/>
606
+ </parameter>
607
+ <parameter name="end_stream" transfer-ownership="none">
608
+ <type name="gboolean" c:type="gboolean"/>
609
+ </parameter>
610
+ </parameters>
611
+ </glib:signal>
612
+ <glib:signal name="stream-closed">
613
+ <return-value transfer-ownership="full">
614
+ <type name="none" c:type="void"/>
615
+ </return-value>
616
+ <parameters>
617
+ <parameter name="stream_id" transfer-ownership="none">
618
+ <type name="guint32" c:type="guint32"/>
619
+ </parameter>
620
+ <parameter name="error_code" transfer-ownership="none">
621
+ <type name="guint32" c:type="guint32"/>
622
+ </parameter>
623
+ </parameters>
624
+ </glib:signal>
625
+ <glib:signal name="frame-send-ready">
626
+ <return-value transfer-ownership="full">
627
+ <type name="none" c:type="void"/>
628
+ </return-value>
629
+ </glib:signal>
630
+ <glib:signal name="goaway-received">
631
+ <return-value transfer-ownership="full">
632
+ <type name="none" c:type="void"/>
633
+ </return-value>
634
+ <parameters>
635
+ <parameter name="last_stream_id" transfer-ownership="none">
636
+ <type name="guint32" c:type="guint32"/>
637
+ </parameter>
638
+ <parameter name="error_code" transfer-ownership="none">
639
+ <type name="guint32" c:type="guint32"/>
640
+ </parameter>
641
+ </parameters>
642
+ </glib:signal>
643
+ <glib:signal name="settings-received">
644
+ <return-value transfer-ownership="full">
645
+ <type name="none" c:type="void"/>
646
+ </return-value>
647
+ </glib:signal>
648
+ <glib:signal name="push-promise-received">
649
+ <return-value transfer-ownership="full">
650
+ <type name="none" c:type="void"/>
651
+ </return-value>
652
+ <parameters>
653
+ <parameter name="stream_id" transfer-ownership="none">
654
+ <type name="guint32" c:type="guint32"/>
655
+ </parameter>
656
+ <parameter name="promised_stream_id" transfer-ownership="none">
657
+ <type name="guint32" c:type="guint32"/>
658
+ </parameter>
659
+ <parameter name="headers" transfer-ownership="none">
660
+ <type name="GLib.Variant" c:type="GVariant*"/>
661
+ </parameter>
662
+ </parameters>
663
+ </glib:signal>
245
664
  </class>
246
665
  <record name="SessionBridgeClass" c:type="GjsifyHttp2SessionBridgeClass" glib:is-gtype-struct-for="SessionBridge">
247
666
  <field name="parent_class" readable="0" private="1">
@@ -62,11 +62,16 @@ namespace GjsifyHttp2 {
62
62
  * code doesn't have to hard-code magic numbers. */
63
63
  public const uint8 TYPE_DATA = 0x00;
64
64
  public const uint8 TYPE_HEADERS = 0x01;
65
+ public const uint8 TYPE_PRIORITY = 0x02;
66
+ public const uint8 TYPE_RST_STREAM = 0x03;
67
+ public const uint8 TYPE_SETTINGS = 0x04;
65
68
  public const uint8 TYPE_PUSH_PROMISE = 0x05;
69
+ public const uint8 TYPE_PING = 0x06;
66
70
  public const uint8 TYPE_GOAWAY = 0x07;
67
71
  public const uint8 TYPE_WINDOW_UPDATE = 0x08;
68
72
 
69
73
  public const uint8 FLAG_END_STREAM = 0x01;
74
+ public const uint8 FLAG_ACK = 0x01; /* SETTINGS/PING share value */
70
75
  public const uint8 FLAG_END_HEADERS = 0x04;
71
76
 
72
77
  /**
@@ -128,6 +133,101 @@ namespace GjsifyHttp2 {
128
133
  return _pack_push_promise (associated_stream_id, promised_stream_id, header_block);
129
134
  }
130
135
 
136
+ /**
137
+ * build_settings_frame:
138
+ * @ack: %TRUE to emit SETTINGS-ACK (empty payload).
139
+ * @ids: SETTINGS identifier array (e.g. SETTINGS_MAX_CONCURRENT_STREAMS=3)
140
+ * @values: matching values array
141
+ *
142
+ * Builds a SETTINGS frame. Length of @ids must equal @values.
143
+ * RFC 7540 §6.5: payload is N × (16-bit id || 32-bit value).
144
+ */
145
+ public GLib.Bytes build_settings_frame (bool ack, uint16[] ids, uint32[] values) {
146
+ if (ack) {
147
+ return _pack_frame (TYPE_SETTINGS, FLAG_ACK, 0,
148
+ new GLib.Bytes (null));
149
+ }
150
+ int n = (ids.length < values.length) ? ids.length : values.length;
151
+ uint8[] payload = new uint8[n * 6];
152
+ for (int i = 0; i < n; i++) {
153
+ payload[i * 6 + 0] = (uint8)((ids[i] >> 8) & 0xff);
154
+ payload[i * 6 + 1] = (uint8)( ids[i] & 0xff);
155
+ payload[i * 6 + 2] = (uint8)((values[i] >> 24) & 0xff);
156
+ payload[i * 6 + 3] = (uint8)((values[i] >> 16) & 0xff);
157
+ payload[i * 6 + 4] = (uint8)((values[i] >> 8) & 0xff);
158
+ payload[i * 6 + 5] = (uint8)( values[i] & 0xff);
159
+ }
160
+ return _pack_frame (TYPE_SETTINGS, 0, 0, new GLib.Bytes (payload));
161
+ }
162
+
163
+ /**
164
+ * build_window_update_frame:
165
+ * @stream_id: 0 for connection-level, > 0 for per-stream
166
+ * @increment: 31-bit window-size increment
167
+ */
168
+ public GLib.Bytes build_window_update_frame (uint32 stream_id, uint32 increment) {
169
+ uint32 inc = increment & 0x7fffffffu;
170
+ uint8[] payload = new uint8[4];
171
+ payload[0] = (uint8)((inc >> 24) & 0xff);
172
+ payload[1] = (uint8)((inc >> 16) & 0xff);
173
+ payload[2] = (uint8)((inc >> 8) & 0xff);
174
+ payload[3] = (uint8)( inc & 0xff);
175
+ return _pack_frame (TYPE_WINDOW_UPDATE, 0, stream_id, new GLib.Bytes (payload));
176
+ }
177
+
178
+ /**
179
+ * build_ping_frame:
180
+ * @ack: %TRUE to emit PING-ACK (caller MUST echo the payload).
181
+ * @payload: 8-byte opaque data (will be padded/truncated to 8 bytes).
182
+ */
183
+ public GLib.Bytes build_ping_frame (bool ack, GLib.Bytes? payload) {
184
+ uint8[] data = new uint8[8];
185
+ if (payload != null) {
186
+ unowned uint8[] src = payload.get_data ();
187
+ int copy = (src.length < 8) ? src.length : 8;
188
+ for (int i = 0; i < copy; i++) data[i] = src[i];
189
+ }
190
+ return _pack_frame (TYPE_PING, ack ? FLAG_ACK : 0, 0, new GLib.Bytes (data));
191
+ }
192
+
193
+ /**
194
+ * build_rst_stream_frame:
195
+ * @stream_id: stream to reset
196
+ * @error_code: RFC 7540 error code (NO_ERROR=0, PROTOCOL_ERROR=1, ...)
197
+ */
198
+ public GLib.Bytes build_rst_stream_frame (uint32 stream_id, uint32 error_code) {
199
+ uint8[] payload = new uint8[4];
200
+ payload[0] = (uint8)((error_code >> 24) & 0xff);
201
+ payload[1] = (uint8)((error_code >> 16) & 0xff);
202
+ payload[2] = (uint8)((error_code >> 8) & 0xff);
203
+ payload[3] = (uint8)( error_code & 0xff);
204
+ return _pack_frame (TYPE_RST_STREAM, 0, stream_id, new GLib.Bytes (payload));
205
+ }
206
+
207
+ /**
208
+ * build_goaway_frame:
209
+ * @last_stream_id: highest stream id processed (caller tracks)
210
+ * @error_code: RFC 7540 error code
211
+ * @debug_data: optional debug info (often empty)
212
+ */
213
+ public GLib.Bytes build_goaway_frame (uint32 last_stream_id,
214
+ uint32 error_code,
215
+ GLib.Bytes? debug_data) {
216
+ unowned uint8[] dbg = (debug_data != null) ? debug_data.get_data () : new uint8[0];
217
+ uint8[] payload = new uint8[8 + dbg.length];
218
+ uint32 lsi = last_stream_id & 0x7fffffffu;
219
+ payload[0] = (uint8)((lsi >> 24) & 0xff);
220
+ payload[1] = (uint8)((lsi >> 16) & 0xff);
221
+ payload[2] = (uint8)((lsi >> 8) & 0xff);
222
+ payload[3] = (uint8)( lsi & 0xff);
223
+ payload[4] = (uint8)((error_code >> 24) & 0xff);
224
+ payload[5] = (uint8)((error_code >> 16) & 0xff);
225
+ payload[6] = (uint8)((error_code >> 8) & 0xff);
226
+ payload[7] = (uint8)( error_code & 0xff);
227
+ for (int i = 0; i < dbg.length; i++) payload[8 + i] = dbg[i];
228
+ return _pack_frame (TYPE_GOAWAY, 0, 0, new GLib.Bytes (payload));
229
+ }
230
+
131
231
  /**
132
232
  * nghttp2_version:
133
233
  *