---
name: "globus_gram_protocol_pack"
section: "3"
platform: "linux"
package: "libglobus-gram-protocol-doc"
version: "13.6-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/globus_gram_protocol_pack"
---

# globus\_gram\_protocol\_pack(3)

Message Packing - Message Packing.

## NAME

globus\_gram\_protocol\_pack - Message Packing

 \- Message Packing.

## SYNOPSIS

### Functions

int **globus\_gram\_protocol\_pack\_job\_request** (int job\_state\_mask, const char \*callback\_url, const char \*rsl, globus\_byte\_t \*\*query, globus\_size\_t \*querysize)\
 Pack a GRAM Job Request.  int **globus\_gram\_protocol\_pack\_job\_request\_reply** (int status, const char \*job\_contact, globus\_byte\_t \*\*reply, globus\_size\_t \*replysize)\
 Pack a GRAM reply message.  int **globus\_gram\_protocol\_pack\_job\_request\_reply\_with\_extensions** (int status, const char \*job\_contact, globus\_hashtable\_t \*extensions, globus\_byte\_t \*\*reply, globus\_size\_t \*replysize)\
 Pack a GRAM reply message with extension attributes.  int **globus\_gram\_protocol\_pack\_status\_request** (const char \*status\_request, globus\_byte\_t \*\*query, globus\_size\_t \*querysize)\
 Pack a GRAM query message.  int **globus\_gram\_protocol\_pack\_status\_reply** (int job\_status, int failure\_code, int job\_failure\_code, globus\_byte\_t \*\*reply, globus\_size\_t \*replysize)\
 Pack a GRAM query reply message.  int **globus\_gram\_protocol\_pack\_status\_reply\_with\_extensions** (int job\_status, int failure\_code, int job\_failure\_code, globus\_hashtable\_t \*extensions, globus\_byte\_t \*\*reply, globus\_size\_t \*replysize)\
 Pack a GRAM query reply message with extensions.  int **globus\_gram\_protocol\_pack\_status\_update\_message** (char \*job\_contact, int status, int failure\_code, globus\_byte\_t \*\*reply, globus\_size\_t \*replysize)\
 Pack a GRAM status update message.  int **globus\_gram\_protocol\_pack\_status\_update\_message\_with\_extensions** (char \*job\_contact, int status, int failure\_code, globus\_hashtable\_t \*extensions, globus\_byte\_t \*\*reply, globus\_size\_t \*replysize)\
 Pack a GRAM status update message with extensions.  int **globus\_gram\_protocol\_pack\_version\_request** (char \*\*request, size\_t \*requestsize)\
 Pack a GRAM version request message.

## Detailed Description

Message Packing.

## Function Documentation

### int globus\_gram\_protocol\_pack\_job\_request (int job\_state\_mask, const char \* callback\_url, const char \* rsl, globus\_byte\_t \*\* query, globus\_size\_t \* querysize)

Pack a GRAM Job Request. The **globus\_gram\_protocol\_pack\_job\_request()** function combines its parameters into a GRAM job request message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_post()** or just frame it by calling **globus\_gram\_protocol\_frame\_request()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_job\_request()** function returns the packed message by modifying the *query* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*job\_state\_mask* The bitwise-or of the GRAM job states which the client would like to register for job state change callbacks. \
 *callback\_url* A callback contact string which will be contacted when a job state change which matches the *job\_state\_mask* occurs. This may be NULL, if the client does not wish to register a callback contact with this job request. Typically, this value is returned in the *url* parameter to **globus\_gram\_protocol\_allow\_attach()**. \
 *rsl* An RSL string which contains the job request. This will be processed on the server side. \
 *query* An output parameter which will be set to a new string containing the packed job request message. The caller must free this memory by calling free() \
 *querysize* An output parameter which will be populated with the length of the job request message returned in *query*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_job\_request()** returns GLOBUS\_SUCCESS and modifies the *query* and *querysize* parameters to point to the values described above.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_ERROR\_NULL\_PARAMETER* Null parameter

### int globus\_gram\_protocol\_pack\_job\_request\_reply (int status, const char \* job\_contact, globus\_byte\_t \*\* reply, globus\_size\_t \* replysize)

