ISIS Logo
ISISBEAM
ISIS Beam Information
Classes | Macros | Enumerations | Functions | Variables
1st_nd_post.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
#include <time.h>
#include <sys/time.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>

Go to the source code of this file.

Classes

struct  data_header
 
struct  generic_data_packet
 
struct  data_1_0
 
struct  data_packet_1_0
 

Macros

#define SOCKET   int
 
#define INVALID_SOCKET   -1
 
#define INTERNET_SOCKET   AF_INET
 
#define closesocket   close
 
#define ND_POST_PORT   7001
 
#define ND_MULTICAST_PORT   7002
 
#define ND_BROADCAST_PORT1   7003
 
#define ND_BROADCAST_PORT2   7004
 
#define SHUTTER_SERVER_PORT   7003
 
#define ND_XML_POST_PORT   7005
 
#define ND_MULTICAST_ADDRESS   "224.1.0.2"
 
#define SHUTTER_OPEN(__inst, __var)   ((__var & (1 << __inst)) != 0)
 

Enumerations

enum  ShutN {
  SLS = 0, PRISMA, SURF, CRISP,
  LOQ, IRIS, POLARIS, TOSCA,
  HET
}
 
enum  ShutS {
  MAPS = 0, EVS, SXD, NO_INST1,
  NO_INST2, MARI, GEM, HRPD,
  PEARL
}
 

Functions

SOCKET open_connection (const char *servers[], short port)
 
int send_data (SOCKET sd, data_packet_1_0 *dp)
 
int send_packet (SOCKET sd, const char *data, int n)
 
int receive_data (SOCKET sd, data_packet_1_0 *dp)
 
int receive_data_pattern (SOCKET sd, void *data, int maxdata, const char *pattern)
 
SOCKET setup_socket (unsigned short port, int num_listen)
 
int initialise_data_packet (data_header *dh, short major, short minor)
 
SOCKET setup_broadcast_socket (const char *address, short port, struct sockaddr_in *sockin, int multicast)
 
SOCKET setup_udp_socket (unsigned short port, int multicast)
 
int receive_data_udp (SOCKET sd, char *dp, int n)
 
char * xml_parse (const char *input_string, const char *token)
 

Variables

static const char * ShutN_names []
 
static const char * ShutS_names []
 

Macro Definition Documentation

#define closesocket   close

Definition at line 29 of file 1st_nd_post.h.

#define INTERNET_SOCKET   AF_INET

Definition at line 28 of file 1st_nd_post.h.

#define INVALID_SOCKET   -1

Definition at line 27 of file 1st_nd_post.h.

#define ND_BROADCAST_PORT1   7003

Definition at line 37 of file 1st_nd_post.h.

Referenced by isisbeamDriver::pollerThread().

#define ND_BROADCAST_PORT2   7004

Definition at line 38 of file 1st_nd_post.h.

#define ND_MULTICAST_ADDRESS   "224.1.0.2"

Definition at line 42 of file 1st_nd_post.h.

Referenced by setup_udp_socket().

#define ND_MULTICAST_PORT   7002

Definition at line 36 of file 1st_nd_post.h.

#define ND_POST_PORT   7001

Definition at line 34 of file 1st_nd_post.h.

#define ND_XML_POST_PORT   7005

Definition at line 40 of file 1st_nd_post.h.

#define SHUTTER_OPEN (   __inst,
  __var 
)    ((__var & (1 << __inst)) != 0)

Definition at line 179 of file 1st_nd_post.h.

#define SHUTTER_SERVER_PORT   7003

Definition at line 39 of file 1st_nd_post.h.

#define SOCKET   int

Definition at line 26 of file 1st_nd_post.h.

Enumeration Type Documentation

enum ShutN
Enumerator
SLS 
PRISMA 
SURF 
CRISP 
LOQ 
IRIS 
POLARIS 
TOSCA 
HET 

Definition at line 166 of file 1st_nd_post.h.

enum ShutS
Enumerator
MAPS 
EVS 
SXD 
NO_INST1 
NO_INST2 
MARI 
GEM 
HRPD 
PEARL 

Definition at line 175 of file 1st_nd_post.h.

Function Documentation

int initialise_data_packet ( data_header dh,
short  major,
short  minor 
)

Definition at line 129 of file 1st_nd_lib.c.

References data_header::len, data_header::major, and data_header::minor.

SOCKET open_connection ( const char *  servers[],
short  port 
)

Definition at line 37 of file 1st_nd_lib.c.

References closesocket, INTERNET_SOCKET, INVALID_SOCKET, and SOCKET.

Referenced by send_mail().

int receive_data ( SOCKET  sd,
data_packet_1_0 dp 
)
int receive_data_pattern ( SOCKET  sd,
void *  data,
int  maxdata,
const char *  pattern 
)

Definition at line 198 of file 1st_nd_lib.c.

int receive_data_udp ( SOCKET  sd,
char *  dp,
int  n 
)

Definition at line 304 of file 1st_nd_lib.c.

Referenced by isisbeamDriver::pollerThread().

int send_data ( SOCKET  sd,
data_packet_1_0 dp 
)
int send_packet ( SOCKET  sd,
const char *  data,
int  n 
)

Definition at line 137 of file 1st_nd_lib.c.

References INVALID_SOCKET.

SOCKET setup_broadcast_socket ( const char *  address,
short  port,
struct sockaddr_in *  sockin,
int  multicast 
)

Definition at line 405 of file 1st_nd_lib.c.

References INTERNET_SOCKET, and SOCKET.

SOCKET setup_socket ( unsigned short  port,
int  num_listen 
)

Definition at line 325 of file 1st_nd_lib.c.

References closesocket, INTERNET_SOCKET, INVALID_SOCKET, and SOCKET.

SOCKET setup_udp_socket ( unsigned short  port,
int  multicast 
)
char* xml_parse ( const char *  input_string,
const char *  token 
)

Definition at line 467 of file 1st_nd_lib.c.

Referenced by isisbeamDriver::pollerThread().

Variable Documentation

const char* ShutN_names[]
static
Initial value:
= {
"SLS","PRISMA","SURF","CRISP","LOQ","IRIS_OSIRIS","POL","TOSCA","HET", NULL }

Definition at line 172 of file 1st_nd_post.h.

const char* ShutS_names[]
static
Initial value:
= {
"MAPS","eVS","SXD","NO INSTRUMENT","NO INSTRUMENT","MARI","GEM","HRPD","PEARL", NULL }

Definition at line 176 of file 1st_nd_post.h.

Copyright © 2013 Science and Technology Facilities Council | Generated by   doxygen 1.8.5