summaryrefslogtreecommitdiff
path: root/src/ipcpd/normal/cdap_flow.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ipcpd/normal/cdap_flow.c')
-rw-r--r--src/ipcpd/normal/cdap_flow.c48
1 files changed, 44 insertions, 4 deletions
diff --git a/src/ipcpd/normal/cdap_flow.c b/src/ipcpd/normal/cdap_flow.c
index d3d98884..c694e637 100644
--- a/src/ipcpd/normal/cdap_flow.c
+++ b/src/ipcpd/normal/cdap_flow.c
@@ -67,12 +67,32 @@ struct cdap_flow * cdap_flow_arr(int fd,
flow->fd = fd;
flow->ci = NULL;
- if (cacep_listen(fd, info, &flow->info)) {
+ if (cacep_rcv(fd, &flow->info)) {
log_err("Error establishing application connection.");
cdap_flow_destroy(flow);
return NULL;
}
+ if (cacep_snd(fd, info)) {
+ log_err("Failed to respond to application connection request.");
+ cdap_flow_destroy(flow);
+ return NULL;
+ }
+
+ if (strcmp(flow->info.ae_name, info->ae_name)) {
+ log_err("Received connection for wrong AE.");
+ cdap_flow_destroy(flow);
+ return NULL;
+ }
+
+ if (strcmp(flow->info.protocol, info->protocol) ||
+ flow->info.pref_version != info->pref_version ||
+ flow->info.pref_syntax != info->pref_syntax) {
+ log_err("Unknown protocol.");
+ cdap_flow_destroy(flow);
+ return NULL;
+ }
+
flow->ci = cdap_create(fd);
if (flow->ci == NULL) {
log_err("Failed to create CDAP instance.");
@@ -87,8 +107,8 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name,
qosspec_t * qs,
const struct conn_info * info)
{
- struct cdap_flow * flow;
- int fd;
+ struct cdap_flow * flow;
+ int fd;
log_dbg("Allocating flow to %s.", dst_name);
@@ -120,12 +140,32 @@ struct cdap_flow * cdap_flow_alloc(const char * dst_name,
flow->fd = fd;
flow->ci = NULL;
- if (cacep_connect(fd, info, &flow->info)) {
+ if (cacep_snd(fd, info)) {
+ log_err("Failed to send connection request.");
+ cdap_flow_dealloc(flow);
+ return NULL;
+ }
+
+ if (cacep_rcv(fd, &flow->info)) {
log_err("Failed to connect to application.");
cdap_flow_dealloc(flow);
return NULL;
}
+ if (strcmp(flow->info.ae_name, info->ae_name)) {
+ log_err("Received connection for wrong AE.");
+ cdap_flow_destroy(flow);
+ return NULL;
+ }
+
+ if (strcmp(flow->info.protocol, info->protocol) ||
+ flow->info.pref_version != info->pref_version ||
+ flow->info.pref_syntax != info->pref_syntax) {
+ log_err("Unknown protocol.");
+ cdap_flow_destroy(flow);
+ return NULL;
+ }
+
flow->ci = cdap_create(fd);
if (flow->ci == NULL) {
log_err("Failed to create CDAP instance.");