src/vsl.h File Reference

Common headers for the VSL API. More...

#include "vsl_api.h"
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Data Structures

struct  phead_t
 VSL packet header. More...

Defines

#define CHECK_MAGIC(X)   ((X)[0] == 'V' && (X)[1] == 'S' && (X)[2] == 'L' && (X)[3] == '1')
 Check a VSL packet header prefix.
#define CONSTAT(X)   (X >> 5) << 5
 Get precise status.
#define CONWAIT(X)   (X & 0x1F)
 Get pending event.
#define FILL_MAGIC(X)   do { (X)[0] = 'V'; (X)[1] = 'S'; (X)[2] = 'L'; (X)[3] = '1'; } while(0)
 Fill a VSL packet header prefix.
#define KEY_STR
 To print VSL Keys in hex.
#define KEY_VEC(K)
 To print VSL Keys in hex.
#define LOG()
 Log message.
#define LOGFAIL(ERR,)
 Log failure and return from function, preserving errno.
#define LOGFATAL()
 Internal error in library code, log and abort.
#define P_DATA   0x00
 VSL data packet.
#define P_MAGIC_SIZE   4
 Length of the magic VSL packet header prefix.
#define PHEAD_SIZE
 Size of the packet header without aligning.
#define TRY(S)   do { int ret; if ( (ret = (S)) != 0 ) return ret; } while (false)
 Call function, escalate a nonzero return value.

Enumerations

enum  connstat_t {
  C_WAIT_FD_R = 1, C_WAIT_FD_W = 2, C_WAIT_VFD_R = 4, C_WAIT_VFD_W = 8,
  C_WAIT_PID = 16, C_INITIALIZED = (1 << 5), C_ESTABLISHED = (2 << 5), C_SSH_FORKED = (3 << 5),
  C_SSH_WROTE_SEC = (4 << 5), C_SSH_VF_CON = (5 << 5)
}
 VSL Connection Status. More...


Detailed Description

Common headers for the VSL API.

Author:
Nikolaus Rath

Definition in file vsl.h.


Define Documentation

#define CHECK_MAGIC (  )     ((X)[0] == 'V' && (X)[1] == 'S' && (X)[2] == 'L' && (X)[3] == '1')

Check a VSL packet header prefix.

Definition at line 82 of file vsl.h.

#define CONSTAT (  )     (X >> 5) << 5

Get precise status.

Definition at line 103 of file vsl.h.

#define CONWAIT (  )     (X & 0x1F)

Get pending event.

Definition at line 106 of file vsl.h.

#define FILL_MAGIC (  )     do { (X)[0] = 'V'; (X)[1] = 'S'; (X)[2] = 'L'; (X)[3] = '1'; } while(0)

Fill a VSL packet header prefix.

Definition at line 80 of file vsl.h.

#define KEY_STR

Value:

"%.2hhX%.2hhX-%.2hhX%.2hhX-%.2hhX%.2hhX-%.2hhX%.2hhX-" \
                      "%.2hhX%.2hhX-%.2hhX%.2hhX-%.2hhX%.2hhX-%.2hhX%.2hhX"
To print VSL Keys in hex.

Usage:

 printf(KEY_STR, KEY_VEC); 

Definition at line 57 of file vsl.h.

#define KEY_VEC (  ) 

Value:

(K)[0], (K)[1], (K)[2], (K)[3], (K)[4], (K)[5], (K)[6], (K)[7], \
   (K)[8], (K)[9], (K)[10], (K)[11], (K)[12], (K)[13], (K)[14], (K)[15]
To print VSL Keys in hex.

Usage:

 printf(KEY_STR, KEY_VEC); 

Definition at line 62 of file vsl.h.

 
#define LOG (  ) 

Value:

do { if (debug != NULL) { \
                     fprintf(debug, "[ %-15s ] ", __func__); \
                     fprintf(debug, __VA_ARGS__); \
                     fprintf(debug, "\n"); \
                     fflush(debug); \
                 } } while (false)
Log message.

Definition at line 25 of file vsl.h.

#define LOGFAIL ( ERR   ) 

Value:

do { \
    int err = errno; \
    LOG(__VA_ARGS__); \
    errno = err; \
    return (ERR); \
} while (false)
Log failure and return from function, preserving errno.

Definition at line 33 of file vsl.h.

 
#define LOGFATAL (  ) 

Value:

do { \
    if (debug == NULL) \
        debug = stderr; \
        fprintf(debug, "internal error in %s, %s line %d:\n", __func__, __FILE__, __LINE__); \
        fprintf(debug, __VA_ARGS__); \
        fprintf(debug, "\n"); \
        fflush(debug); \
        abort(); \
    } while (false)
Internal error in library code, log and abort.

Definition at line 42 of file vsl.h.

#define P_DATA   0x00

VSL data packet.

Definition at line 71 of file vsl.h.

#define P_MAGIC_SIZE   4

Length of the magic VSL packet header prefix.

Magic bytes in the VSL packet header

Definition at line 78 of file vsl.h.

#define PHEAD_SIZE

Value:

(sizeof(uint64_t)+\
                    VSL_MACLEN+\
                    P_MAGIC_SIZE+\
                    sizeof(char)+\
                    sizeof(uint32_t))
Size of the packet header without aligning.

Definition at line 118 of file vsl.h.

#define TRY (  )     do { int ret; if ( (ret = (S)) != 0 ) return ret; } while (false)

Call function, escalate a nonzero return value.

Definition at line 53 of file vsl.h.


Enumeration Type Documentation

enum connstat_t

VSL Connection Status.

Lower 5 bits indicate whether the socket is waiting for a specific pending event

Enumerator:
C_WAIT_FD_R 
C_WAIT_FD_W 
C_WAIT_VFD_R 
C_WAIT_VFD_W 
C_WAIT_PID 
C_INITIALIZED 
C_ESTABLISHED 
C_SSH_FORKED 
C_SSH_WROTE_SEC 
C_SSH_VF_CON 

Definition at line 89 of file vsl.h.


Generated on Tue Aug 8 16:07:22 2006 for VFER by  doxygen 1.4.7