Pack a GRAM reply message. The **globus\_gram\_protocol\_pack\_job\_request\_reply()** function combines its parameters into a GRAM reply message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_reply()** or just frame it by calling **globus\_gram\_protocol\_frame\_reply()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_job\_request\_reply()** function returns the packed message by modifying the *reply* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*status* The job's failure code if the job failed, or 0, if the job request was processed successfully. \
 *job\_contact* A string containing the job contact string. This may be NULL, if the job request was not successful. \
 *reply* A pointer which will be set to the packed reply string The caller must free this string by calling free(). \
 *replysize* A pointer which will be set to the length of the reply string.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_job\_request\_reply()** returns *GLOBUS\_SUCCESS* and modifies the *reply* and *replysize* parameters to point to the values described above. If an error occurs, an integer error code is returned and the values pointed to by *reply* and *replysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_job\_request\_reply\_with\_extensions (int status, const char \* job\_contact, globus\_hashtable\_t \* extensions, globus\_byte\_t \*\* reply, globus\_size\_t \* replysize)

Pack a GRAM reply message with extension attributes. The **globus\_gram\_protocol\_pack\_job\_request\_reply\_with\_extensions()** function combines its parameters into a GRAM reply message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_reply()** or just frame it by calling **globus\_gram\_protocol\_frame\_reply()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_job\_request\_reply\_with\_extensions()** function returns the packed message by modifying the *reply* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*status* The job's failure code if the job failed, or 0, if the job request was processed successfully. \
 *job\_contact* A string containing the job contact string. This may be NULL, if the job request was not successful. \
 *extensions* A pointer to a hash table keyed on a string attribute name with the hash values being pointers to *globus\_gram\_protocol\_extension\_t* structures. These will be encoded in the reply message after the standard attributes. \
 *reply* A pointer which will be set to the packed reply string The caller must free this string by calling free(). \
 *replysize* A pointer which will be set to the length of the reply string.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_job\_request\_reply\_with\_extensions()** returns *GLOBUS\_SUCCESS* and modifies the *reply* and *replysize* parameters to point to the values described above. If an error occurs, an integer error code is returned and the values pointed to by *reply* and *replysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_status\_reply (int job\_status, int failure\_code, int job\_failure\_code, globus\_byte\_t \*\* reply, globus\_size\_t \* replysize)

Pack a GRAM query reply message. The **globus\_gram\_protocol\_pack\_status\_reply()** function combines its parameters into a GRAM status reply message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_reply()** or just frame it by calling **globus\_gram\_protocol\_frame\_reply()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_status\_reply()** function returns the packed message by modifying the *reply* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*job\_status* The job's current **job state**. \
 *failure\_code* The error code generated by the query. This may be GLOBUS\_SUCCESS if the query succeeded. \
 *job\_failure\_code* The error code associated with the job if it has failed. This may be GLOBUS\_SUCCESS if the job has not failed. \
 *reply* An output parameter which will be set to a new string containing the packed reply message. \
 *replysize* An output parameter which will be set to the length of the reply message returned in *reply*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_status\_reply()** returns *GLOBUS\_SUCCESS* and modifies the *reply* and *replysize* parameters to point to the values described above. If an error occurs, an integer error code is returned and the values pointed to by *reply* and *replysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_status\_reply\_with\_extensions (int job\_status, int failure\_code, int job\_failure\_code, globus\_hashtable\_t \* extensions, globus\_byte\_t \*\* reply, globus\_size\_t \* replysize)

Pack a GRAM query reply message with extensions. The **globus\_gram\_protocol\_pack\_status\_reply\_with\_extensions()** function combines its parameters into a GRAM status reply message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_reply()** or just frame it by calling **globus\_gram\_protocol\_frame\_reply()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_status\_reply\_with\_extensions()** function returns the packed message by modifying the *reply* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*job\_status* The job's current **job state**. \
 *failure\_code* The error code generated by the query. This may be GLOBUS\_SUCCESS if the query succeeded. \
 *job\_failure\_code* The error code associated with the job if it has failed. This may be GLOBUS\_SUCCESS if the job has not failed. \
 *extensions* A pointer to a hash table containing the names and values of the protocol extensions to add to this message. \
 *reply* An output parameter which will be set to a new string containing the packed reply message. \
 *replysize* An output parameter which will be set to the length of the reply message returned in *reply*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_status\_reply\_with\_extensions()** returns *GLOBUS\_SUCCESS* and modifies the *reply* and *replysize* parameters to point to the values described above. If an error occurs, an integer error code is returned and the values pointed to by *reply* and *replysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_status\_request (const char \* status\_request, globus\_byte\_t \*\* query, globus\_size\_t \* querysize)

Pack a GRAM query message. The **globus\_gram\_protocol\_pack\_status\_request()** function combines its parameters into a GRAM status query message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_post()** or just frame it by calling **globus\_gram\_protocol\_frame\_request()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_status\_request()** function returns the packed message by modifying the *query* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*status\_request* A string containing the type of query message to send, including any query parameters. The valid strings supported by GRAM in GT5 are:

