diff --git a/src/common/slurm_protocol_api.h b/src/common/slurm_protocol_api.h index 08173cddd34f415beadcae6815aa6ed29c94cadd..7fab1d10bf628fa1428f50ee618f8aea927ba04a 100644 --- a/src/common/slurm_protocol_api.h +++ b/src/common/slurm_protocol_api.h @@ -27,17 +27,17 @@ enum controller_id { PRIMARY_CONTROLLER = 1, SECONDARY_CONTROLLER = 2 }; -/*****************************/ -/* configuration parameters */ -/*****************************/ +/**********************************************************************\ +* configuration parameters +\**********************************************************************/ /* slurmctld_conf must be loaded with port numbers and controller names */ extern slurm_ctl_conf_t slurmctld_conf; -/***************************************************/ -/* protocol configuration functions */ -/***************************************************/ +/**********************************************************************\ + * protocol configuration functions +\**********************************************************************/ /* slurm_set_api_config * sets the slurm_protocol_config object @@ -53,7 +53,8 @@ int inline slurm_set_api_config ( slurm_protocol_config_t * protocol_conf ); inline slurm_protocol_config_t * slurm_get_api_config ( ); /* slurm_api_set_default_config - * called by the send_controller_msg function to insure that at least the compiled in default slurm_protocol_config object is initialized + * called by the send_controller_msg function to insure that at least + * the compiled in default slurm_protocol_config object is initialized * RET int - return code */ int inline slurm_api_set_default_config ( ); @@ -64,34 +65,34 @@ int inline slurm_api_set_default_config ( ); */ short int inline slurm_get_slurmd_port ( ) ; -/***************************************************/ -/* server msg functions used by slurmctld, slurmd */ -/***************************************************/ +/**********************************************************************\ + * server msg functions used by slurmctld, slurmd +\**********************************************************************/ -/* In the socket implementation it creates a socket, binds to it, and listens for connections. - * In the mongo implemenetation is should just create a mongo socket , binds and return. +/* In the socket implementation it creates a socket, binds to it, and + * listens for connections. * IN port - port to bind the msg server to * RET slurm_fd - file descriptor of the connection created */ slurm_fd inline slurm_init_msg_engine_port ( uint16_t port ) ; -/* In the socket implementation it creates a socket, binds to it, and listens for connections. - * In the mongo implemenetation is should just create a mongo socket , bind and return. +/* In the socket implementation it creates a socket, binds to it, and + * listens for connections. * IN slurm_address - slurm_addr to bind the msg server to * RET slurm_fd - file descriptor of the connection created */ slurm_fd inline slurm_init_msg_engine ( slurm_addr * slurm_address ) ; /* In the bsd implmentation maps directly to a accept call - * In the mongo it returns the open_fd and is essentially a no-op function call * IN open_fd - file descriptor to accept connection on * OUT slurm_address - slurm_addr of the accepted connection * RET slurm_fd - file descriptor of the connection created */ -slurm_fd inline slurm_accept_msg_conn ( slurm_fd open_fd , slurm_addr * slurm_address ) ; +slurm_fd inline slurm_accept_msg_conn ( slurm_fd open_fd , + slurm_addr * slurm_address ) ; -/* In the bsd implmentation maps directly to a close call, to close the socket that was accepted - * In the mongo it is a no-op ( slurm_shutdown_msg_engine should be called to close the mongo socket since there is no "accept" phase for datagrams ) +/* In the bsd implmentation maps directly to a close call, to close + * the socket that was accepted * IN open_fd - an open file descriptor to close * RET int - the return code */ @@ -104,18 +105,20 @@ int inline slurm_close_accepted_conn ( slurm_fd open_fd ) ; int inline slurm_shutdown_msg_engine ( slurm_fd open_fd ) ; /* slurm_send_rc_msg - * given the original request message this function sends a slurm_return_code message back to the client that made the request + * given the original request message this function sends a + * slurm_return_code message back to the client that made the request * IN request_msg - slurm_msg the request msg * IN rc - the return_code to send back to the client */ void slurm_send_rc_msg ( slurm_msg_t * request_msg , int rc ); -/**********************************************************************/ -/* msg send and receive functions used by msg servers and msg clients */ -/**********************************************************************/ +/**********************************************************************\ + * msg send and receive functions used by msg servers and msg clients +\**********************************************************************/ /* - * NOTE: memory is allocated for the returned msg and must be freed at some point using the slurm_free_functions + * NOTE: memory is allocated for the returned msg and must be freed at + * some point using the slurm_free_functions * IN open_fd - file descriptor to receive msg on * OUT msg - a slurm_msg struct to be filled in by the function * RET int - size of msg received in bytes before being unpacked @@ -123,8 +126,10 @@ void slurm_send_rc_msg ( slurm_msg_t * request_msg , int rc ); int slurm_receive_msg ( slurm_fd open_fd , slurm_msg_t * msg ) ; /***** send msg functions */ -/* sends a slurm_protocol msg to the slurmctld based on location information retrieved from the slurmd.conf - * if unable to contant the primary slurmctld attempts will be made to contact the backup controller +/* sends a slurm_protocol msg to the slurmctld based on location + * information retrieved from the slurmd.conf. if unable to contant + * the primary slurmctld attempts will be made to contact the backup + * controller * * IN open_fd - file descriptor to send msg on * IN msg - a slurm msg struct to be sent @@ -140,22 +145,23 @@ int slurm_send_controller_msg ( slurm_fd open_fd , slurm_msg_t * msg ) ; */ int slurm_send_node_msg ( slurm_fd open_fd , slurm_msg_t * msg ) ; -/**********************************************************************/ -/* msg connection establishment functions used by msg clients */ -/**********************************************************************/ +/**********************************************************************\ + * msg connection establishment functions used by msg clients +\**********************************************************************/ -/* calls connect to make a connection-less datagram connection to the primary or - * secondary slurmctld message engine +/* calls connect to make a connection-less datagram connection to the + * primary or secondary slurmctld message engine * RET slurm_fd - file descriptor of the connection created * dest - controller to contact, primary or secondary */ slurm_fd inline slurm_open_controller_conn ( ) ; slurm_fd inline slurm_open_controller_conn_spec ( enum controller_id dest ) ; -/* In the bsd socket implementation it creates a SOCK_STREAM socket and calls connect on it - * In the mongo implementation it creates a SOCK_DGRAM socket and calls connect on it - * a SOCK_DGRAM socket called with connect is defined to only receive messages from the - * address/port pair argument of the connect call slurm_address - for now it is really +/* In the bsd socket implementation it creates a SOCK_STREAM socket and + * calls connect on it + * a SOCK_DGRAM socket called with connect is defined to only receive + * messages from the address/port pair argument of the connect + * call slurm_address - for now it is really * just a sockaddr_in * IN slurm_address - slurm_addr of the connection destination * RET slurm_fd - file descriptor of the connection created @@ -169,9 +175,9 @@ slurm_fd inline slurm_open_msg_conn ( slurm_addr * slurm_address ) ; int inline slurm_shutdown_msg_conn ( slurm_fd open_fd ) ; -/**********************************************************************/ -/* stream functions*/ -/**********************************************************************/ +/**********************************************************************\ + * stream functions +\**********************************************************************/ /* slurm_listen_stream * opens a stream server and listens on it @@ -186,7 +192,8 @@ slurm_fd inline slurm_listen_stream ( slurm_addr * slurm_address ) ; * OUT slurm_address - slurm_addr of the accepted connection * RET slurm_fd - file descriptor of the accepted connection */ -slurm_fd inline slurm_accept_stream ( slurm_fd open_fd , slurm_addr * slurm_address ) ; +slurm_fd inline slurm_accept_stream ( slurm_fd open_fd , + slurm_addr * slurm_address ) ; /* slurm_open_stream * opens a client connection to stream server @@ -209,8 +216,11 @@ int inline slurm_close_stream ( slurm_fd open_fd ) ; * IN size - size of buffer send * RET size_t - bytes sent , or -1 on errror */ -size_t inline slurm_write_stream ( slurm_fd open_fd , char * buffer , size_t size ) ; -size_t inline slurm_write_stream_timeout ( slurm_fd open_fd , char * buffer , size_t size , int timeout ) ; +size_t inline slurm_write_stream ( slurm_fd open_fd , char * buffer , + size_t size ) ; +size_t inline slurm_write_stream_timeout ( slurm_fd open_fd , + char * buffer , size_t size , + int timeout ) ; /* slurm_read_stream * read into buffer grom a stream file descriptor @@ -219,17 +229,23 @@ size_t inline slurm_write_stream_timeout ( slurm_fd open_fd , char * buffer , s * IN size - size of buffer * RET size_t - bytes read , or -1 on errror */ -size_t inline slurm_read_stream ( slurm_fd open_fd , char * buffer , size_t size ) ; -size_t inline slurm_read_stream_timeout ( slurm_fd open_fd , char * buffer , size_t size , int timeout ) ; +size_t inline slurm_read_stream ( slurm_fd open_fd , char * buffer , + size_t size ) ; +size_t inline slurm_read_stream_timeout ( slurm_fd open_fd , + char * buffer , size_t size , + int timeout ) ; /* slurm_get_stream_addr * esentially a encapsilated get_sockname * IN open_fd - file descriptor to retreive slurm_addr for * OUT address - address that open_fd to bound to */ -int inline slurm_get_stream_addr ( slurm_fd open_fd , slurm_addr * address ) ; +int inline slurm_get_stream_addr ( slurm_fd open_fd , + slurm_addr * address ) ; -int inline slurm_select(int n, slurm_fd_set *readfds, slurm_fd_set *writefds, slurm_fd_set *exceptfds, struct timeval *timeout) ; +int inline slurm_select(int n, slurm_fd_set *readfds, + slurm_fd_set *writefds, slurm_fd_set *exceptfds, + struct timeval *timeout) ; void inline slurm_FD_CLR(slurm_fd, slurm_fd_set *set) ; int inline slurm_FD_ISSET(slurm_fd, slurm_fd_set *set) ; void inline slurm_FD_SET(slurm_fd, slurm_fd_set *set) ; @@ -238,9 +254,10 @@ void inline slurm_FD_ZERO(slurm_fd_set *set) ; int inline slurm_set_stream_non_blocking ( slurm_fd open_fd ) ; int inline slurm_set_stream_blocking ( slurm_fd open_fd ) ; -/**********************************************************************/ -/* Address Conversion Functions */ -/**********************************************************************/ +/**********************************************************************\ + * Address Conversion Functions +\**********************************************************************/ + /* slurm_set_addr_uint * initializes the slurm_address with the port and ip_addrss passed to it @@ -248,14 +265,16 @@ int inline slurm_set_stream_blocking ( slurm_fd open_fd ) ; * IN port - port in host order * IN ip_address - ipv4 address in uint32 host order form */ -void inline slurm_set_addr_uint ( slurm_addr * slurm_address , uint16_t port , uint32_t ip_address ) ; +void inline slurm_set_addr_uint ( slurm_addr * slurm_address , + uint16_t port , uint32_t ip_address ) ; /* reset_slurm_addr * resets the address field of a slurm_addr, port and family remain unchanged * OUT slurm_address - slurm_addr to be reset in * IN new_address - source of address to write into slurm_address */ -void reset_slurm_addr ( slurm_addr * slurm_address , slurm_addr new_address ); +void reset_slurm_addr ( slurm_addr * slurm_address , + slurm_addr new_address ); /* slurm_set_addr * initializes the slurm_address with the port and ip_addrss passed to it @@ -264,7 +283,8 @@ void reset_slurm_addr ( slurm_addr * slurm_address , slurm_addr new_address ); * IN port - port in host order * IN host - hostname or dns name */ -void inline slurm_set_addr ( slurm_addr * slurm_address , uint16_t port , char * host ) ; +void inline slurm_set_addr ( slurm_addr * slurm_address , + uint16_t port , char * host ) ; /* slurm_set_addr_any * initialized the slurm_address with the port passed to in on INADDR_ANY @@ -272,7 +292,8 @@ void inline slurm_set_addr ( slurm_addr * slurm_address , uint16_t port , char * * OUT slurm_address - slurm_addr to be filled in * IN port - port in host order */ -void inline slurm_set_addr_any ( slurm_addr * slurm_address , uint16_t port ) ; +void inline slurm_set_addr_any ( slurm_addr * slurm_address , + uint16_t port ) ; /* slurm_set_addr * initializes the slurm_address with the port and ip_addrss passed to it @@ -280,7 +301,8 @@ void inline slurm_set_addr_any ( slurm_addr * slurm_address , uint16_t port ) ; * IN port - port in host order * IN host - hostname or dns name */ -void inline slurm_set_addr_char ( slurm_addr * slurm_address , uint16_t port , char * host ) ; +void inline slurm_set_addr_char ( slurm_addr * slurm_address , + uint16_t port , char * host ) ; /* slurm_get_addr * given a slurm_address it returns to port and hostname @@ -290,7 +312,9 @@ void inline slurm_set_addr_char ( slurm_addr * slurm_address , uint16_t port , c * OUT host - hostname * IN buf_len - length of hostname buffer */ -void inline slurm_get_addr ( slurm_addr * slurm_address , uint16_t * port , char * host , uint32_t buf_len ) ; +void inline slurm_get_addr ( slurm_addr * slurm_address , + uint16_t * port , char * host , + uint32_t buf_len ) ; /* slurm_print_slurm_addr * prints a slurm_addr into a buf @@ -298,25 +322,28 @@ void inline slurm_get_addr ( slurm_addr * slurm_address , uint16_t * port , char * IN buf - space for string representation of slurm_addr * IN n - max number of bytes to write (including NUL) */ -void inline slurm_print_slurm_addr ( slurm_addr * address, char *buf, size_t n ) ; +void inline slurm_print_slurm_addr ( slurm_addr * address, + char *buf, size_t n ) ; /* slurm_get_peer_addr * get the slurm address of the peer connection, similar to getpeeraddr * IN fd - an open connection * OUT slurm_address - place to park the peer's slurm_addr */ -int inline slurm_get_peer_addr ( slurm_fd fd, slurm_addr * slurm_address ) ; +int inline slurm_get_peer_addr ( slurm_fd fd, + slurm_addr * slurm_address ) ; -/**********************************************************************/ -/* slurm_addr pack routines*/ -/**********************************************************************/ +/**********************************************************************\ + * slurm_addr pack routines +\**********************************************************************/ /* slurm_pack_slurm_addr * packs a slurm_addr into a buffer to serialization transport * IN slurm_address - slurm_addr to pack * IN/OUT buffer - buffer to pack the slurm_addr into */ -void inline slurm_pack_slurm_addr ( slurm_addr * slurm_address , Buf buffer ) ; +void inline slurm_pack_slurm_addr ( slurm_addr * slurm_address , + Buf buffer ) ; /* slurm_pack_slurm_addr * unpacks a buffer into a slurm_addr after serialization transport @@ -324,38 +351,46 @@ void inline slurm_pack_slurm_addr ( slurm_addr * slurm_address , Buf buffer ) ; * IN/OUT buffer - buffer to upack the slurm_addr from * returns - SLURM error code */ -int inline slurm_unpack_slurm_addr_no_alloc ( slurm_addr * slurm_address , Buf buffer ) ; +int inline slurm_unpack_slurm_addr_no_alloc ( slurm_addr * slurm_address , + Buf buffer ) ; -/*******************************************/ -/* simplified communication routines - * They open a connection do work then close the connection all within the function*/ -/*******************************************/ +/**********************************************************************\ + * simplified communication routines + * They open a connection do work then close the connection all within + * the function +\**********************************************************************/ /* slurm_send_recv_controller_msg - * opens a connection to the controller, sends the controller a message, listens for the response, then closes the connection + * opens a connection to the controller, sends the controller a message, + * listens for the response, then closes the connection * IN request_msg - slurm_msg request * OUT response_msg - slurm_msg response * RET int - return code */ -int slurm_send_recv_controller_msg ( slurm_msg_t * request_msg , slurm_msg_t * response_msg ) ; +int slurm_send_recv_controller_msg ( slurm_msg_t * request_msg , + slurm_msg_t * response_msg ) ; /* slurm_send_recv_node_msg - * opens a connection to node, sends the node a message, listens for the response, then closes the connection + * opens a connection to node, sends the node a message, listens + * for the response, then closes the connection * IN request_msg - slurm_msg request * OUT response_msg - slurm_msg response * RET int - return code */ -int slurm_send_recv_node_msg ( slurm_msg_t * request_msg , slurm_msg_t * response_msg ) ; +int slurm_send_recv_node_msg ( slurm_msg_t * request_msg , + slurm_msg_t * response_msg ) ; /* slurm_send_only_controller_msg - * opens a connection to the controller, sends the controller a message then, closes the connection + * opens a connection to the controller, sends the controller a + * message then, closes the connection * IN request_msg - slurm_msg request * RET int - return code */ int slurm_send_only_node_msg ( slurm_msg_t * request_msg ) ; /* slurm_send_only_controller_msg - * opens a connection to node, sends the node a message then, closes the connection + * opens a connection to node, sends the node a message then, + * closes the connection * IN request_msg - slurm_msg request * RET int - return code */