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
883cd78e
Commit
883cd78e
authored
22 years ago
by
tewk
Browse files
Options
Downloads
Patches
Plain Diff
cleanup and added send/receive message buffer routines
parent
240b2ffa
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/common/slurm_protocol_api.c
+70
-31
70 additions, 31 deletions
src/common/slurm_protocol_api.c
with
70 additions
and
31 deletions
src/common/slurm_protocol_api.c
+
70
−
31
View file @
883cd78e
#include
<stdlib.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<stdio.h>
#include
<string.h>
#include
<src/common/slurm_protocol_interface.h>
#include
<src/common/slurm_protocol_interface.h>
#include
<src/common/slurm_protocol_defs.h>
#include
<src/common/slurm_protocol_defs.h>
...
@@ -96,8 +97,8 @@ uint32_t slurm_send_server_message ( slurm_fd open_fd , slurm_message_type_t mes
...
@@ -96,8 +97,8 @@ uint32_t slurm_send_server_message ( slurm_fd open_fd , slurm_message_type_t mes
uint32_t
slurm_send_node_message
(
slurm_fd
open_fd
,
slurm_addr
*
destination_address
,
slurm_message_type_t
message_type
,
slurm_message_t
const
*
message
)
uint32_t
slurm_send_node_message
(
slurm_fd
open_fd
,
slurm_addr
*
destination_address
,
slurm_message_type_t
message_type
,
slurm_message_t
const
*
message
)
{
{
char
buftemp
[
MAX_MESSAGE_BUFFER_SIZE
]
;
char
buf
_
temp
[
MAX_MESSAGE_BUFFER_SIZE
]
;
char
*
buffer
=
buftemp
;
char
*
buffer
=
buf
_
temp
;
header_t
header
;
header_t
header
;
uint32_t
rc
;
uint32_t
rc
;
uint32_t
pack_len
;
uint32_t
pack_len
;
...
@@ -113,7 +114,7 @@ uint32_t slurm_send_node_message ( slurm_fd open_fd , slurm_addr * destination_a
...
@@ -113,7 +114,7 @@ uint32_t slurm_send_node_message ( slurm_fd open_fd , slurm_addr * destination_a
pack_message
(
&
buffer
,
&
pack_len
,
message
)
;
pack_message
(
&
buffer
,
&
pack_len
,
message
)
;
/* send message */
/* send message */
rc
=
_slurm_message_sendto
(
open_fd
,
buf
fer
,
pack_len
,
NO_SEND_RECV_FLAGS
,
destination_address
)
;
rc
=
_slurm_message_sendto
(
open_fd
,
buf
_temp
,
pack_len
,
NO_SEND_RECV_FLAGS
,
destination_address
)
;
if
(
rc
==
SLURM_SOCKET_ERROR
)
if
(
rc
==
SLURM_SOCKET_ERROR
)
{
{
if
(
debug
)
if
(
debug
)
...
@@ -124,34 +125,72 @@ uint32_t slurm_send_node_message ( slurm_fd open_fd , slurm_addr * destination_a
...
@@ -124,34 +125,72 @@ uint32_t slurm_send_node_message ( slurm_fd open_fd , slurm_addr * destination_a
}
}
return
pack_len
;
return
pack_len
;
}
}
/* No overloading allowed
uint32_t slurm_send_server_message ( slurm_fd open_fd , slurm_message_type_t message_type , char * buffer , size_t buf_len )
uint32_t
slurm_receive_buffer
(
slurm_fd
open_fd
,
slurm_addr
*
source_address
,
slurm_message_type_t
*
message_type
,
char
**
data_buffer
,
size_t
buf_len
)
{
{
return SLURM_NOT_IMPLEMENTED ;
char
buftemp
[
MAX_MESSAGE_BUFFER_SIZE
]
;
}
char
*
buffer
=
buftemp
;
header_t
header
;
uint32_t slurm_send_node_message ( slurm_fd open_fd , slurm_addr destination_address , slurm_message_type_t message_type , char * buffer , size_t buf_len )
int32_t
rc
;
{
uint32_t
unpack_len
;
char * buffer[DEFAULT_BUFFER_SIZE] ;
uint32_t
receive_len
=
MAX_MESSAGE_BUFFER_SIZE
;
header_t header ;
uint32_t rc ;
rc
=
_slurm_message_recvfrom
(
open_fd
,
buffer
,
receive_len
,
NO_SEND_RECV_FLAGS
,
source_address
)
;
*/
if
(
rc
==
SLURM_SOCKET_ERROR
)
/* initheader */
{
/*
if
(
debug
)
init_header ( header , message_type ) ;
{
fprintf
(
stderr
,
"Error recieving message socket: errno %i
\n
"
,
errno
)
;
rc = _slurm_sendto ( open_fd , buffer , send_len , NO_SEND_RECV_FLAGS , destination_address ) ;
}
if ( rc == SLURM_SOCKET_ERROR )
return
rc
;
{
}
if ( debug )
{
/* unpack header */
fprintf( stderr, "Error sending message socket: errno %i", errno ) ;
unpack_len
=
rc
;
}
unpack_header
(
&
buffer
,
&
unpack_len
,
&
header
)
;
return rc ;
}
rc
=
check_header_version
(
&
header
)
;
return rc ;
if
(
rc
<
0
)
return
rc
;
}
*
message_type
=
header
.
message_type
;
*/
*
data_buffer
=
buffer
;
return
unpack_len
;
}
uint32_t
slurm_send_server_buffer
(
slurm_fd
open_fd
,
slurm_message_type_t
message_type
,
char
*
data_buffer
,
size_t
buf_len
)
{
return
SLURM_NOT_IMPLEMENTED
;
}
uint32_t
slurm_send_node_buffer
(
slurm_fd
open_fd
,
slurm_addr
*
destination_address
,
slurm_message_type_t
message_type
,
char
*
data_buffer
,
size_t
buf_len
)
{
char
buf_temp
[
MAX_MESSAGE_BUFFER_SIZE
]
;
char
*
buffer
=
buf_temp
;
header_t
header
;
uint32_t
rc
;
uint32_t
pack_len
;
/* initheader */
init_header
(
&
header
,
message_type
,
SLURM_PROTOCOL_NO_FLAGS
)
;
/* pack header */
pack_len
=
0
;
pack_header
(
&
buffer
,
&
pack_len
,
&
header
)
;
/* pack message */
memcpy
(
buffer
,
data_buffer
,
buf_len
)
;
pack_len
+=
buf_len
;
rc
=
_slurm_message_sendto
(
open_fd
,
buf_temp
,
pack_len
,
NO_SEND_RECV_FLAGS
,
destination_address
)
;
if
(
rc
==
SLURM_SOCKET_ERROR
)
{
if
(
debug
)
{
fprintf
(
stderr
,
"Error sending message socket: errno %i"
,
errno
)
;
}
return
rc
;
}
return
rc
;
}
/***** stream functions */
/***** stream functions */
slurm_fd
slurm_listen_stream
(
slurm_addr
*
slurm_address
)
slurm_fd
slurm_listen_stream
(
slurm_addr
*
slurm_address
)
...
...
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