- •

  status

- •

  register

- •

  unregister

- •

  signal

- •

  renew

- •

  cancel

*query* An output parameter which will be set to a new string containing the packed job query message. \
 *querysize* An output parameter which will be set to the length of the job query message returned in *query*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_status\_request()** returns *GLOBUS\_SUCCESS* and modifies the *query* and *querysize* parameters to point to the values described above. If an error occurs, an integer error code is returned and the values pointed to by *query* and *querysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_status\_update\_message (char \* job\_contact, int status, int failure\_code, globus\_byte\_t \*\* reply, globus\_size\_t \* replysize)

Pack a GRAM status update message. The **globus\_gram\_protocol\_pack\_status\_update\_message()** function combines its parameters into a GRAM status update message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_post()** or just frame it by calling **globus\_gram\_protocol\_frame\_request()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_status\_update\_message()** function returns the packed message by modifying the *reply* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*job\_contact* The job contact string associated with the job. \
 *status* The job's current **job state**. \
 *failure\_code* The error associated with this job request if the *status* value is GLOBUS\_GRAM\_PROTOCOL\_JOB\_STATE\_FAILED. \
 *reply* An output parameter which will be set to a new string containing the packed status message. The caller must free this memory by calling free() \
 *replysize* An output parameter which will be set to the length of the status message returned in *reply*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_status\_update\_message()** returns *GLOBUS\_SUCCESS* and modifies the *reply* and *replysize* parameters as described above. If an error occurs, an integer error code is returned and the values pointed to by *reply* and *replysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_ERROR\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_status\_update\_message\_with\_extensions (char \* job\_contact, int status, int failure\_code, globus\_hashtable\_t \* extensions, globus\_byte\_t \*\* reply, globus\_size\_t \* replysize)

Pack a GRAM status update message with extensions. The **globus\_gram\_protocol\_pack\_status\_update\_message\_with\_extensions()** function combines its parameters into a GRAM status update message body. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_post()** or just frame it by calling **globus\_gram\_protocol\_frame\_request()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_status\_update\_message\_with\_extensions()** function returns the packed message by modifying the *reply* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*job\_contact* The job contact string associated with the job. \
 *status* The job's current **job state**. \
 *failure\_code* The error associated with this job request if the *status* value is GLOBUS\_GRAM\_PROTOCOL\_JOB\_STATE\_FAILED. \
 *extensions* A pointer to a hash table keyed by extension attribute names with the values being pointers to globus\_gram\_protocol\_extension\_t structures. \
 *reply* An output parameter which will be set to a new string containing the packed status message. The caller must free this memory by calling free() \
 *replysize* An output parameter which will be set to the length of the status message returned in *reply*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_status\_update\_message\_with\_extensions()** returns *GLOBUS\_SUCCESS* and modifies the *reply* and *replysize* parameters as described above. If an error occurs, an integer error code is returned and the values pointed to by *reply* and *replysize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_ERROR\_MALLOC\_FAILED* Out of memory

### int globus\_gram\_protocol\_pack\_version\_request (char \*\* request, size\_t \* requestsize)

Pack a GRAM version request message. The **globus\_gram\_protocol\_pack\_job\_request()** function creates a copy of the GRAM version request. The caller may frame and send the resulting message by calling **globus\_gram\_protocol\_post()** or just frame it by calling **globus\_gram\_protocol\_frame\_request()** and send it by some other mechanism. The **globus\_gram\_protocol\_pack\_version\_request()** function returns the packed message by modifying the *request* parameter to point to a new string containing the message. The caller is responsible for freeing that string.

**Parameters**

*request* An output parameter which will be set to a new string containing the packed version request message. The caller must free this memory by calling free(). \
 *requestsize* An output parameter which will be populated with the length of the version request message returned in *query*.

**Returns**

Upon success, **globus\_gram\_protocol\_pack\_job\_request()** returns GLOBUS\_SUCCESS and modifies the *request* and *requestsize* parameters to point to the values described above. If an error occurs, **globus\_gram\_protocol\_pack\_version\_request()** returns an integer error code and the values pointed to by *request* and *requestsize* are undefined.

**Return values**

*GLOBUS\_SUCCESS* Success \
 *GLOBUS\_GRAM\_PROTOCOL\_ERROR\_NULL\_PARAMETER* Null parameter \
 *GLOBUS\_GRAM\_PROTOCOL\_ERROR\_MALLOC\_FAILED* Out of memory

## Author

Generated automatically by Doxygen for globus\_gram\_protocol from the source code.
