/* Code generated by cmd/cgo; DO NOT EDIT. */

/* package github.com/openpcc/openpcc/main */


#line 1 "cgo-builtin-export-prolog"

#include <stddef.h>

#ifndef GO_CGO_EXPORT_PROLOGUE_H
#define GO_CGO_EXPORT_PROLOGUE_H

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef struct { const char *p; ptrdiff_t n; } _GoString_;
extern size_t _GoStringLen(_GoString_ s);
extern const char *_GoStringPtr(_GoString_ s);
#endif

#endif

/* Start of preamble from import "C" comments.  */


#line 19 "client.go"

#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>

#line 1 "cgo-generated-wrapper"

#line 17 "response.go"

#include <stdio.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>

#line 1 "cgo-generated-wrapper"

#line 17 "response_stream.go"

#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>

#line 1 "cgo-generated-wrapper"

#line 17 "util.go"

#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>

#line 1 "cgo-generated-wrapper"


/* End of preamble from import "C" comments.  */


/* Start of boilerplate cgo prologue.  */
#line 1 "cgo-gcc-export-header-prolog"

#ifndef GO_CGO_PROLOGUE_H
#define GO_CGO_PROLOGUE_H

typedef signed char GoInt8;
typedef unsigned char GoUint8;
typedef short GoInt16;
typedef unsigned short GoUint16;
typedef int GoInt32;
typedef unsigned int GoUint32;
typedef long long GoInt64;
typedef unsigned long long GoUint64;
typedef GoInt64 GoInt;
typedef GoUint64 GoUint;
typedef size_t GoUintptr;
typedef float GoFloat32;
typedef double GoFloat64;
#ifdef _MSC_VER
#if !defined(__cplusplus) || _MSVC_LANG <= 201402L
#include <complex.h>
typedef _Fcomplex GoComplex64;
typedef _Dcomplex GoComplex128;
#else
#include <complex>
typedef std::complex<float> GoComplex64;
typedef std::complex<double> GoComplex128;
#endif
#else
typedef float _Complex GoComplex64;
typedef double _Complex GoComplex128;
#endif

/*
  static assertion to make sure the file is being used on architecture
  at least with matching size of GoInt.
*/
typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1];

#ifndef GO_CGO_GOSTRING_TYPEDEF
typedef _GoString_ GoString;
#endif
typedef void *GoMap;
typedef void *GoChan;
typedef struct { void *t; void *v; } GoInterface;
typedef struct { void *data; GoInt len; GoInt cap; } GoSlice;

#endif

/* End of boilerplate cgo prologue.  */

#ifdef __cplusplus
extern "C" {
#endif


// Confsec_ClientCreate creates a new client, returning a handle to it.
//
extern uintptr_t Confsec_ClientCreate(char* apiURL, char* apiKey, int identityPolicySource, char* oidcIssuer, char* oidcIssuerRegex, char* oidcSubject, char* oidcSubjectRegex, int concurrentRequestsTarget, int maxCandidateNodes, char** defaultNodeTags, size_t defaultNodeTagsCount, char* env, char** errStr);

// Confsec_ClientDestroy safely destroys the client associated with the given handle.
//
extern void Confsec_ClientDestroy(uintptr_t handle, char** errStr);

// Confsec_ClientGetDefaultCreditAmountPerRequest returns the currently configured
// default credit amount sent per request for the client associated with the given
// handle.
//
extern long Confsec_ClientGetDefaultCreditAmountPerRequest(uintptr_t handle, char** errStr);

// Confsec_ClientGetMaxCandidateNodes returns the currently configured maximum number
// of candidate compute nodes targeted per request for the client associated with the
// given handle.
//
extern int Confsec_ClientGetMaxCandidateNodes(uintptr_t handle, char** errStr);

// Confsec_ClientGetDefaultNodeTags returns the currently configured default node tags
// for the client associated with the given handle.
//
extern char** Confsec_ClientGetDefaultNodeTags(uintptr_t handle, size_t* defaultNodeTagsCount, char** errStr);

// Confsec_ClientSetDefaultNodeTags sets the default node tags for the client associated
// with the given handle.
//
extern void Confsec_ClientSetDefaultNodeTags(uintptr_t handle, char** defaultNodeTags, size_t defaultNodeTagsCount, char** errStr);

// Confsec_ClientGetWalletStatus returns the current wallet status for the client
// associated with the given handle. The returned value is a stringified JSON object.
//
extern char* Confsec_ClientGetWalletStatus(uintptr_t handle, char** errStr);

// Confsec_ClientDoRequest sends a request to the Confident Security network via the
// client associated with the given handle. The request argument should be the raw
// HTTP request including start line, headers, and body.
//
extern uintptr_t Confsec_ClientDoRequest(uintptr_t handle, char* request, size_t requestLength, char** errStr);

// Confsec_ResponseDestroy safely destroys the response object associated with the given
// handle.
//
extern void Confsec_ResponseDestroy(uintptr_t handle, char** errStr);

// Confsec_ResponseGetMetadata returns the metadata associated with the response object
// associated with the given handle. This includes the start line and HTTP headers. The
// metadata is returned as a stringified JSON object.
//
extern char* Confsec_ResponseGetMetadata(uintptr_t handle, char** errStr);

// Confsec_ResponseIsStreaming returns true if the response object associated with the
// given handle is a streaming response.
//
extern _Bool Confsec_ResponseIsStreaming(uintptr_t handle, char** errStr);

// Confsec_ResponseGetBody returns the body of the response object associated with the
// given handle. The body is returned as a null-terminated byte array. If the response
// has Transfer-Encoding: chunked, calling this function results in an error.
//
extern char* Confsec_ResponseGetBody(uintptr_t handle, char** errStr);

// Confsec_ResponseGetStream returns a handle to a stream object that can be used to
// read the response body in chunks. If the response is not a streaming response, (i.e.
// it has Transfer-Encoding: chunked), then calling this function results in an error.
//
extern uintptr_t Confsec_ResponseGetStream(uintptr_t handle, char** errStr);

// Confsec_ResponseStreamGetNext returns the next chunk of data from the response stream
// associated with the given handle. If there is no more data, it returns NULL.
//
extern char* Confsec_ResponseStreamGetNext(uintptr_t handle, char** errStr);

// Confsec_ResponseStreamDestroy safely destroys the response stream associated with the
// given handle.
//
extern void Confsec_ResponseStreamDestroy(uintptr_t handle, char** errStr);

// Confsec_Free should be used by consumers of libconfsec to free heap-allocated memory
// returned by other libconfsec functions.
//
extern void Confsec_Free(void* ptr);

#ifdef __cplusplus
}
#endif
