Files
@ 031c9d14adaa
Branch filter:
Location: CSY/reowolf/examples/interop_3_connector/main.c - annotation
031c9d14adaa
1.2 KiB
text/x-csrc
Merge branch 'feat-bytecode'
Adds size/alignment/offset computations to the type system and detects
potentially infinite types. If the type is potentially infinite but
contains a union that can break that type loop, then all other variants
of that union are supposed to be allocated on the heap. If the type
is potentially infinite but cannot be broken up, then we throw the
appropriate error.
The size/alignment/offset computations are not yet employed in the
runtime. But prepares Reowolf for a proper bytecode/IR implementation.
Adds size/alignment/offset computations to the type system and detects
potentially infinite types. If the type is potentially infinite but
contains a union that can break that type loop, then all other variants
of that union are supposed to be allocated on the heap. If the type
is potentially infinite but cannot be broken up, then we throw the
appropriate error.
The size/alignment/offset computations are not yet employed in the
runtime. But prepares Reowolf for a proper bytecode/IR implementation.
673882671c9a 673882671c9a 673882671c9a 673882671c9a 673882671c9a a9fb2e3e41d9 a9fb2e3e41d9 8df425c3752e a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 18a1548e4a31 18a1548e4a31 18a1548e4a31 18a1548e4a31 18a1548e4a31 18a1548e4a31 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 18a1548e4a31 18a1548e4a31 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 a9fb2e3e41d9 8df425c3752e | /* This example demonstrates:
- connector API can create UDP mediator components, each given a BIND and CONNECT socket address,
which communicates via a returned putter and getter port pair.
- messages passed to the UDP mediator are forwarded as UDP datagrams into the network.
*/
#include <stdio.h>
#include <string.h>
#include "../../reowolf.h"
int main(int argc, char** argv) {
// --- setup ---
Arc_ProtocolDescription * pd = protocol_description_parse("", 0);
Connector * c = connector_new(pd);
PortId putter_a, putter_b;
FfiSocketAddr addresses[4] = {
{{127, 0, 0, 1}, 8000},
{{127, 0, 0, 1}, 8001},
{{127, 0, 0, 1}, 8002},
{{127, 0, 0, 1}, 8003},
};
// putter_a to UDP mediator (getter id discarded)
// with local addresses[0] and peer addresses[1]
connector_add_udp_mediator_component(c, &putter_a, NULL, addresses[1], addresses[0]);
connector_add_udp_mediator_component(c, &putter_b, NULL, addresses[3], addresses[2]);
connector_connect(c, -1);
// --- communication ---
connector_put_bytes(c, putter_a, "hello, socket!", 14);
connector_put_bytes(c, putter_b, "hello, pseudo-socket!", 21);
connector_sync(c, -1);
// --- cleanup ---
protocol_description_destroy(pd);
connector_destroy(c);
return 0;
}
|