1 /****************************************************************************\
2  *  slurmdbd_pack.h - functions to pack SlurmDBD RPCs
3  *****************************************************************************
4  *  Copyright (C) 2011-2018 SchedMD LLC
5  *  Copyright (C) 2008-2010 Lawrence Livermore National Security.
6  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7  *  Written by Morris Jette <jette1@llnl.gov>
8  *  CODE-OCEC-09-009. All rights reserved.
9  *
10  *  This file is part of Slurm, a resource management program.
11  *  For details, see <https://slurm.schedmd.com/>.
12  *  Please also read the included file: DISCLAIMER.
13  *
14  *  Slurm is free software; you can redistribute it and/or modify it under
15  *  the terms of the GNU General Public License as published by the Free
16  *  Software Foundation; either version 2 of the License, or (at your option)
17  *  any later version.
18  *
19  *  In addition, as a special exception, the copyright holders give permission
20  *  to link the code of portions of this program with the OpenSSL library under
21  *  certain conditions as described in each individual source file, and
22  *  distribute linked combinations including the two. You must obey the GNU
23  *  General Public License in all respects for all of the code used other than
24  *  OpenSSL. If you modify file(s) with this exception, you may extend this
25  *  exception to your version of the file(s), but you are not obligated to do
26  *  so. If you do not wish to do so, delete this exception statement from your
27  *  version.  If you delete this exception statement from all source files in
28  *  the program, then also delete it here.
29  *
30  *  Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
31  *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
32  *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
33  *  details.
34  *
35  *  You should have received a copy of the GNU General Public License along
36  *  with Slurm; if not, write to the Free Software Foundation, Inc.,
37  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
38 \*****************************************************************************/
39 
40 #ifndef _SLURMDBD_PACK_H
41 #define _SLURMDBD_PACK_H
42 
43 #include "src/common/pack.h"
44 #include "src/common/slurmdbd_defs.h"
45 
46 #define MAX_DBD_MSG_LEN         16384
47 
48 /*****************************************************************************\
49  * Pack various SlurmDBD message structures into a buffer
50 \*****************************************************************************/
51 
52 extern void slurmdbd_pack_id_rc_msg(void *in,
53 				    uint16_t rpc_version, Buf buffer);
54 
55 extern int slurmdbd_unpack_id_rc_msg(void **msg,
56 				     uint16_t rpc_version, Buf buffer);
57 
58 extern void slurmdbd_pack_usage_msg(dbd_usage_msg_t *msg,
59 				    uint16_t rpc_version,
60 				    slurmdbd_msg_type_t type,
61 				    Buf buffer);
62 extern int slurmdbd_unpack_usage_msg(dbd_usage_msg_t **msg,
63 				     uint16_t rpc_version,
64 				     slurmdbd_msg_type_t type,
65 				     Buf buffer);
66 
67 extern void slurmdbd_pack_fini_msg(dbd_fini_msg_t *msg,
68 				   uint16_t rpc_version, Buf buffer);
69 extern int slurmdbd_unpack_fini_msg(dbd_fini_msg_t **msg,
70 				    uint16_t rpc_version, Buf buffer);
71 
72 extern void slurmdbd_pack_list_msg(dbd_list_msg_t *msg,
73 				   uint16_t rpc_version,
74 				   slurmdbd_msg_type_t type,
75 				   Buf buffer);
76 extern int slurmdbd_unpack_list_msg(dbd_list_msg_t **msg, uint16_t rpc_version,
77 				    slurmdbd_msg_type_t type, Buf buffer);
78 
79 extern Buf pack_slurmdbd_msg(persist_msg_t *req, uint16_t rpc_version);
80 extern int unpack_slurmdbd_msg(persist_msg_t *resp,
81 			       uint16_t rpc_version, Buf buffer);
82 
83 #endif	/* !_SLURMDBD_PACK_H */
84