Azinix

nm.h File Reference

Main package of azinix. More...

#include <stdlib.h>
#include <malloc.h>
#include <string.h>
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <time.h>
#include <signal.h>
#include <libnet.h>
#include "pcap.h"
#include "tcl.h"
#include "pcre.h"
#include "util.h"
#include "error.h"
#include "avl.h"
#include "var_set.h"
#include "array.h"
#include "st.h"
#include "list.h"
#include "heap.h"
#include "os.h"

Go to the source code of this file.

Data Structures

struct  Nm_TclCD_t
 Structure used to pass return values around as integers. More...

Defines

#define bool   int
#define false   0
#define true   1
#define INFINITY   (1 << 30)
 Infinity - works with signed/unsigned ints.

Typedefs

typedef Nm_TclCD_t Nm_TclCD_t
typedef void(*) handler_t ()
 Macros for int, true and falseTypedef to get extproto to correctly parse functions with function pointer arguments.

Enumerations

enum  Nm_TclCmdReturnCodes_t { Nm_TclRetCodeFALSE_c, Nm_TclRetCodeTRUE_c, Nm_TclRetCodeUndecided_c, Nm_TclNumRetCodes_c }
 Tcl return codes. More...

Functions

void Nm_Init (int argc, char **argv)
void Nm_End ()
int main (int argc, char **argv)
 Narya main routine.
int Nm_Tcl (Tcl_Interp *interp, Nm_TclCD_t *cd)
 If we want to use narya with a tcl script, we call this function to register the commands exported from C, initialize the tclToC table, and then invoke the script.
int sourceTclrc (Tcl_Interp *interp)
 Source an init file called .tclrc.
void Nm_TclResult (Tcl_Interp *interp, ClientData cd, void *ptr)
 Code to take a raw pointer and set it as the result of a tcl command.
int Nm_TclGetStringVar (Tcl_Interp *interp, char *tclVarName, char **result)
 Code encapsulating getting a string var from Tcl environment.
int Nm_TclGetDoubleVar (Tcl_Interp *interp, char *tclVarName, double *result)
 Code encapsulating getting a double var from Tcl environment.
int Nm_TclGetArrayVar (Tcl_Interp *interp, char *tclVarName, array_t *result)
 Code encapsulating getting an array var from Tcl environment.
int Nm_TclGetIntVar (Tcl_Interp *interp, char *tclVarName, int *result)
 Code encapsulating getting an int var from Tcl environment.
Nm_TclCD_tNm_TclCDInit ()
 Allocate a client data structure.
int Nm_TclCDStorePtr (Nm_TclCD_t *cd, void *ptr)
 Store a pointer in the CD structure. Return the int id of this pointer.
void * Nm_TclCDReadPtrFromObj (Tcl_Interp *interp, Nm_TclCD_t *cd, Tcl_Obj *const obj)
 Read a pointer from the CD structure from obj argument.
void * Nm_TclCDReadPtr (Nm_TclCD_t *cd, int id)
 Read a pointer from the CD structure.
void Nm_TclCDReuseId (Nm_TclCD_t *cd, int id)
 Return an id to the pool of available ids.
int pktReadTcpInfo (ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[])
 Return information in tcl string form for the tcp packet.


Detailed Description

Main package of azinix.

Definition in file nm.h.


Define Documentation

#define bool   int

Definition at line 52 of file nm.h.

#define false   0

Definition at line 53 of file nm.h.

#define INFINITY   (1 << 30)

Infinity - works with signed/unsigned ints.

Definition at line 95 of file nm.h.

#define true   1

Definition at line 54 of file nm.h.


Typedef Documentation

typedef void(*) handler_t()

Macros for int, true and falseTypedef to get extproto to correctly parse functions with function pointer arguments.

Definition at line 116 of file nm.h.

typedef struct Nm_TclCD_t Nm_TclCD_t

Definition at line 86 of file nm.h.


Enumeration Type Documentation

enum Nm_TclCmdReturnCodes_t

Tcl return codes.

Enumerator:
Nm_TclRetCodeFALSE_c 
Nm_TclRetCodeTRUE_c 
Nm_TclRetCodeUndecided_c 
Nm_TclNumRetCodes_c 

Definition at line 67 of file nm.h.


Function Documentation

int main ( int  argc,
char **  argv 
)

Narya main routine.

Definition at line 47 of file nmMain.c.

void Nm_End (  ) 

void Nm_Init ( int  argc,
char **  argv 
)

AutomaticStart

int Nm_Tcl ( Tcl_Interp *  interp,
Nm_TclCD_t cd 
)

If we want to use narya with a tcl script, we call this function to register the commands exported from C, initialize the tclToC table, and then invoke the script.

Definition at line 113 of file nmTcl.c.

Nm_TclCD_t* Nm_TclCDInit (  ) 

Allocate a client data structure.

Definition at line 894 of file nmTcl.c.

void* Nm_TclCDReadPtr ( Nm_TclCD_t cd,
int  id 
)

Read a pointer from the CD structure.

Definition at line 949 of file nmTcl.c.

void* Nm_TclCDReadPtrFromObj ( Tcl_Interp *  interp,
Nm_TclCD_t cd,
Tcl_Obj *const  obj 
)

Read a pointer from the CD structure from obj argument.

Definition at line 935 of file nmTcl.c.

void Nm_TclCDReuseId ( Nm_TclCD_t cd,
int  id 
)

Return an id to the pool of available ids.

Definition at line 962 of file nmTcl.c.

int Nm_TclCDStorePtr ( Nm_TclCD_t cd,
void *  ptr 
)

Store a pointer in the CD structure. Return the int id of this pointer.

Definition at line 910 of file nmTcl.c.

int Nm_TclGetArrayVar ( Tcl_Interp *  interp,
char *  tclVarName,
array_t result 
)

Code encapsulating getting an array var from Tcl environment.

Definition at line 851 of file nmTcl.c.

int Nm_TclGetDoubleVar ( Tcl_Interp *  interp,
char *  tclVarName,
double *  result 
)

Code encapsulating getting a double var from Tcl environment.

Definition at line 832 of file nmTcl.c.

int Nm_TclGetIntVar ( Tcl_Interp *  interp,
char *  tclVarName,
int *  result 
)

Code encapsulating getting an int var from Tcl environment.

Definition at line 877 of file nmTcl.c.

int Nm_TclGetStringVar ( Tcl_Interp *  interp,
char *  tclVarName,
char **  result 
)

Code encapsulating getting a string var from Tcl environment.

Definition at line 815 of file nmTcl.c.

void Nm_TclResult ( Tcl_Interp *  interp,
ClientData  cd,
void *  ptr 
)

Code to take a raw pointer and set it as the result of a tcl command.

Definition at line 622 of file nmTcl.c.

int pktReadTcpInfo ( ClientData  cd,
Tcl_Interp *  interp,
int  objc,
Tcl_Obj *const  objv[] 
)

Return information in tcl string form for the tcp packet.

Definition at line 1119 of file nmTcl.c.

int sourceTclrc ( Tcl_Interp *  interp  ) 

Source an init file called .tclrc.

Look in local directory only.

Definition at line 157 of file nmTcl.c.