diff --git a/src/common/pack.c b/src/common/pack.c index c7701a3d826952af8f7f4b8ae17984a71efc97e4..fad30e23a1206fcbb3fc5de60c5ac5b9a9b5b15a 100644 --- a/src/common/pack.c +++ b/src/common/pack.c @@ -74,6 +74,7 @@ _unpack32array( uint32_t **valp, uint16_t* size_val, void **bufp, int *lenp) _unpack32( (*valp) + i , bufp, lenp ); } } + /* * Given a 16-bit integer in host byte order, convert to network byte order * and store at 'bufp'. Advance bufp by 2 bytes, decrement lenp by 2 bytes. @@ -221,4 +222,3 @@ _unpackmem_malloc(char **valp, uint16_t *size_valp, void **bufp, int *lenp) *valp = NULL; } - diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c index 3cd215637b106d98f4e7e39119b9a682439e2271..2283bb74e8e0c57e152e84657769cbdb356dff02 100644 --- a/src/common/slurm_protocol_api.c +++ b/src/common/slurm_protocol_api.c @@ -414,9 +414,9 @@ void slurm_pack_slurm_addr ( slurm_addr * slurm_address , void ** buffer , int * _slurm_pack_slurm_addr ( slurm_address , buffer , length ) ; } -void slurm_pack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) +void slurm_unpack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) { - _slurm_pack_slurm_addr_no_alloc ( slurm_address , buffer , length ) ; + _slurm_unpack_slurm_addr_no_alloc ( slurm_address , buffer , length ) ; } /************************/ diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h index bf9bfbb7e2c7d97f53ac6426d67293480495a49d..a71f03b75509847e00ee671abec8d31406538bb5 100644 --- a/src/common/slurm_protocol_api.h +++ b/src/common/slurm_protocol_api.h @@ -148,7 +148,7 @@ void inline slurm_set_addr_any ( slurm_addr * slurm_address , uint16_t port ) ; void inline slurm_set_addr_char ( slurm_addr * slurm_address , uint16_t port , char * host ) ; void inline slurm_get_addr ( slurm_addr * slurm_address , uint16_t * port , char * host , uint32_t buf_len ) ; void inline slurm_pack_slurm_addr ( slurm_addr * slurm_address , void ** buffer , int * length ) ; -void inline slurm_pack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) ; +void inline slurm_unpack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) ; /* Slurm message functions */ void slurm_free_msg ( slurm_msg_t * msg ) ; diff --git a/src/common/slurm_protocol_interface.h b/src/common/slurm_protocol_interface.h index e58231a5a5048e1b33550c7339624eb16b2c972b..c70da82af14c5ef4be027725e6d4c9dfe3a3c075 100644 --- a/src/common/slurm_protocol_interface.h +++ b/src/common/slurm_protocol_interface.h @@ -195,6 +195,6 @@ extern void _slurm_get_addr ( slurm_addr * slurm_address , uint16_t * port , cha /* pack routines for slurm_addr */ extern void _slurm_pack_slurm_addr ( slurm_addr * slurm_address , void ** buffer , int * length ) ; -extern void _slurm_pack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) ; +extern void _slurm_unpack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) ; #endif /* !_SLURM_PROTOCOL_INTERFACE_H */ diff --git a/src/common/slurm_protocol_pack.c b/src/common/slurm_protocol_pack.c index 50a436093bf3742001b740fa7970ada3b56de55d..428587e02325310164f66bb42220cab0e698f071 100644 --- a/src/common/slurm_protocol_pack.c +++ b/src/common/slurm_protocol_pack.c @@ -4,6 +4,7 @@ #include <string.h> #include <src/common/slurm_protocol_pack.h> +#include <src/common/slurm_protocol_api.h> #include <src/common/pack.h> #include <src/common/log.h> #include <src/common/nodelist.h> @@ -884,3 +885,27 @@ void unpack_ ( ** msg_ptr , void ** buffer , uint32_t * length ) } */ +void pack_slurm_addr_array ( slurm_addr * slurm_address , uint16_t size_val, void ** buffer , int * length ) +{ + int i=0; + uint16_t nl = htons(size_val); + _pack16( nl, buffer, length); + + for ( i=0; i < size_val; i++ ) + { + slurm_pack_slurm_addr ( slurm_address + i , buffer , length ) ; + } + +} + +void unpack_slurm_addr_array ( slurm_addr ** slurm_address , uint16_t * size_val , void ** buffer , int * length ) +{ + int i=0; + _unpack16( size_val, buffer , length ); + slurm_address = xmalloc( (*size_val) * sizeof( slurm_addr ) ); + + for ( i=0; i < *size_val; i++ ) + { + slurm_unpack_slurm_addr_no_alloc ( (*slurm_address) + i , buffer , length ); + } +} diff --git a/src/common/slurm_protocol_socket_implementation.c b/src/common/slurm_protocol_socket_implementation.c index 5774fe8e9871c1e6312e75a29bb70b6c50aaaf31..704cf152cfc2e67e667b2918b5a956d7aa5c064f 100644 --- a/src/common/slurm_protocol_socket_implementation.c +++ b/src/common/slurm_protocol_socket_implementation.c @@ -427,7 +427,7 @@ void _slurm_pack_slurm_addr ( slurm_addr * slurm_address , void ** buffer , int pack16 ( ntohs ( slurm_address -> sin_port ) , ( void ** ) buffer , length ) ; } -void _slurm_pack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) +void _slurm_unpack_slurm_addr_no_alloc ( slurm_addr * slurm_address , void ** buffer , int * length ) { slurm_address -> sin_family = AF_SLURM ; unpack32 ( & slurm_address -> sin_addr.s_addr , ( void ** ) buffer , length ) ;