#include <ul_log.h>
#include <forb/server_id.h>
#include <fres_contract.h>
+#include "fcb_config.h"
+
+#ifdef CONFIG_FCB_INET
+#include <forb/proto_inet.h>
+#endif
UL_LOG_CUST(ulogd_fcb);
ul_log_domain_t ulogd_fcb = {UL_LOGL_MSG, "fcb"};
return -1;
}
+#ifdef CONFIG_FCB_INET
+static int register_inet_port(forb_orb orb)
+{
+ forb_port_t *port = forb_malloc(sizeof(*port));
+ int ret;
+ struct in_addr listen_on;
+
+ if (!port)
+ return -1;
+ memset(port, 0, sizeof(*port));
+ listen_on.s_addr = INADDR_ANY;
+ ret = forb_inet_port_init(&port->desc, listen_on);
+ if (ret) error(1, errno, "INET port initialization failed");
+ ret = forb_register_port(orb, port);
+ if (ret) error(1, errno /* TODO: FOSA errno */,
+ "INET port registration failed");
+ return 0;
+}
+#endif
+
struct forb_fres_contract_broker_impl impl = {
.negotiate_contract = negotiate_contract,
.cancel_contract = cancel_contract,
orb = forb_init(&argc, &argv, "fcb");
if (!orb) error(1, errno, "FORB initialization failed");
+#ifdef CONFIG_FCB_INET
+ ret = register_inet_port(orb);
+ if (ret) error(1, errno, "INET port registration failed");
+#endif
+
fcb_resource_init_root_field(&fcb_data);
fcb = forb_fres_contract_broker_new(orb, &impl, &fcb_data);