1 /*****************************************************************************\
2  *  src/common/job_options.h  - Extra job options
3  *****************************************************************************
4  *  Copyright (C) 2002 The Regents of the University of California.
5  *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
6  *  Written by Mark Grondona <grondona1@llnl.gov>.
7  *  CODE-OCEC-09-009. All rights reserved.
8  *
9  *  This file is part of Slurm, a resource management program.
10  *  For details, see <https://slurm.schedmd.com/>.
11  *  Please also read the included file: DISCLAIMER.
12  *
13  *  Slurm is free software; you can redistribute it and/or modify it under
14  *  the terms of the GNU General Public License as published by the Free
15  *  Software Foundation; either version 2 of the License, or (at your option)
16  *  any later version.
17  *
18  *  In addition, as a special exception, the copyright holders give permission
19  *  to link the code of portions of this program with the OpenSSL library under
20  *  certain conditions as described in each individual source file, and
21  *  distribute linked combinations including the two. You must obey the GNU
22  *  General Public License in all respects for all of the code used other than
23  *  OpenSSL. If you modify file(s) with this exception, you may extend this
24  *  exception to your version of the file(s), but you are not obligated to do
25  *  so. If you do not wish to do so, delete this exception statement from your
26  *  version.  If you delete this exception statement from all source files in
27  *  the program, then also delete it here.
28  *
29  *  Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
30  *  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
31  *  FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
32  *  details.
33  *
34  *  You should have received a copy of the GNU General Public License along
35  *  with Slurm; if not, write to the Free Software Foundation, Inc.,
36  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA.
37 \*****************************************************************************/
38 
39 #ifndef _JOB_OPTIONS_H
40 #define _JOB_OPTIONS_H
41 
42 #include "src/common/pack.h"
43 
44 typedef struct job_options * job_options_t;	/* opaque data type */
45 
46 struct job_option_info {
47 	int type;
48 	char *option;
49 	char *optarg;
50 };
51 
52 /*
53  *  Create generic job options container.
54  */
55 job_options_t job_options_create (void);
56 
57 /*
58  *  Destroy container, freeing all data associated with options.
59  */
60 void job_options_destroy (job_options_t opts);
61 
62 /*
63  *  Append option of type `type' and its argument to job options
64  */
65 int job_options_append (job_options_t opts, int type, const char *opt,
66 		        const char *optarg);
67 
68 /*
69  *  Pack all accumulated options into Buffer "buf"
70  */
71 int job_options_pack (job_options_t opts, Buf buf);
72 
73 /*
74  *  Unpack options from buffer "buf" into options container opts.
75  */
76 int job_options_unpack (job_options_t opts, Buf buf);
77 
78 /*
79  *  Reset internal options list iterator
80  */
81 void job_options_iterator_reset (job_options_t opts);
82 
83 /*
84  *  Iterate over all job options
85  */
86 const struct job_option_info * job_options_next (job_options_t opts);
87 
88 #endif /* !_JOB_OPTIONS_H */
89