Yes, can do that.
Even though it is very unlikely.. good to check the return ptr-value of
`encode_reserve_space`. If `NULL` log the error and return FAILURE.
Regards,
Ramesh.
On 5/14/2014 2:01 PM, Hans Feldt wrote:
> Hi,
>
> While looking at removing(reducing) use of EDU from AMF I found that other
> services end up in creating their own support.
> Services not using EDU is IMM, CLM, NTF and SMF meaning they end up
> duplicating the same logic again and again due to missing good support.
>
> So my question is can we put something like the below in a common new utility
> contained in core?
>
> I did some functions that looks like this:
> void encode_uint8(NCS_UBAID *ub, uint8_t value);
> void decode_uint8(NCS_UBAID *ub, uint8_t *to);
> void encode_uint16(NCS_UBAID *ub, uint16_t value);
> void decode_uint16(NCS_UBAID *ub, uint16_t *to);
> void encode_uint32(NCS_UBAID *ub, uint32_t value);
> void decode_uint32(NCS_UBAID *ub, uint32_t *to);
> void encode_uint64(NCS_UBAID *ub, uint64_t value);
> void decode_uint64(NCS_UBAID *ub, uint64_t *to);
> void encode_sanamet(NCS_UBAID *ub, const SaNameT *name);
> void decode_sanamet(NCS_UBAID *ub, SaNameT *name);
> void encode_satimet(NCS_UBAID *ub, SaTimeT time);
> void decode_satimet(NCS_UBAID *ub, SaTimeT *time);
> void encode_bool(NCS_UBAID *ub, bool value);
> void decode_bool(NCS_UBAID *ub, uint32_t *to);
>
> where for example encode_uint32 look like:
>
> void encode_uint32(NCS_UBAID *ub, uint32_t value)
> {
> uint8_t *p8 = encode_reserve_space(ub, 4);
> ncs_encode_32bit(&p8, value);
> ncs_enc_claim_space(ub, 4);
> }
>
> This equals what immsv_evt.c is doing in many places (duplication):
> IMMSV_RSRV_SPACE_ASSERT(p8, o_ub, 4);
> ncs_encode_32bit(&p8, os->size);
> ncs_enc_claim_space(o_ub, 4);
>
------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel