Newer
Older
/****************************************************************************\
* slurm_protocol_pack.c - functions to pack and unpack structures for RPCs
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Kevin Tew <tew1@llnl.gov>, Moe Jette <jette1@llnl.gov>, et. al.
* UCRL-CODE-2002-040.
*
* This file is part of SLURM, a resource management program.
* For details, see <http://www.llnl.gov/linux/slurm/>.
*
* SLURM is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along
* with SLURM; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
\*****************************************************************************/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include "src/common/bitstring.h"
#include "src/common/log.h"
#include "src/common/pack.h"
#include "src/common/slurm_auth.h"
#include "src/common/slurm_protocol_api.h"
#include "src/common/slurm_protocol_defs.h"
#include "src/common/slurm_protocol_pack.h"
#include "src/common/xmalloc.h"
#define _pack_job_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
#define _pack_job_step_info_msg(msg,buf) _pack_buffer_msg(msg,buf)
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
static void _pack_update_node_msg(update_node_msg_t * msg, Buf buffer);
static int _unpack_update_node_msg(update_node_msg_t ** msg, Buf buffer);
static void
_pack_node_registration_status_msg(slurm_node_registration_status_msg_t *
msg, Buf buffer);
static int
_unpack_node_registration_status_msg(slurm_node_registration_status_msg_t
** msg, Buf buffer);
static void
_pack_resource_allocation_response_msg(resource_allocation_response_msg_t *
msg, Buf buffer);
static int
_unpack_resource_allocation_response_msg(resource_allocation_response_msg_t
** msg, Buf buffer);
static void
_pack_resource_allocation_and_run_response_msg
(resource_allocation_and_run_response_msg_t * msg, Buf buffer);
static int
_unpack_resource_allocation_and_run_response_msg
(resource_allocation_and_run_response_msg_t ** msg, Buf buffer);
static void _pack_submit_response_msg(submit_response_msg_t * msg,
Buf buffer);
static int _unpack_submit_response_msg(submit_response_msg_t ** msg,
Buf buffer);
static void _pack_node_info_msg(slurm_msg_t * msg, Buf buffer);
static int _unpack_node_info_msg(node_info_msg_t ** msg, Buf buffer);
static int _unpack_node_info_members(node_info_t * node, Buf buffer);
static void _pack_update_partition_msg(update_part_msg_t * msg, Buf buffer);
static int _unpack_update_partition_msg(update_part_msg_t ** msg, Buf buffer);
static void _pack_job_step_create_request_msg(job_step_create_request_msg_t
* msg, Buf buffer);
static int
_unpack_job_step_create_request_msg(job_step_create_request_msg_t ** msg,
Buf buffer);
static void _pack_revoke_credential_msg(revoke_credential_msg_t * msg,
Buf buffer);
static int _unpack_revoke_credential_msg(revoke_credential_msg_t ** msg,
Buf buffer);
static void
_pack_job_step_create_response_msg(job_step_create_response_msg_t * msg,
Buf buffer);
static int
_unpack_job_step_create_response_msg(job_step_create_response_msg_t ** msg,
Buf buffer);
static void _pack_partition_info_msg(slurm_msg_t * msg, Buf buffer);
static int _unpack_partition_info_msg(partition_info_msg_t ** msg,
Buf buffer);
static int _unpack_partition_info_members(partition_info_t * part,
Buf buffer);
static void _pack_launch_tasks_request_msg(launch_tasks_request_msg_t *
msg, Buf buffer);
static int _unpack_launch_tasks_request_msg(launch_tasks_request_msg_t **
msg_ptr, Buf buffer);
static void _pack_cancel_tasks_msg(kill_tasks_msg_t * msg, Buf buffer);
static int _unpack_cancel_tasks_msg(kill_tasks_msg_t ** msg_ptr, Buf buffer);
static void _pack_launch_tasks_response_msg(launch_tasks_response_msg_t *
msg, Buf buffer);
static int _unpack_launch_tasks_response_msg(launch_tasks_response_msg_t **
msg_ptr, Buf buffer);
static void _pack_shutdown_msg(shutdown_msg_t * msg, Buf buffer);
static int _unpack_shutdown_msg(shutdown_msg_t ** msg_ptr, Buf buffer);
static void _pack_reattach_tasks_request_msg(reattach_tasks_request_msg_t *,
Buf);
static int _unpack_reattach_tasks_request_msg(reattach_tasks_request_msg_t **,
Buf);
static void
_pack_reattach_tasks_response_msg(reattach_tasks_response_msg_t *, Buf);
static int
_unpack_reattach_tasks_response_msg(reattach_tasks_response_msg_t **, Buf);
static void _pack_task_exit_msg(task_exit_msg_t * msg, Buf buffer);
static int _unpack_task_exit_msg(task_exit_msg_t ** msg_ptr, Buf buffer);
static void _pack_old_job_desc_msg(old_job_alloc_msg_t * job_desc_ptr,
Buf buffer);
static int _unpack_old_job_desc_msg(old_job_alloc_msg_t **
job_desc_buffer_ptr, Buf buffer);
static void _pack_return_code_msg(return_code_msg_t * msg, Buf buffer);
static int _unpack_return_code_msg(return_code_msg_t ** msg, Buf buffer);
static void _pack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t * build_ptr,
Buf buffer);
static int _unpack_slurm_ctl_conf_msg(slurm_ctl_conf_info_msg_t **
build_buffer_ptr, Buf buffer);
static void _pack_job_step_id_msg(job_step_id_t * msg, Buf buffer);
static int _unpack_job_step_id_msg(job_step_id_t ** msg_ptr, Buf buffer);
static void _pack_get_job_step_info_msg(job_step_info_request_msg_t * msg,
Buf buffer);
static int _unpack_get_job_step_info_msg(job_step_info_request_msg_t **
msg, Buf buffer);
static int _unpack_job_step_info_response_msg(job_step_info_response_msg_t
** msg, Buf buffer);
static int _unpack_job_step_info_members(job_step_info_t * step, Buf buffer);
static void _pack_complete_job_step_msg(complete_job_step_msg_t * msg,
Buf buffer);
static int _unpack_complete_job_step_msg(complete_job_step_msg_t **
msg_ptr, Buf buffer);
static int _unpack_job_info_members(job_info_t * job, Buf buffer);
static void _pack_batch_job_launch_msg(batch_job_launch_msg_t * msg,
Buf buffer);
static int _unpack_batch_job_launch_msg(batch_job_launch_msg_t ** msg,
Buf buffer);
static void _pack_job_desc_msg(job_desc_msg_t * job_desc_ptr, Buf buffer);
static int _unpack_job_desc_msg(job_desc_msg_t ** job_desc_buffer_ptr,
Buf buffer);
static int _unpack_job_info_msg(job_info_msg_t ** msg, Buf buffer);
static void _pack_last_update_msg(last_update_msg_t * msg, Buf buffer);
static int _unpack_last_update_msg(last_update_msg_t ** msg, Buf buffer);
static void _pack_slurm_addr_array(slurm_addr * slurm_address,
uint16_t size_val, Buf buffer);
static int _unpack_slurm_addr_array(slurm_addr ** slurm_address,
uint16_t * size_val, Buf buffer);
static void _pack_buffer_msg(slurm_msg_t * msg, Buf buffer);
/* pack_header
* packs a slurm protocol header that proceeds every slurm message
* IN header - the header structure to pack
* IN/OUT buffer - destination of the pack, contains pointers that are
void
pack_header(header_t * header, Buf buffer)
pack16(header->version, buffer);
pack16(header->flags, buffer);
pack16((uint16_t) header->cred_type, buffer);
pack32(header->cred_length, buffer);
Loading
Loading full blame...