Skip to content

Re-add C API, a.k.a. lakers-c#197

Merged
geonnave merged 24 commits intolake-rs:mainfrom
geonnave:re-add-c-wrapper
Feb 1, 2024
Merged

Re-add C API, a.k.a. lakers-c#197
geonnave merged 24 commits intolake-rs:mainfrom
geonnave:re-add-c-wrapper

Conversation

@geonnave
Copy link
Copy Markdown
Collaborator

Addressing #180.

Since now the crypto backends are dissociated from the main crate, I had to add a new, separate crate that will import lakers and lakers_crypto. One good implication of this approach is that this new crate can be hardcoded to crate-type = ["staticlib"] (in the previous version, I had to manually change from "rlib" to "staticlib" everytime I wanted to build the static version). On the other hand, I still need to figure whether cbindgen will actually work across the lakers_ffi, lakers, and lakers_shared crates and generate all the needed headers.

@geonnave geonnave force-pushed the re-add-c-wrapper branch 2 times, most recently from f026645 to 80dcc1f Compare January 17, 2024 15:44
@geonnave
Copy link
Copy Markdown
Collaborator Author

geonnave commented Jan 17, 2024

Pulling the structs from other crates in the workspace works fine with cbindgen, one challenge now is how to work around the generic crypto item in the structs found in lib.rs.

moved ffi structs into the shared crate to be able to write
`to_c` methods in the rust structs without having to set its
fields visibility to public
@geonnave geonnave force-pushed the re-add-c-wrapper branch 2 times, most recently from 0e640ba to 7c75a28 Compare January 18, 2024 17:30
@geonnave geonnave force-pushed the re-add-c-wrapper branch 2 times, most recently from 4825f76 to 4ee3231 Compare January 22, 2024 13:33
@geonnave geonnave changed the title Re-add C API, a.k.a. lakers-ffi Re-add C API, a.k.a. lakers-c Jan 31, 2024
@geonnave geonnave requested a review from malishav January 31, 2024 15:55
@geonnave
Copy link
Copy Markdown
Collaborator Author

This is ready for review / merge. For an overview on the API and the integration with authz, see lakers-c-native/main.c and the changes in coap/coapserver.rs.

- use curly brackets even on single line while
- fix bug on macos with socket addr
- improve readme and build.sh
@geonnave geonnave merged commit fa7a8e2 into lake-rs:main Feb 1, 2024
@geonnave geonnave deleted the re-add-c-wrapper branch February 1, 2024 14:38
@geonnave geonnave mentioned this pull request Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants