struct fwp_sockaddr peer;
/* service vres */
-struct fwp_vres_params service_vparams;
fwp_vres_d_t service_vresd; /**< service vres decriptor */
/* List of requested contracts */
*/
int fwp_mngr_init()
{
- #if 0
- if ((fwp_lsockfd = fwp_create_unix_socket(FWP_AGENT_UNIXPATH,
- &fwp_laddr)) < 0) {
- return (fwp_lsockfd);
- }
- #endif
- if ((fwp_rsockfd = fwp_create_inet_socket(FWP_MNGR_UDP_PORT,
- &fwp_raddr)) < 0) {
- return (fwp_rsockfd);
- }
-
- FD_ZERO(&fwp_input_fdset);
- //FD_SET(fwp_lsockfd, &fwp_input_fdset);
- FD_SET(fwp_rsockfd, &fwp_input_fdset);
-
- FWP_DEBUG("Manager initialized \n");
-
- /* create service vres */
- service_vparams.ac_id = FWP_AC_BK;
- service_vparams.budget = 100;
- service_vparams.period_usec = 1000;
+ fwpmngr_info = my_info;
- if ((fwp_vres_create(&service_vparams, &service_vresd) < 0)) {
- fprintf(stderr,"Unable to open service vres\n");
- return -1;
- }
+ FWP_DEBUG("Management receive endpoint created\n");
+ fwp_receive_endpoint_create(FWP_APP_MNGT_PORT, 0, &mngt_repointd);
+ my_info.port = FWP_APP_MNGT_PORT;
- FWP_DEBUG("Service vres negotiated\n");
+
+
return 0;
}
GAVL_CUST_NODE_INT_DEC(_fwp_participant_table, fwp_participant_table_t,
fwp_participant_data_t, fwp_participant_id_t,
- participant_tree, tree_node, id,
+ participant_tree, participant_tree_node, id,
fwp_cmp_participant_id);
GAVL_CUST_NODE_INT_IMP(_fwp_participant_table, fwp_participant_table_t,
fwp_participant_data_t, fwp_participant_id_t,
- participant_tree, tree_node, id,
+ participant_tree, participant_tree_node, id,
fwp_cmp_participant_id);
fwp_participant_table_t fwp_participant_table = {
#include "fwp_mngt.h"
#include "fwp_participant.h"
-struct sockaddr_un fwp_agent_addr;
-struct sockaddr_un fwp_client_addr;
-int fwp_client_sockfd;
+/*
+ * Global mngt variables
+ */
+static fwp_participant_info_t fwp_my_info;
-fwp_participant_info_t my_info;
-fwp_participant_info_t fwpmngr_info;
+fwp_participant_t *fwp_this;
+fwp_participant_t *fwp_mngr;
fwp_endpoint_d_t discovery_epointd;
fwp_endpoint_d_t mngt_sepointd;
fwp_endpoint_d_t mngt_repointd;
-fwp_participant_t me;
+/* temporarily*/
+struct fwp_vres_params fwp_service_vparams;
+fwp_vres_d_t fwp_service_vresd;
+
/**
* struct resource {
}
#endif
-void fwp_mngt_discovery(fwp_participant_info_t *fwpmngr_info)
+void fwp_mngt_discovery(fwp_participant_info_t *participant_)
{
struct fwp_msg_hello msg_hello;
size_t size;
fwp_msg_hello_inflate((unsigned char*) &msg_hello, fwpmngr_info);
}
-/**
- * FWP initialisation
- *
- */
-int fwp_mngt_init()
+void fwp_mngt_connect()
+ fwp_send_endpoint_bind(discovery_epointd, fwp_service_vresd);
{
- my_info.id.node_id = inet_addr("127.0.0.1");
- my_info.id.app_id = getpid();
-
- FWP_DEBUG("Management receive endpoint created\n");
- fwp_receive_endpoint_create(FWP_APP_MNGT_PORT, 0, &mngt_repointd);
- my_info.port = FWP_APP_MNGT_PORT;
FWP_DEBUG("Discovery send endpoint created\n");
/*fwp_send_endpoint_create(inet_addr("255.255.255.255"), 0,
* */
fwp_send_endpoint_create(inet_addr("127.0.0.1"), FWP_MNGT_DISCOVERY_PORT, 0,
&discovery_epointd);
+
+ fwp_send_endpoint_bind(discovery_epointd, fwp_service_vresd);
/* Launch discovery process*/
/* introduce yourself to resource manager */
fwp_mngt_discovery(&fwpmngr_info);
+ fwp_send_endpoint_unbind(discovery_epointd, fwp_service_vresd);
+
FWP_DEBUG("Management send endpoint created\n");
fwp_send_endpoint_create(fwpmngr_info.id.node_id, fwpmngr_info.port, 0,
&mngt_sepointd);
+
+ fwp_send_endpoint_bind(mngt_sepointd, fwp_service_vresd);
+}
+
+/**
+ * FWP initialisation
+ *
+ */
+int fwp_mngt_init()
+{
+ my_info.id.node_id = inet_addr("127.0.0.1");
+ my_info.id.app_id = getpid();
+ /* temporarily*/
+ my_info.port = FWP_APP_MNGT_PORT;
+
+ me = fwp_participant_create(my_info);
+
+ FWP_DEBUG("Management receive endpoint created\n");
+ fwp_receive_endpoint_create(FWP_APP_MNGT_PORT, 0, &mngt_repointd);
+
+ /* create service vres */
+ fwp_service_vparams.ac_id = FWP_AC_BK;
+ fwp_service_vparams.budget = 100;
+ fwp_service_vparams.period_usec = 1000;
+
+ if ((fwp_vres_create(&fwp_service_vparams, &fwp_service_vresd) < 0)) {
+ fprintf(stderr,"Unable to open service vres\n");
+ return -1;
+ }
+
+ FWP_DEBUG("Service vres negotiated\n");
return 0;
}
#include "fwp_util.h"
#include "fwp_endpoint.h"
-#define FWP_AGENT_UNIXPATH "/tmp/fwp-agent"
-#define FWP_CLIENT_UNIXPATH "/tmp" /*temporarily*/
+#define FWP_APP_MNGT_STREAMID 3001
-#define FWP_MNGR_UDP_PORT 3000
-#define FWP_AGENT_UDP_PORT 3001
-#define FWP_APP_MNGT_PORT 3001
-
-extern int fwp_client_sockfd;
-extern struct sockaddr_un fwp_client_addr;
-extern struct sockaddr_un fwp_agent_addr;
-
-extern pid_t fwp_appid;
-extern uint16_t fwp_callid;
typedef int tr_id_t;
-#define FWP_MNGT_DISCOVERY_PORT 3000
+#define FWP_MNGT_DISCOVERY_STREAMID 3000
+#define FWP_MNGR_STREAMID 3000
int fwp_mngt_init();
#ifndef _FWP_PARTICIPANT_H
#define _FWP_PARTICIPANT_H
-#include "fwp_contract_table.h"
+#include "ul_gavlcust.h"
typedef
struct fwp_participant_id {
} fwp_participant_id_t;
typedef
+/*struct fwp_participant_conf {*/
struct fwp_participant_info {
fwp_participant_id_t id;
unsigned int port;
struct fwp_participant {
fwp_participant_id_t id;
unsigned int stream_id;
-
- fwp_contract_table_t contract_tbl;
+ fwp_endpoint_d_t epointd;
+ fwp_vres_d_t service_vresd;
+
+ gavl_node_t participant_tree_node;
} fwp_participant_t;
#endif /*_FWP_PARTICIPANT_H */