From b1d605781449aaa7c32b28e0b3466deaec3c576f Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 26 Feb 2016 04:00:18 +0100 Subject: include: added data transfer constants to common.h dt_const contains data transfer constants dup_const contains constants for du protection --- include/ouroboros/common.h | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h index 09900a1f..d1ddddfa 100644 --- a/include/ouroboros/common.h +++ b/include/ouroboros/common.h @@ -38,22 +38,48 @@ typedef struct { typedef struct { char * ap_name; - int api_id; + int api_id; char * ae_name; - int aei_id; + int aei_id; } rina_name_t; /* FIXME: To be extended to have all QoS params */ struct qos_spec { - char * name; - char * dif_name; - double delay; - double jitter; + uint32_t delay; + uint32_t jitter; + +}; + +struct dtp_const { + /* pci field lengths, bits */ + /* most significant bit indicates head (0) or tail (1) */ + uint8_t addr_sz; + uint8_t cep_id_sz; + uint8_t pdu_length_sz; + /* not sure about port_id_sz... port_id's are not + part of dtp and should not go on the wire */ + /* uint8_t port_id_sz; */ + uint8_t qos_id_sz; + uint8_t seqnr_sz; + /* uint8_t ctrl_sqnum_sz; is this crap in the spec?? */ + + /* one will need this for hardware alignment */ + uint8_t pad_head_sz; + uint8_t pad_tail_sz; +}; + +struct dup_const { + /* pci field lengths, bits */ + /* most significant bit indicates head (0) or tail (1) */ + uint8_t ttl_sz; + uint8_t chk_sz; }; /* FIXME: What should be configurable in the DIF? */ struct dif_info { - int cep_id_size; + /* values, octets */ + uint32_t min_pdu_sz; + uint32_t max_pdu_sz; }; #endif -- cgit v1.2.3 From 66c25ea6e07852522430acfcd37a3a98abf6ac9e Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 26 Feb 2016 12:24:12 +0100 Subject: include: Updated common.h various fixes based on discussion on bitbucket --- include/ouroboros/common.h | 40 ++++++++++++++-------------------------- 1 file changed, 14 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h index d1ddddfa..c416df97 100644 --- a/include/ouroboros/common.h +++ b/include/ouroboros/common.h @@ -47,39 +47,27 @@ typedef struct { struct qos_spec { uint32_t delay; uint32_t jitter; - }; -struct dtp_const { - /* pci field lengths, bits */ - /* most significant bit indicates head (0) or tail (1) */ - uint8_t addr_sz; - uint8_t cep_id_sz; - uint8_t pdu_length_sz; - /* not sure about port_id_sz... port_id's are not - part of dtp and should not go on the wire */ - /* uint8_t port_id_sz; */ - uint8_t qos_id_sz; - uint8_t seqnr_sz; - /* uint8_t ctrl_sqnum_sz; is this crap in the spec?? */ - - /* one will need this for hardware alignment */ - uint8_t pad_head_sz; - uint8_t pad_tail_sz; -}; +struct dt_const { + /* constants for dtp */ + uint8_t addr_size; + uint8_t cep_id_size; + uint8_t pdu_length_size; + uint8_t qos_id_size; + uint8_t seqno_size; + /* uint8_t ctrl_sqnum_sz; is this in the spec?? */ -struct dup_const { - /* pci field lengths, bits */ - /* most significant bit indicates head (0) or tail (1) */ - uint8_t ttl_sz; - uint8_t chk_sz; + /* constants for dup */ + uint8_t ttl_size; + uint8_t chk_size; }; /* FIXME: What should be configurable in the DIF? */ struct dif_info { /* values, octets */ - uint32_t min_pdu_sz; - uint32_t max_pdu_sz; + uint32_t min_pdu_size; + uint32_t max_pdu_size; }; -#endif +#endif /* OUROBOROS_COMMON_H */ -- cgit v1.2.3 From 80da69bbed02a727abf18808c5addc6a3e17a213 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 26 Feb 2016 12:27:50 +0100 Subject: includ: Updated comment in common.h Now explains the size values are in bits as this comment was accidentally removed --- include/ouroboros/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h index c416df97..a5140c16 100644 --- a/include/ouroboros/common.h +++ b/include/ouroboros/common.h @@ -50,7 +50,7 @@ struct qos_spec { }; struct dt_const { - /* constants for dtp */ + /* dt field sizes in bits */ uint8_t addr_size; uint8_t cep_id_size; uint8_t pdu_length_size; -- cgit v1.2.3 From 7fe7ee2b190128cadee38664c59a595fac1fd3b1 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 26 Feb 2016 14:35:10 +0100 Subject: include: changed dt constants sizes back to bytes --- include/ouroboros/common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h index a5140c16..ed55a06c 100644 --- a/include/ouroboros/common.h +++ b/include/ouroboros/common.h @@ -50,7 +50,7 @@ struct qos_spec { }; struct dt_const { - /* dt field sizes in bits */ + /* dt field sizes in octets */ uint8_t addr_size; uint8_t cep_id_size; uint8_t pdu_length_size; -- cgit v1.2.3 From 63054ef2da3e49bc36a7facb9539c98c031c56c8 Mon Sep 17 00:00:00 2001 From: Dimitri Staessens Date: Fri, 26 Feb 2016 15:34:47 +0100 Subject: ipcp: Addresses comments on 62eba34 --- include/ouroboros/common.h | 2 ++ src/ipcpd/pci.c | 47 ++++++++++++++++++++-------------------------- src/ipcpd/pci.h | 4 ++-- 3 files changed, 24 insertions(+), 29 deletions(-) (limited to 'include') diff --git a/include/ouroboros/common.h b/include/ouroboros/common.h index a18a8548..36f6171c 100644 --- a/include/ouroboros/common.h +++ b/include/ouroboros/common.h @@ -67,6 +67,8 @@ struct dif_info { /* values, octets */ uint32_t min_pdu_size; uint32_t max_pdu_size; + + struct dt_const dtc; }; #endif /* OUROBOROS_COMMON_H */ diff --git a/src/ipcpd/pci.c b/src/ipcpd/pci.c index 1fd263d3..d4ef9033 100644 --- a/src/ipcpd/pci.c +++ b/src/ipcpd/pci.c @@ -25,13 +25,13 @@ #include #include -#define head_size(a, b) a.addr_size * 2 + \ +#define HEAD_SIZE(a, b) a.addr_size * 2 + \ a.cep_id_size * 2 + \ a.pdu_length_size + \ a.seqno_size + \ a.qos_id_size + \ b.ttl_size -#define tail_size(b) b.chk_size +#define TAIL_SIZE(b) b.chk_size struct pci { @@ -41,7 +41,8 @@ struct pci { uint8_t * dst_cep_id; uint8_t * src_cep_id; uint8_t * pdu_length; - uint8_t * ttl; uint8_t * seqno; + uint8_t * ttl; + uint8_t * seqno; uint8_t * qos_id; uint8_t * chk; @@ -53,9 +54,9 @@ struct pci { }; -pci_t * pci_create(du_buff_t * dub, - const struct ipcp_dtp_const dtpc, - const struct ipcp_dup_const dupc) +pci_t * pci_create(du_buff_t * dub, + const struct ipcp_dtp_const * dtpc, + const struct ipcp_dup_const * dupc) { if (dub == NULL) { @@ -69,34 +70,26 @@ pci_t * pci_create(du_buff_t * dub, return NULL; p->dub = dub; -/* - p->dtpc = malloc( sizeof *(p->dtpc)); - if (p->dtpc == NULL) - return NULL; - p->dupc = malloc( sizeof *(p->dupc)); - if (p->dupc == NULL) - return NULL; -*/ - p->dtpc = dtpc; - p->dupc = dupc; + p->dtpc = *dtpc; + p->dupc = *dupc; - p->dst_addr = NULL; - p->src_addr =NULL; + p->dst_addr = NULL; + p->src_addr = NULL; p->dst_cep_id = NULL; p->src_cep_id = NULL; p->pdu_length = NULL; - p->ttl = NULL; - p->seqno = NULL; - p->qos_id = NULL; - p->chk = NULL; + p->ttl = NULL; + p->seqno = NULL; + p->qos_id = NULL; + p->chk = NULL; return p; } void pci_destroy(pci_t * pci) { - free (pci); + free(pci); } int pci_init(pci_t * pci) @@ -107,8 +100,8 @@ int pci_init(pci_t * pci) } uint8_t * pci_head = du_buff_head_alloc(pci->dub, - head_size(pci->dtpc,pci->dupc)); - uint8_t * pci_tail = du_buff_tail_alloc(pci->dub, tail_size(pci->dupc)); + HEAD_SIZE(pci->dtpc,pci->dupc)); + uint8_t * pci_tail = du_buff_tail_alloc(pci->dub, TAIL_SIZE(pci->dupc)); if (pci_head == NULL) { LOG_DBG("Failed to allocate space for PCI at head."); @@ -142,6 +135,6 @@ void pci_release(pci_t * pci) if (pci->dub == NULL) return; - du_buff_head_release(pci->dub, head_size(pci->dtpc, pci->dupc)); - du_buff_tail_release(pci->dub, tail_size(pci->dupc)); + du_buff_head_release(pci->dub, HEAD_SIZE(pci->dtpc, pci->dupc)); + du_buff_tail_release(pci->dub, TAIL_SIZE(pci->dupc)); } diff --git a/src/ipcpd/pci.h b/src/ipcpd/pci.h index 5b11a021..c7095bbd 100644 --- a/src/ipcpd/pci.h +++ b/src/ipcpd/pci.h @@ -35,8 +35,8 @@ struct pci; typedef struct pci pci_t; pci_t * pci_create(du_buff_t * dub, - const struct ipcp_dtp_const dtpc, - const struct ipcp_dup_const dupc); + const struct ipcp_dtp_const * dtpc, + const struct ipcp_dup_const * dupc); void pci_destroy(pci_t * pci); int pci_init(pci_t * pci); -- cgit v1.2.3