File:  [ELWIX - Embedded LightWeight unIX -] / ansh / inc / defs.h
Revision 1.1.1.1.2.2: download - view: text, annotated - select for diffs - revision graph
Thu Oct 13 11:01:37 2011 UTC (12 years, 9 months ago) by misho
Branches: ansh1_0
Diff to: branchpoint 1.1.1.1: preferred, unified
fix layer2 communication, partitioning data to 512 bytes slices

    1: /*************************************************************************
    2:  * (C) 2011 AITNET - Sofia/Bulgaria - <office@aitnet.org>
    3:  *  by Michael Pounov <misho@elwix.org>
    4:  *
    5:  * $Author: misho $
    6:  * $Id: defs.h,v 1.1.1.1.2.2 2011/10/13 11:01:37 misho Exp $
    7:  *
    8:  *************************************************************************/
    9: #ifndef __DEFS_H
   10: #define __DEFS_H
   11: 
   12: 
   13: #define STRSIZ		256
   14: #define ANSH_L2_BUFLEN	1024
   15: #define PIDFILE_ANSHD	"/var/run/anshd.pid"
   16: #define PIDFILE_ANSH3D	"/var/run/ansh3d.pid"
   17: 
   18: #define VERB(x)		if ((x) <= Verbose)
   19: #define FTRACE(x)	if ((x) <= Verbose) syslog(LOG_DEBUG, "Debug:: I`m in %s(%d) ...\n", __func__, __LINE__)
   20: #define LOG(fmt, ...)	do { assert((fmt)); \
   21: 					char sz_log_fmt[STRSIZ] = { 0 }; \
   22: 					snprintf(sz_log_fmt, sizeof sz_log_fmt, (fmt), ##__VA_ARGS__); \
   23: 					syslog(LOG_DEBUG, "Log:: %s(%d) -> %s\n", __func__, __LINE__, sz_log_fmt); \
   24: 				} while (0)
   25: #define ERR(fmt, ...)	do { assert((fmt)); \
   26: 					char sz_err_fmt[STRSIZ] = { 0 }; \
   27: 					snprintf(sz_err_fmt, sizeof sz_err_fmt, (fmt), ##__VA_ARGS__); \
   28: 					syslog(LOG_ERR, "Error:: %s(%d) -> %s\n", __func__, __LINE__, sz_err_fmt); \
   29: 				} while (0)
   30: 
   31: struct tagProc {
   32: 	u_short			proc_id;
   33: 	u_short			proc_seq;
   34: 
   35: 	char			proc_flg;
   36: 
   37: 	int			proc_pty;
   38: 	char			proc_ttyname[64];
   39: 	pid_t			proc_pid;
   40: 
   41: 	int			proc_sock;
   42: 	struct sockaddr		proc_cli;
   43: 	struct ether_addr	proc_ea;
   44: 
   45: 	u_short			proc_blen;
   46: 	u_char			*proc_buf_[2];
   47: 	u_short			proc_rlen_[2];
   48: #define NET2FD			0
   49: #define FD2NET			1
   50: 
   51: 	SLIST_ENTRY(tagProc)	proc_next;
   52: };
   53: typedef SLIST_HEAD(, tagProc)	proc_head_t;
   54: 
   55: 
   56: extern intptr_t Kill;
   57: extern int Timeout, Verbose;
   58: extern u_int Crypted;
   59: 
   60: 
   61: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>