areaDetector  3-5-0
EPICS areaDetector framework
Classes | Macros | Typedefs
restApi.cpp File Reference
#include "restApi.h"
#include <stdexcept>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <frozen.h>
#include <epicsStdio.h>
#include <epicsThread.h>
#include <epicsTime.h>
#include <fcntl.h>

Classes

struct  socket
 
struct  request
 
struct  response
 

Macros

#define API_VERSION   "1.6.0"
 
#define EOL   "\r\n"
 
#define EOL_LEN   2
 
#define EOH   EOL EOL
 
#define EOH_LEN   (EOL_LEN*2)
 
#define ID_STR   "$id"
 
#define ID_LEN   3
 
#define DATA_NATIVE   "application/json; charset=utf-8"
 
#define DATA_TIFF   "application/tiff"
 
#define DATA_HDF5   "application/hdf5"
 
#define DATA_HTML   "text/html"
 
#define MAX_HTTP_RETRIES   1
 
#define MAX_MESSAGE_SIZE   512
 
#define MAX_BUF_SIZE   256
 
#define MAX_JSON_TOKENS   100
 
#define DEFAULT_TIMEOUT_INIT   240
 
#define DEFAULT_TIMEOUT_ARM   120
 
#define DEFAULT_TIMEOUT_CONNECT   1
 
#define ERR_PREFIX   "RestApi"
 
#define ERR(msg)   fprintf(stderr, ERR_PREFIX "::%s: %s\n", functionName, msg)
 
#define ERR_ARGS(fmt, ...)
 
#define REQUEST_GET
 
#define REQUEST_GET_FILE
 
#define REQUEST_PUT
 
#define REQUEST_HEAD
 
#define REQUEST_DELETE
 

Typedefs

typedef struct socket socket_t
 
typedef struct request request_t
 
typedef struct response response_t
 

Macro Definition Documentation

◆ API_VERSION

#define API_VERSION   "1.6.0"

◆ DATA_HDF5

#define DATA_HDF5   "application/hdf5"

◆ DATA_HTML

#define DATA_HTML   "text/html"

◆ DATA_NATIVE

#define DATA_NATIVE   "application/json; charset=utf-8"

◆ DATA_TIFF

#define DATA_TIFF   "application/tiff"

◆ DEFAULT_TIMEOUT_ARM

#define DEFAULT_TIMEOUT_ARM   120

◆ DEFAULT_TIMEOUT_CONNECT

#define DEFAULT_TIMEOUT_CONNECT   1

◆ DEFAULT_TIMEOUT_INIT

#define DEFAULT_TIMEOUT_INIT   240

◆ EOH

#define EOH   EOL EOL

◆ EOH_LEN

#define EOH_LEN   (EOL_LEN*2)

◆ EOL

#define EOL   "\r\n"

◆ EOL_LEN

#define EOL_LEN   2

◆ ERR

#define ERR (   msg)    fprintf(stderr, ERR_PREFIX "::%s: %s\n", functionName, msg)

◆ ERR_ARGS

#define ERR_ARGS (   fmt,
  ... 
)
Value:
fprintf(stderr, ERR_PREFIX "::%s: " fmt "\n", \
functionName, __VA_ARGS__)
#define ERR_PREFIX
Definition: restApi.cpp:39

◆ ERR_PREFIX

#define ERR_PREFIX   "RestApi"

◆ ID_LEN

#define ID_LEN   3

◆ ID_STR

#define ID_STR   "$id"

◆ MAX_BUF_SIZE

#define MAX_BUF_SIZE   256

◆ MAX_HTTP_RETRIES

#define MAX_HTTP_RETRIES   1

◆ MAX_JSON_TOKENS

#define MAX_JSON_TOKENS   100

◆ MAX_MESSAGE_SIZE

#define MAX_MESSAGE_SIZE   512

◆ REQUEST_DELETE

#define REQUEST_DELETE
Value:
"DELETE %s%s HTTP/1.1" EOL\
"Host: %s" EOH
#define EOH
Definition: restApi.cpp:19
#define EOL
Definition: restApi.cpp:17

◆ REQUEST_GET

#define REQUEST_GET
Value:
"GET %s%s HTTP/1.1" EOL \
"Host: %s" EOL\
"Content-Length: 0" EOL \
"Accept: " DATA_NATIVE EOH
#define DATA_NATIVE
Definition: restApi.cpp:25
#define EOH
Definition: restApi.cpp:19
#define EOL
Definition: restApi.cpp:17

◆ REQUEST_GET_FILE

#define REQUEST_GET_FILE
Value:
"GET %s%s HTTP/1.1" EOL \
"Host: %s" EOL\
"Content-Length: 0" EOL \
"Accept: %s" EOH
#define EOH
Definition: restApi.cpp:19
#define EOL
Definition: restApi.cpp:17

◆ REQUEST_HEAD

#define REQUEST_HEAD
Value:
"HEAD %s%s HTTP/1.1" EOL\
"Host: %s" EOH
#define EOH
Definition: restApi.cpp:19
#define EOL
Definition: restApi.cpp:17

◆ REQUEST_PUT

#define REQUEST_PUT
Value:
"PUT %s%s HTTP/1.1" EOL \
"Host: %s" EOL\
"Accept-Encoding: identity" EOL\
"Content-Type: " DATA_NATIVE EOL \
"Content-Length: %lu" EOH
#define DATA_NATIVE
Definition: restApi.cpp:25
#define EOH
Definition: restApi.cpp:19
#define EOL
Definition: restApi.cpp:17

Typedef Documentation

◆ request_t

typedef struct request request_t

◆ response_t

typedef struct response response_t

◆ socket_t

typedef struct socket socket_t