diff --git a/.gitignore b/.gitignore index fbbfbb28ff59e74d951ba8f7f4d80349eb106f65..c3690f18e7216e594006f25a2288ead2b493c3d6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,5 +7,10 @@ examples/*/*.exe examples/*.dll examples/reowolf* examples/*.txt +examples/lib* +examples/lib*.* +examples/*/amy +examples/*/bob +examples/*/main logs/* logs/*/* diff --git a/Cargo.toml b/Cargo.toml index 258a30287cfdafbbc1e850669b231fda1cbb8fe4..e5d19f0dd2c5e3db8d304dc979408f8f9c2fba95 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ lazy_static = "1.4.0" crate-type = ["cdylib"] [features] -default = ["ffi", "session_optimization"] +default = ["ffi", "session_optimization", "ffi_pseudo_socket_api"] ffi = [] # see src/ffi/mod.rs ffi_pseudo_socket_api = ["ffi", "libc", "os_socketaddr"]# see src/ffi/pseudo_socket_api.rs endpoint_logging = [] # see src/macros.rs diff --git a/examples/5_put_get/amy.c b/examples/5_put_get/amy.c index d710f3c55c0c97f7842f726753c29d3acefd4ab7..b483a4073539ec6dcef587dade9dcdba8a90198f 100644 --- a/examples/5_put_get/amy.c +++ b/examples/5_put_get/amy.c @@ -20,11 +20,11 @@ int main(int argc, char** argv) { connector_sync(c, -1); size_t msg_len; const char * msg_ptr = connector_gotten_bytes(c, getter, &msg_len); - printf("Got msg `%.*s`\n", msg_len, msg_ptr); + printf("Got msg `%.*s`\n", (int) msg_len, msg_ptr); protocol_description_destroy(pd); connector_destroy(c); free(pdl_ptr); return 0; -} \ No newline at end of file +} diff --git a/examples/7_recovery/amy.c b/examples/7_recovery/amy.c index 3f6322f447a5075c5c905e6040e171cff7d1e2e6..c3adb7649c14ce5910403fa6b5b8504500dfdb34 100644 --- a/examples/7_recovery/amy.c +++ b/examples/7_recovery/amy.c @@ -30,10 +30,10 @@ int main(int argc, char** argv) { printf("Error code %d with string `%s`\n", err, reowolf_error_peek(NULL)); size_t msg_len; const char * msg_ptr = connector_gotten_bytes(c, getter, &msg_len); - printf("Got msg `%.*s`\n", msg_len, msg_ptr); + printf("Got msg `%.*s`\n", (int) msg_len, msg_ptr); protocol_description_destroy(pd); connector_destroy(c); free(pdl_ptr); return 0; -} \ No newline at end of file +} diff --git a/examples/cpy_dll.sh b/examples/cpy_dll.sh old mode 100644 new mode 100755 diff --git a/examples/cpy_so.sh b/examples/cpy_so.sh new file mode 100755 index 0000000000000000000000000000000000000000..3cfc727faa12f1af7a109ad0453d6f7bc93a2f4d --- /dev/null +++ b/examples/cpy_so.sh @@ -0,0 +1 @@ +cp ./../target/release/reowolf_rs.so ./ --force diff --git a/examples/interop_connector/main.c b/examples/interop_connector/main.c index 8661cdb788372368ad0fd4d7d30fc2500ac344d4..dee2123919c038af47eee729ed868719098baad6 100644 --- a/examples/interop_connector/main.c +++ b/examples/interop_connector/main.c @@ -1,6 +1,6 @@ #include #include -#include "reowolf.h" +#include "../../reowolf.h" int main(int argc, char** argv) { // --- setup --- @@ -25,4 +25,4 @@ int main(int argc, char** argv) { protocol_description_destroy(pd); connector_destroy(c); return 0; -} \ No newline at end of file +} diff --git a/examples/interop_pseudo_socket/main.c b/examples/interop_pseudo_socket/main.c index 183e5e816c2d8d786f6f00e77013e7a2e91d7205..4010b8884451c3b3248af85a0d4dbc129ad7d7f3 100644 --- a/examples/interop_pseudo_socket/main.c +++ b/examples/interop_pseudo_socket/main.c @@ -1,18 +1,19 @@ -#include // socket addresses, constants +#include #include -#include "pseudo_socket.h" +#include +#include "../../pseudo_socket.h" #define BUFSIZE 512 int main() { // --- setup --- - struct sockaddr_in local, peer; + struct sockaddr_in addrs[2]; /* (address structure initializations omitted) */ int fd = rw_socket(AF_INET, SOCK_DGRAM, 0); - rw_bind(fd, (const struct sockaddr *)&local, sizeof(local)); - rw_connect(fd, (const struct sockaddr *)&peer, sizeof(peer)); + rw_bind(fd, (const struct sockaddr *)&addrs[0], sizeof(addrs[0])); + rw_connect(fd, (const struct sockaddr *)&addrs[1], sizeof(addrs[1])); // --- communication --- - char buffer = malloc(BUFSIZE); + char * buffer = malloc(BUFSIZE); size_t msglen, i; - msglen = rw_recv(fd, (const void *)buffer, BUFSIZE, 0); + msglen = rw_recv(fd, (void *)buffer, BUFSIZE, 0); for(i=0; i // socket addresses, constants -#include +#include // definies socketaddr_in +#include // defines printf +#include // defines malloc, free +#include // defines close #define BUFSIZE 512 int main() { // --- setup --- - struct sockaddr_in local, peer; + struct sockaddr_in addrs[2]; /* (address structure initializations omitted) */ int fd = socket(AF_INET, SOCK_DGRAM, 0); - bind(fd, (const struct sockaddr *)&local, sizeof(local)); - connect(fd, (const struct sockaddr *)&peer, sizeof(peer)); + bind(fd, (const struct sockaddr *)&addrs[0], sizeof(addrs[0])); + connect(fd, (const struct sockaddr *)&addrs[1], sizeof(addrs[1])); // --- communication --- - char buffer = malloc(BUFSIZE); + char * buffer = malloc(BUFSIZE); size_t msglen, i; - msglen = recv(fd, (const void *)buffer, BUFSIZE, 0); + msglen = recv(fd, (void *)buffer, BUFSIZE, 0); for(i=0; i