Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
d104ab6f
Commit
d104ab6f
authored
22 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
No logic changes, just code clean-up
parent
26c61487
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/slurm_protocol_interface.h
+84
-38
84 additions, 38 deletions
src/common/slurm_protocol_interface.h
src/common/slurm_protocol_pack.c
+407
-174
407 additions, 174 deletions
src/common/slurm_protocol_pack.c
with
491 additions
and
212 deletions
src/common/slurm_protocol_interface.h
+
84
−
38
View file @
d104ab6f
...
@@ -70,15 +70,20 @@
...
@@ -70,15 +70,20 @@
** Data Types **
** Data Types **
\****************/
\****************/
typedef
enum
slurm_socket_type
{
SLURM_MESSAGE
,
SLURM_STREAM
}
slurm_socket_type_t
;
typedef
enum
slurm_socket_type
{
SLURM_MESSAGE
,
SLURM_STREAM
}
slurm_socket_type_t
;
/*******************************\
/*******************************\
** MIDDLE LAYER FUNCTIONS **
** MIDDLE LAYER FUNCTIONS **
\*******************************/
\*******************************/
/* The must have funtions are required to implement a low level plugin for the slurm protocol
/* The must have funtions are required to implement a low level plugin
* the general purpose functions just wrap standard socket calls, so if the underlying layer
* for the slurm protocol the general purpose functions just wrap
* implements a socket like interface, it can be used as a low level transport plugin with slurm
* standard socket calls, so if the underlying layer implements a
* the _slurm_recv and _slurm_send functions are also needed
* socket like interface, it can be used as a low level transport
* plugin with slurm the _slurm_recv and _slurm_send functions are
* also needed
*/
*/
...
@@ -92,43 +97,65 @@ slurm_fd _slurm_create_socket (slurm_socket_type_t type) ;
...
@@ -92,43 +97,65 @@ slurm_fd _slurm_create_socket (slurm_socket_type_t type) ;
/*****************/
/*****************/
slurm_fd
_slurm_init_msg_engine
(
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_init_msg_engine
(
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_open_msg_conn
(
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_open_msg_conn
(
slurm_addr
*
slurm_address
)
;
ssize_t
_slurm_msg_recvfrom
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
)
;
ssize_t
_slurm_msg_recvfrom
(
slurm_fd
open_fd
,
char
*
buffer
,
ssize_t
_slurm_msg_recvfrom_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
,
int
timeout
)
;
size_t
size
,
ssize_t
_slurm_msg_sendto
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
)
;
uint32_t
flags
,
slurm_addr
*
slurm_address
)
;
ssize_t
_slurm_msg_sendto_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
,
int
timeout
)
;
ssize_t
_slurm_msg_recvfrom_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
slurm_fd
_slurm_accept_msg_conn
(
slurm_fd
open_fd
,
slurm_addr
*
slurm_address
)
;
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
,
int
timeout
)
;
ssize_t
_slurm_msg_sendto
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
)
;
ssize_t
_slurm_msg_sendto_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
slurm_addr
*
slurm_address
,
int
timeout
)
;
slurm_fd
_slurm_accept_msg_conn
(
slurm_fd
open_fd
,
slurm_addr
*
slurm_address
)
;
int
_slurm_close_accepted_conn
(
slurm_fd
open_fd
)
;
int
_slurm_close_accepted_conn
(
slurm_fd
open_fd
)
;
/********************/
/********************/
/* stream functions */
/* stream functions */
/********************/
/********************/
slurm_fd
_slurm_listen_stream
(
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_listen_stream
(
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_accept_stream
(
slurm_fd
open_fd
,
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_accept_stream
(
slurm_fd
open_fd
,
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_open_stream
(
slurm_addr
*
slurm_address
)
;
slurm_fd
_slurm_open_stream
(
slurm_addr
*
slurm_address
)
;
extern
int
_slurm_get_stream_addr
(
slurm_fd
open_fd
,
slurm_addr
*
address
)
;
extern
int
_slurm_get_stream_addr
(
slurm_fd
open_fd
,
slurm_addr
*
address
)
;
extern
int
_slurm_close_stream
(
slurm_fd
open_fd
)
;
extern
int
_slurm_close_stream
(
slurm_fd
open_fd
)
;
extern
inline
int
_slurm_set_stream_non_blocking
(
slurm_fd
open_fd
)
;
extern
inline
int
_slurm_set_stream_non_blocking
(
slurm_fd
open_fd
)
;
extern
inline
int
_slurm_set_stream_blocking
(
slurm_fd
open_fd
)
;
extern
inline
int
_slurm_set_stream_blocking
(
slurm_fd
open_fd
)
;
int
_slurm_send_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
int
timeout
)
;
int
_slurm_send_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
int
_slurm_recv_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
int
timeout
)
;
size_t
size
,
uint32_t
flags
,
int
timeout
)
;
int
_slurm_recv_timeout
(
slurm_fd
open_fd
,
char
*
buffer
,
size_t
size
,
uint32_t
flags
,
int
timeout
)
;
/***************************/
/***************************/
/* slurm address functions */
/* slurm address functions */
/***************************/
/***************************/
extern
void
_slurm_set_addr_uint
(
slurm_addr
*
slurm_address
,
uint16_t
port
,
uint32_t
ip_address
)
;
extern
void
_slurm_set_addr_uint
(
slurm_addr
*
slurm_address
,
extern
void
_reset_slurm_addr
(
slurm_addr
*
slurm_address
,
slurm_addr
new_address
);
uint16_t
port
,
uint32_t
ip_address
)
;
extern
void
_slurm_set_addr
(
slurm_addr
*
slurm_address
,
uint16_t
port
,
char
*
host
)
;
extern
void
_reset_slurm_addr
(
slurm_addr
*
slurm_address
,
extern
void
_slurm_set_addr_char
(
slurm_addr
*
slurm_address
,
uint16_t
port
,
char
*
host
)
;
slurm_addr
new_address
);
extern
void
_slurm_get_addr
(
slurm_addr
*
slurm_address
,
uint16_t
*
port
,
char
*
host
,
uint32_t
buf_len
)
;
extern
void
_slurm_set_addr
(
slurm_addr
*
slurm_address
,
extern
void
_slurm_print_slurm_addr
(
slurm_addr
*
address
,
char
*
buf
,
size_t
n
)
;
uint16_t
port
,
char
*
host
)
;
extern
void
_slurm_set_addr_char
(
slurm_addr
*
slurm_address
,
uint16_t
port
,
char
*
host
)
;
extern
void
_slurm_get_addr
(
slurm_addr
*
slurm_address
,
uint16_t
*
port
,
char
*
host
,
uint32_t
buf_len
)
;
extern
void
_slurm_print_slurm_addr
(
slurm_addr
*
address
,
char
*
buf
,
size_t
n
)
;
/*****************************/
/*****************************/
/* slurm addr pack functions */
/* slurm addr pack functions */
/*****************************/
/*****************************/
extern
void
_slurm_pack_slurm_addr
(
slurm_addr
*
slurm_address
,
Buf
buffer
)
;
extern
void
_slurm_pack_slurm_addr
(
slurm_addr
*
slurm_address
,
extern
int
_slurm_unpack_slurm_addr_no_alloc
(
slurm_addr
*
slurm_address
,
Buf
buffer
)
;
Buf
buffer
)
;
extern
int
_slurm_unpack_slurm_addr_no_alloc
(
slurm_addr
*
slurm_address
,
Buf
buffer
)
;
/*******************************\
/*******************************\
...
@@ -144,16 +171,19 @@ extern int _slurm_socket (int __domain, int __type, int __protocol) ;
...
@@ -144,16 +171,19 @@ extern int _slurm_socket (int __domain, int __type, int __protocol) ;
* protocol PROTOCOL, which are connected to each other, and put file
* protocol PROTOCOL, which are connected to each other, and put file
* descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
* descriptors for them in FDS[0] and FDS[1]. If PROTOCOL is zero,
* one will be chosen automatically. Returns 0 on success, -1 for errors. */
* one will be chosen automatically. Returns 0 on success, -1 for errors. */
extern
int
_slurm_socketpair
(
int
__domain
,
int
__type
,
int
__protocol
,
int
__fds
[
2
])
;
extern
int
_slurm_socketpair
(
int
__domain
,
int
__type
,
int
__protocol
,
int
__fds
[
2
])
;
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
extern
int
_slurm_bind
(
int
__fd
,
struct
sockaddr
const
*
__addr
,
socklen_t
__len
)
;
extern
int
_slurm_bind
(
int
__fd
,
struct
sockaddr
const
*
__addr
,
socklen_t
__len
)
;
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
* For connectionless socket types, just set the default address to send to
* For connectionless socket types, just set the default address to send to
* and the only address from which to accept transmissions.
* and the only address from which to accept transmissions.
* Return 0 on success, -1 for errors. */
* Return 0 on success, -1 for errors. */
extern
int
_slurm_connect
(
int
__fd
,
struct
sockaddr
const
*
__addr
,
socklen_t
__len
)
;
extern
int
_slurm_connect
(
int
__fd
,
struct
sockaddr
const
*
__addr
,
socklen_t
__len
)
;
/* Prepare to accept connections on socket FD.
/* Prepare to accept connections on socket FD.
* N connection requests will be queued before further requests are refused.
* N connection requests will be queued before further requests are refused.
...
@@ -165,17 +195,21 @@ extern int _slurm_listen (int __fd, int __n) ;
...
@@ -165,17 +195,21 @@ extern int _slurm_listen (int __fd, int __n) ;
* set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
* set *ADDR (which is *ADDR_LEN bytes long) to the address of the connecting
* peer and *ADDR_LEN to the address's actual length, and return the
* peer and *ADDR_LEN to the address's actual length, and return the
* new socket's descriptor, or -1 for errors. */
* new socket's descriptor, or -1 for errors. */
extern
int
_slurm_accept
(
int
__fd
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__addr_len
)
;
extern
int
_slurm_accept
(
int
__fd
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__addr_len
)
;
/* Put the local address of FD into *ADDR and its length in *LEN. */
/* Put the local address of FD into *ADDR and its length in *LEN. */
extern
int
_slurm_getsockname
(
int
__fd
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__len
)
;
extern
int
_slurm_getsockname
(
int
__fd
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__len
)
;
/* Put the address of the peer connected to socket FD into *ADDR
/* Put the address of the peer connected to socket FD into *ADDR
* (which is *LEN bytes long), and its actual length into *LEN. */
* (which is *LEN bytes long), and its actual length into *LEN. */
extern
int
_slurm_getpeername
(
int
__fd
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__len
)
;
extern
int
_slurm_getpeername
(
int
__fd
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__len
)
;
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
/* Send N bytes of BUF to socket FD. Returns the number sent or -1. */
extern
ssize_t
_slurm_send
(
int
__fd
,
__const
void
*
__buf
,
size_t
__n
,
int
__flags
)
;
extern
ssize_t
_slurm_send
(
int
__fd
,
__const
void
*
__buf
,
size_t
__n
,
int
__flags
)
;
extern
ssize_t
_slurm_write
(
int
__fd
,
__const
void
*
__buf
,
size_t
__n
)
;
extern
ssize_t
_slurm_write
(
int
__fd
,
__const
void
*
__buf
,
size_t
__n
)
;
/* Read N bytes into BUF from socket FD.
/* Read N bytes into BUF from socket FD.
...
@@ -185,31 +219,40 @@ extern ssize_t _slurm_read (int __fd, void *__buf, size_t __n) ;
...
@@ -185,31 +219,40 @@ extern ssize_t _slurm_read (int __fd, void *__buf, size_t __n) ;
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
/* Send N bytes of BUF on socket FD to peer at address ADDR (which is
* ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
* ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
extern
ssize_t
_slurm_sendto
(
int
__fd
,
__const
void
*
__buf
,
size_t
__n
,
int
__flags
,
struct
sockaddr
const
*
__addr
,
socklen_t
__addr_len
)
;
extern
ssize_t
_slurm_sendto
(
int
__fd
,
__const
void
*
__buf
,
size_t
__n
,
int
__flags
,
struct
sockaddr
const
*
__addr
,
socklen_t
__addr_len
)
;
/* Send a msg described MESSAGE on socket FD.
/* Send a msg described MESSAGE on socket FD.
* Returns the number of bytes sent, or -1 for errors. */
* Returns the number of bytes sent, or -1 for errors. */
extern
ssize_t
_slurm_sendmsg
(
int
__fd
,
__const
struct
msghdr
*
__msg
,
int
__flags
)
;
extern
ssize_t
_slurm_sendmsg
(
int
__fd
,
__const
struct
msghdr
*
__msg
,
int
__flags
)
;
/* Read N bytes into BUF through socket FD.
/* Read N bytes into BUF through socket FD.
* If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
* If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
* the sender, and store the actual size of the address in *ADDR_LEN.
* the sender, and store the actual size of the address in *ADDR_LEN.
* Returns the number of bytes read or -1 for errors. */
* Returns the number of bytes read or -1 for errors. */
extern
ssize_t
_slurm_recvfrom
(
int
__fd
,
void
*
__restrict
__buf
,
size_t
__n
,
int
__flags
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__addr_len
)
;
extern
ssize_t
_slurm_recvfrom
(
int
__fd
,
void
*
__restrict
__buf
,
size_t
__n
,
int
__flags
,
struct
sockaddr
*
__addr
,
socklen_t
*
__restrict
__addr_len
)
;
/* Send a msg described MESSAGE on socket FD.
/* Send a msg described MESSAGE on socket FD.
* Returns the number of bytes read or -1 for errors. */
* Returns the number of bytes read or -1 for errors. */
extern
ssize_t
_slurm_recvmsg
(
int
__fd
,
struct
msghdr
*
__msg
,
int
__flags
)
;
extern
ssize_t
_slurm_recvmsg
(
int
__fd
,
struct
msghdr
*
__msg
,
int
__flags
)
;
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
/* Put the current value for socket FD's option OPTNAME at protocol level LEVEL
* into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
* into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
* actual length. Returns 0 on success, -1 for errors. */
* actual length. Returns 0 on success, -1 for errors. */
extern
int
_slurm_getsockopt
(
int
__fd
,
int
__level
,
int
__optname
,
void
*
__restrict
__optval
,
socklen_t
*
__restrict
__optlen
)
;
extern
int
_slurm_getsockopt
(
int
__fd
,
int
__level
,
int
__optname
,
void
*
__restrict
__optval
,
socklen_t
*
__restrict
__optlen
)
;
/* Set socket FD's option OPTNAME at protocol level LEVEL
/* Set socket FD's option OPTNAME at protocol level LEVEL
* to *OPTVAL (which is OPTLEN bytes long).
* to *OPTVAL (which is OPTLEN bytes long).
* Returns 0 on success, -1 for errors. */
* Returns 0 on success, -1 for errors. */
extern
int
_slurm_setsockopt
(
int
__fd
,
int
__level
,
int
__optname
,
__const
void
*
__optval
,
socklen_t
__optlen
)
;
extern
int
_slurm_setsockopt
(
int
__fd
,
int
__level
,
int
__optname
,
__const
void
*
__optval
,
socklen_t
__optlen
)
;
/* Shut down all or part of the connection open on socket FD.
/* Shut down all or part of the connection open on socket FD.
* HOW determines what to shut down:
* HOW determines what to shut down:
...
@@ -222,10 +265,13 @@ extern int _slurm_close (int __fd ) ;
...
@@ -222,10 +265,13 @@ extern int _slurm_close (int __fd ) ;
/* Non-blocking calls */
/* Non-blocking calls */
extern
int
_slurm_select
(
int
n
,
fd_set
*
readfds
,
fd_set
*
writefds
,
fd_set
*
exceptfds
,
struct
timeval
*
timeout
);
extern
int
_slurm_select
(
int
n
,
fd_set
*
readfds
,
fd_set
*
writefds
,
/* extern int _slurm_pselect(int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, const struct timespec *timeout, sigset_t * sigmask); */
fd_set
*
exceptfds
,
struct
timeval
*
timeout
);
/* extern int _slurm_pselect(int n, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, const struct timespec *timeout,
sigset_t * sigmask); */
void
_slurm_FD_CLR
(
int
fd
,
fd_set
*
set
);
void
_slurm_FD_CLR
(
int
fd
,
fd_set
*
set
);
int
_slurm_FD_ISSET
(
int
fd
,
fd_set
*
set
);
int
_slurm_FD_ISSET
(
int
fd
,
fd_set
*
set
);
void
_slurm_FD_SET
(
int
fd
,
fd_set
*
set
);
void
_slurm_FD_SET
(
int
fd
,
fd_set
*
set
);
void
_slurm_FD_ZERO
(
fd_set
*
set
);
void
_slurm_FD_ZERO
(
fd_set
*
set
);
...
...
This diff is collapsed.
Click to expand it.
src/common/slurm_protocol_pack.c
+
407
−
174
View file @
d104ab6f
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment