Skip to content

[Need Help] How to access a structure array, returned from C as pointer? #39

@engrvivs-neosoft

Description

@engrvivs-neosoft

Hi

Through list_buckets() C function, I am retrieving a C structure, BucketList, through ref-struct, defined as follows:

const BucketList = struct({
    more  : ref.types.bool,
    items : ref.refType(BucketInfo),
    length: "int32"
});

Here, I mainly need to access the "array" of BucketInfo, which I have declared as follows:

const BucketInfo = struct({
    name                 : ref.refType(ref.types.CString),
    created              : "int64",
    path_cipher          : "uint32",
    segment_size         : "uint64",
    encryption_parameters: EncryptionParameters,
    redundancy_scheme    : RedundancyScheme
});

const EncryptionParameters = struct({
    cipher_suite: "uint32",
    block_size  : "int32"
});

const RedundancyScheme = struct({
    algorithm      : "uint32",
    share_size     : "int32",
    required_shares: "int16",
    repair_shares  : "int16",
    optimal_shares : "int16",
    total_shares   : "int16"
});

Although, I am able to access the first bucket's information, through BucketList.items. But, I am not able to "point" to the next bucket's information.

May someone hint, as to how I may access the next information?

Thank in Advance
Vivs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions