-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from quambene/eric-sdk
Validate and send xml
- Loading branch information
Showing
22 changed files
with
2,992 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
|
||
# Eric | ||
**/eric.log | ||
|
||
# Environment | ||
**/.env | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,6 @@ resolver = "2" | |
[workspace.package] | ||
authors = ["quambene <[email protected]>"] | ||
edition = "2021" | ||
version = "0.1.0" | ||
readme = "README.md" | ||
license = "Apache-2.0" | ||
homepage = "https://github.com/quambene/eric-rs" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
- added | ||
- changed | ||
- Rename feature from `docs-rs` to `no-build` | ||
- removed | ||
|
||
## v0.1.2 (2024-08-03) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
pub mod bindings_eric_39_6_4_0_linux_x86_64; | ||
pub mod bindings_eric_38_1_6_0_linux_x86_64; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- markdownlint-disable MD041 --> | ||
|
||
## Unreleased | ||
|
||
- added | ||
- changed | ||
- removed | ||
|
||
## v0.1.0 (2024-08-04) | ||
|
||
- added | ||
- Validate and send xml | ||
- Support Eric v38.1.6.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
use crate::error_code::ErrorCode; | ||
use anyhow::anyhow; | ||
use eric_bindings::{EricCloseHandleToCertificate, EricGetHandleToCertificate}; | ||
use std::{ffi::CStr, ptr}; | ||
|
||
pub struct Certificate { | ||
pub handle: u32, | ||
} | ||
|
||
impl Certificate { | ||
pub fn new(path: &CStr) -> Result<Self, anyhow::Error> { | ||
println!("Preparing certificate '{}'", path.to_str()?); | ||
|
||
let mut handle = 0; | ||
let pin_support = ptr::null::<u32>() as *mut u32; | ||
|
||
// SAFETY: path.as_ptr() is not dangling as path is allocated in struct CertificateConfig and path is not moved as a reference to the CString is given | ||
let error_code = | ||
unsafe { EricGetHandleToCertificate(&mut handle, pin_support, path.as_ptr()) }; | ||
|
||
match error_code { | ||
x if x == ErrorCode::ERIC_OK as i32 => Ok(Certificate { handle }), | ||
error_code => Err(anyhow!("Can't create certificate: {}", error_code)), | ||
} | ||
} | ||
|
||
// TODO: check validity of certificate | ||
// unsafe { EricHoleZertifikatseigenschaften() } | ||
} | ||
|
||
impl Drop for Certificate { | ||
fn drop(&mut self) { | ||
println!("Cleaning up certificate"); | ||
|
||
let error_code = unsafe { EricCloseHandleToCertificate(self.handle) }; | ||
|
||
match error_code { | ||
x if x == ErrorCode::ERIC_OK as i32 => (), | ||
error_code => panic!("Can't drop certificate handle: {}", error_code), | ||
} | ||
} | ||
} |
Oops, something went wrong.