scoop:scoop.http:0.1.0
src/native/http1_events.scoop
Selected production source · src/native/http1_events.scoop
1
package scoop.http3
// These two records match the native event's owned field storage on 64-bit targets.4
@CLayout5
internal struct NativeHttpByteStorage(val data: Ptr<Byte>?, val size: ULong, val capacity: ULong)7
@CLayout8
internal struct NativeHttpFieldStorage(9
val name: NativeHttpByteStorage,10
val value: NativeHttpByteStorage,11
val neverIndex: Int12
)14
@CLayout15
internal struct NativeHttpEventView(16
val info: NativeHttpEventInfo,17
val first: NativeHttpBytes,18
val second: NativeHttpBytes,19
val fields: Ptr<NativeHttpFieldStorage>?,20
val fieldCount: Long,21
val next: ULong22
)24
@GCLeaf25
@Extern(name = "scoop_http1_take_events")26
internal fun http1TakeEvents(handle: ULong): ULong28
@GCLeaf29
@Extern(name = "scoop_http_event_view")30
internal fun httpEventView(handle: ULong): NativeHttpEventView32
@Extern(name = "scoop_http_event_batch_free")33
internal fun httpEventBatchFree(handle: ULong)35
@Unsafe36
internal fun httpEventFields(view: NativeHttpEventView): Array<HttpField> =37
Array<HttpField>(view.fieldCount) {38
index -> @Unsafe39
{40
val field = view.fields!!.load(index)41
return@Array HttpField(42
httpBytes(NativeHttpBytes(field.name.data, field.name.size.toLong())),43
httpBytes(NativeHttpBytes(field.value.data, field.value.size.toLong())),44
field.neverIndex != 045
)46
}47
}