original files of m241

This commit is contained in:
neelimap
2026-07-30 11:19:44 +05:30
parent 170c2b3f3a
commit afc7070c1f
12254 changed files with 7655111 additions and 0 deletions
@@ -0,0 +1,201 @@
/* dsiSockLib.h - DSI sockets backend */
/*
* Copyright (c) 2004-2007, 2010-2012 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01o,12jul12,shi clean up warnings (WIND00357529)
01n,08sep11,shi fix defect WIND00297134; update the declaration of dsiGetsockopt() and dsiSetsockopt()
01m,24jun11,shi LP64 conversion
01l,29apr10,pad Moved extern C statement after include statements.
01k,19jun07,ebh Changes to allow COMP to run on SMP systems (SMP-safe)
01j,09may07,ebh Changed dsiSoFree to return a STATUS (Defect #91328)
01i,16sep06,kch Replaced (struct ifnet *) references with (void *).
01h,10feb05,dlk Embed socket semaphores in struct socket, and remove
so_timeoSem and so_lingerSem.
01g,23sep04,bwa added dsiDomainAdd() prototype.
01f,19aug04,bwa added dsiDataPoolShow() and dsiSysPoolShow() prototypes.
01e,16aug04,bwa updated dsiPoolInit() prototype.
01d,11jun04,ymz removed compiler warning
01c,31may04,bwa added DSI_PKT_SZ and DSI_SB_ALLOC macro.
01b,12may04,bwa modified dsiPoolInit() prototype's parameters list.
01a,18mar04,bwa written, copied from bsdSockLib.h
*/
#ifndef __INCdsiSockLibh
#define __INCdsiSockLibh
/* includes */
#include <netVersion.h>
#include <dsi/socketvar.h>
#include <sockFunc.h>
#include <stat.h>
#include <cfgDefs.h>
#include <netBufLib.h>
#include <net/domain.h>
#ifdef __cplusplus
extern "C" {
#endif
/* DSI buffer pools */
extern NET_POOL_ID _pDsiDpool;
extern NET_POOL_ID _pDsiSysPool;
/* allocation of clusters for address holders and PCBs */
#define DSI_SO_ALLOC(ds) (void *) netClusterGet(_pDsiSysPool, \
netClPoolIdGet(_pDsiSysPool, (sizeof(ds)), TRUE))
#define DSI_PCB_ALLOC(ds) DSI_SO_ALLOC(ds)
#define DSI_ADDR_ALLOC(ds) DSI_SO_ALLOC(ds)
#define DSI_SO_FREE(x) netClFree (_pDsiSysPool, (UCHAR *)(x))
#define DSI_PCB_FREE(x) DSI_SO_FREE(x)
#define DSI_ADDR_FREE(x) DSI_SO_FREE(x)
/* wrapper macros */
#define DSI_SB_LOCK(sb, wf) ((sb)->sb_flags & SB_LOCK ? \
(((wf) == M_WAITOK) ? dsiSbLock(sb) : EWOULDBLOCK) : \
(((sb)->sb_flags |= SB_LOCK), 0))
/* release lock on sockbuf sb */
#define DSI_SB_UNLOCK(sb) { \
(sb)->sb_flags &= ~SB_LOCK; \
if ((sb)->sb_flags & SB_WANT) { \
(sb)->sb_flags &= ~SB_WANT; \
{ \
int i; /* loop counter */ \
for (i=sb->sb_refCount; i>0; i--) \
{ \
semGive(&sb->sb_Sem); \
} \
} \
} \
}
/* wake up all pending tasks on the socket for receive */
#define DSI_SO_R_WAKEUP(so) \
do \
{ \
if (sb_notify(&(so)->so_rcv)) \
dsiSbWakeup((so), &(so)->so_rcv, SELREAD); \
} while ((0))
/* indicate that one task can receive a packet on the receive socket */
#define DSI_SO_R_WAKEUP_ONE(so) \
do \
{ \
dsiSbWakeupOne((so), &(so)->so_rcv, SELREAD); \
} while ((0))
#define DSI_SO_W_WAKEUP(so) \
do { \
if (sb_notify(&(so)->so_snd)) \
dsiSbWakeup((so), &(so)->so_snd, SELWRITE); \
} while ((0))
/*
* DSI_PKT_SZ - compute the size and cnt of a DSI packet
*
* void DSI_PKT_SZ
* (
* mbuf * pMbuf, /# the packet in mbuf form #/
* int sz, /# return value: packet size #/
* int cnt /# return value: cluster count #/
* )
*/
#define DSI_PKT_SZ(pMbuf, sz, cnt) \
do \
{ \
struct mbuf * DSI_PKT_SZ_pCur = (pMbuf); \
while (DSI_PKT_SZ_pCur != NULL) \
{ \
sz += DSI_PKT_SZ_pCur->m_len; \
cnt += MSIZE; \
if (DSI_PKT_SZ_pCur->m_flags & M_EXT) \
cnt += DSI_PKT_SZ_pCur->m_extSize; \
DSI_PKT_SZ_pCur = DSI_PKT_SZ_pCur->m_next; \
} \
} \
while ((0))
#define DSI_SB_ALLOC(pSb, sz, cnt) \
do \
{ \
(pSb)->sb_cc += sz; \
(pSb)->sb_mbcnt += cnt; \
} \
while ((0))
/* function declarations */
extern STATUS dsiDomainAdd (struct domain * pDomain);
extern SOCK_FUNC *dsiSockLibInit (void);
extern void dsiSysPoolShow (void);
extern void dsiDataPoolShow (void);
extern STATUS dsiPoolInit (NET_POOL_CONFIG_PARAMS * pPools);
extern STATUS dsiConnect (struct socket *so, struct sockaddr *name, int namelen);
extern STATUS dsiConnectWithTimeout (struct socket *so, struct sockaddr *adrs,
int adrsLen, struct timeval *timeVal);
extern STATUS dsiGetpeername (struct socket *so, struct sockaddr *name, int *namelen);
extern STATUS dsiGetsockname (struct socket *so, struct sockaddr *name, int *namelen);
extern STATUS dsiGetsockopt (struct socket *so, int level, int optname, char *optval,
socklen_t *optlen);
extern STATUS dsiSetsockopt (struct socket *so, int level, int optname, char *optval,
socklen_t optlen);
extern STATUS dsiShutdown (struct socket *so, int how);
extern int dsiAccept (struct socket **pSo, struct sockaddr *addr, int *addrlen);
extern ssize_t dsiRecv (struct socket *so, char *buf, size_t bufLen, int flags);
extern int dsiRecvfrom (struct socket *so, char *buf, int bufLen, int flags,
struct sockaddr *from, int *pFromLen);
extern int dsiRecvmsg (struct socket *so, struct msghdr *mp, int flags);
extern ssize_t dsiSend (struct socket *so, char *buf, size_t bufLen, int flags);
extern int dsiSendmsg (struct socket *so, struct msghdr *mp, int flags);
extern int dsiSendto (struct socket *so, caddr_t buf, int bufLen, int flags,
struct sockaddr *to, int tolen);
extern STATUS dsiZbufSockRtn (void);
extern struct socket * dsiSoAlloc (void);
extern struct socket * dsiSoNewConn3 (struct socket * head, int connstatus,
struct proc * p);
extern int dsiSoCreate (int dom, struct socket ** aso, int type,
int proto, struct proc * p);
extern STATUS dsiSoFree(struct socket * so);
extern int dsiSoClose(struct socket * so);
extern int dsiSoAbort(struct socket * so);
extern void dsiSoIsConnected (struct socket *so);
extern void dsiSoIsDisconnected (struct socket *so);
extern void dsiSoCantSendMore (struct socket *so);
extern void dsiSoCantRcvMore (struct socket *so);
extern int dsiSbLock (struct sockbuf *sb);
extern void dsiSbWakeup (struct socket *so, struct sockbuf *sb,
SELECT_TYPE wakeupType);
extern void dsiSbWakeupOne (struct socket *so, struct sockbuf *sb,
SELECT_TYPE wakeupType);
extern int dsiControlNotSupp (struct socket *so, u_long cmd, caddr_t data,
void *ifp, struct proc *p);
extern int dsiRcvoobNotSupp (struct socket *so, struct mbuf *m, int flags);
extern int dsiSenseNull (struct socket *so, struct stat *sb);
int dsiSoReserve (struct socket *so, u_long sndcc, u_long rcvcc);
ssize_t dsiSbReserve (struct sockbuf *sb, u_long cc, struct socket *so,
struct proc *p);
extern int dsiSbWait (struct sockbuf *sb);
extern int dsiSbNoWait (struct sockbuf *sb);
#ifdef __cplusplus
}
#endif
#endif /* __INCdsisocklibh */
@@ -0,0 +1,32 @@
/* dsiUtilLib.h - DSI stack utilities header */
/* Copyright 2004 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,17aug04,dlk written.
*/
#ifndef __INCdsiUtilLibh
#define __INCdsiUtilLibh
#include <vxWorks.h>
#include <semLib.h>
#ifdef __cplusplus
extern "C" {
#endif
extern STATUS dsiLockInit (void);
extern int dsiLock (void);
extern void dsiUnlock (int);
extern STATUS dsiTsleep (SEM_ID semId, int timeo_val);
#ifdef __cplusplus
}
#endif
#endif /* __INCdsiUtilLibh */
@@ -0,0 +1,43 @@
/* salClientP.h - socket application library client private header file */
/* Copyright 2003-2004, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01f,28apr10,pad Moved extern C statement after include statements.
01e,16feb05,ebh rename sockopt struct to salSockopt (it conflicts with
target/h/wrn/coreip/net/socketvar.h)
01d,19may04,ymz coding convention alignment.
01c,08apr04,ymz code review changes.
01b,23feb04,ymz changed salClient to socket fd.
01a,26nov03,als created.
*/
#ifndef __INCsalClientPh
#define __INCsalClientPh
/* includes */
#include "dsi/salClient.h"
#include "dsi/private/salCommonP.h"
#ifdef __cplusplus
extern "C" {
#endif
/* function declarations */
extern int salSnsClientCreate (void);
extern STATUS salSnsClientDelete (int sockfd);
extern STATUS salSnsClientReplyCheck (int actualSize, int expectedSize);
extern int salAttach (struct addrinfo * pSockInfoList,
struct salSockopt * pSockOptions, int numOptions);
#ifdef __cplusplus
}
#endif
#endif /* __INCsalClientPh */
@@ -0,0 +1,108 @@
/* salCommonP.h - socket application library common private header file */
/*
* Copyright (c) 2003-2004, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute or otherwise make use of this software
* may be licensed only pursuant to the terms of an applicable Wind River
* license agreement.
*/
/*
modification history
--------------------
01i,09sep10,jpb Removed unused function pointer salEvtRtn.
01h,29jul10,pad Moved extern C statement after include statements.
01g,26may04,ymz updated debugging info due to file merging.
01f,06may04,ymz fixed salEvtRtn build error for wvLib.c.
01e,29apr04,ymz added salEvtRtn definition.
01d,20feb04,ymz code review changes
01c,05dec03,als add debugging code support to RTP space
01b,03dec03,als restrict debugging code to kernel space only
01a,26nov03,als created
*/
#ifndef __INCsalCommonPh
#define __INCsalCommonPh
/* includes */
#include "dsi/salCommon.h"
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
#ifdef _WRS_KERNEL
/* uncomment the following line to include SAL debugging code in kernel apps */
/* #define SAL_DEBUG_ON */
#else
/* uncomment the following line to include SAL debugging code in RTP apps */
/* #define SAL_DEBUG_ON */
#endif
#ifdef SAL_DEBUG_ON /* define SAL debugging tools */
#ifdef __cplusplus
}
#endif
#ifdef _WRS_KERNEL
/* use logMsg() to display debugging messages in kernel apps */
#include <logLib.h>
#else
/* logMsg() isn't available to RTP apps, so use printf() instead */
#include <stdio.h>
#define logMsg printf
#endif
#ifdef __cplusplus
extern "C" {
#endif
/* output levels used for SAL debugging, in order of decreasing importance
*/
#define SAL_DEBUG_NONE 0 /* disable debug output */
#define SAL_DEBUG_SEVERE 1 /* for an unexpected error path */
#define SAL_DEBUG_ERROR 3 /* for an expected error path */
#define SAL_DEBUG_SUCCESS 5 /* for a success path */
#define SAL_DEBUG_CONTROL 7 /* for a change in control */
#define SAL_DEBUG_ALL 9 /* for super-detailed info */
/* define the current debug level */
#define SAL_DEBUG_LEVEL SAL_DEBUG_NONE
/* macro that prints out debugging info using logMsg
- level: minimum debug level required to activate output
- format: printf-style format string
- value: single numeric value that can be referenced by "format"
macro automatically includes the name of the invoking function
*/
#define SAL_DEBUG(level, format, value) \
if (SAL_DEBUG_LEVEL >= (level)) \
{ logMsg ("%s: " format "\n", \
(_Vx_usr_arg_t)__FUNCTION__, (_Vx_usr_arg_t)value, \
0, 0, 0, 0); } \
else \
{ /* prevent accidental mismatch with nested if's */ }
/* current debugging level used for SAL debugging;
the higher the value, the more output is shown
*/
#else /* alternate SAL debugging tools (when no debugging is required) */
/* macro that prints out debugging info does nothing */
#define SAL_DEBUG(level, format, value)
#endif /* SAL_DEBUG_ON */
#ifdef __cplusplus
}
#endif
#endif /* __INCsalCommonPh */
@@ -0,0 +1,64 @@
/* salServerP.h - socket application library server private header file */
/* Copyright 2003-2004, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01d,28apr10,pad Moved extern C statement after include statements.
01c,10jun04,ymz made salRegister and salUnregister private.
01b,01mar04,ymz code review changes
01a,26nov03,als created
*/
#ifndef __INCsalServerPh
#define __INCsalServerPh
/* includes */
#include "dsi/salServer.h"
#include "dsi/private/salCommonP.h"
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
/* number of backlog for SAL server listening */
#define SAL_LISTEN_BACKLOG 15
/* typedef */
/* SAL server handle */
typedef struct salServer /* socket application server */
{
struct salServer * magic; /* structure integrity check */
snsServDesc service; /* service descriptor */
fd_set allSockets; /* all server sockets */
fd_set readSockets; /* sockets used with read fn */
int numSockets; /* # of server sockets */
int maxSockfd; /* upper bound on server's fd's */
SAL_SERV_RTN acceptFn;
/* accept processing routine */
SAL_SERV_RTN readFn;
/* read processing routine */
} SAL_SERVER;
/* function declarations */
extern SAL_SERVER_ID salInit (void);
extern STATUS salTerm (SAL_SERVER_ID servId);
extern snsServDesc salRegister (const char * name,
struct addrinfo * pSockInfoList);
extern STATUS salDeregister (snsServDesc service);
#ifdef __cplusplus
}
#endif
#endif /* __INCsalServerPh */
+395
View File
@@ -0,0 +1,395 @@
/* snsLibP.h - Socket Name Service library private header file */
/*
* Copyright (c) 2003-2005, 2007, 2010-2011 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01n,19jul11,shi LP64 conversion
01m,28apr10,pad Moved extern C statement after include statements.
01l,15oct07,ebh Added new command DSAL_CMD_SNS_NETWORK
01k,04jan07,mze added extern of new snsfreeaddrinfo
01j,10may05,ebh update to use a single instance for distributed SAL
ensure all fields are 32-bit values for dsal messaging
01i,25apr05,ebh fix structure for distributed removal messages
01h,07mar05,ebh added sockaddr_max structure to the sns_register_reply struct
added distributed SAL define(s)
01g,01sep04,ymz added snsPatchMatch prototyping.
01f,19may04,ymz coding convention alignment.
01e,13apr04,ymz code review changes.
01d,30mar04,ymz added new messaging types.
01c,02mar04,ymz code review changes
01b,09feb04,ymz add RTP cleanup, and URL support.
01a,26nov03,als created.
*/
#ifndef __INCsnsLibPh
#define __INCsnsLibPh
/* includes */
#include "vxWorks.h"
#include "netdb.h"
#include "dsi/snsLib.h"
#include "sys/un.h"
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
/* socket address used by SNS server */
#define SNS_SERVER_PATH "/comp/socket/0x405"
/*
* alias for the largest possible socket address structure
* (currently an AF_LOCAL-type socket address)
*/
#define sockaddr_max sockaddr_un
/* number of attempts connecting to the SNS server */
#define SNS_INIT_RETRY 12
/* retry internal in ticks */
#define SNS_INIT_TIMEOUT 10
/* wildcards characters */
#define SNS_WILDCARDS "*?"
/* reserved characters not allowed as service name */
#define SNS_URL_RESERVES_FULL "*?@:#/<>%|[]{},\\ \'&;=+$"
/* SNS_URL_RESERVES minus wildcards characters */
#define SNS_URL_RESERVES_LESS_WILDCARD "@:#/<>%|[]{},\\ \'&;=+$"
/* define size of a service name plus text version of its scope */
#define SAL_SERV_NAME_SCOPE_MAXSIZE \
(SAL_SERV_NAME_MAXSIZE+sizeof(SNS_SCOPE_LONGEST_ENTRY_STR))
/* Distributed SAL entries */
#define DSAL_SNS_DEFAULT_TYPE 51 /* default SAL TIPC type */
#define DSAL_SNS_DEFAULT_INSTANCE 51 /* default SAL TIPC instance */
#define DSAL_VERSION 0 /* version of DSAL, part of CMD */
#define DSAL_REMOTE_NODE_ID ((long)(-2)) /* indicate remote owner */
#define DSAL_INVALID_SOCKFD (-1) /* sock fd that is not active */
#define DSAL_NAMES_MSG_SIZE_MAX 1000 /* maximum msg payload size */
/* typedefs */
typedef struct /* distributed SAL message */
{
UINT32 cmd; /* DSAL Command */
char bytes[1]; /* empty */
} DSAL_BASE_MSG;
/*
* The contents of the DSAL_ADD_MSG are placed inside the DSAL_GENERIC_NAME_MSG
* and this structure is not used directly.
*/
typedef struct /* dSAL add one name message */
{
UINT32 cmd; /* DSAL Command */
UINT32 ai_flags; /* AI_PASSIVE, AI_CANONNAME, ... */
UINT32 ai_family; /* AF_xxx */
UINT32 ai_socktype; /* SOCK_xxx */
UINT32 ai_protocol; /* sockProtocol */
UINT32 scope; /* service scope */
/* the following indented fields are fairly TIPC specific
* - other protocols may modify these and the receiver would have
* to base processing on the ai_family field above. */
/* probably best to make the following a union when other protocols added */
UINT32 ai_id_ref; /* TIPC port ID reference */
UINT32 ai_id_node; /* TIPC port ID node */
/* the name field was added to the end of this message so that the
* null terminator can be the terminator of the record. A subsequent
* record could then be appended directly starting with the first
* field after 'cmd'. */
char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name (4 byte padded)*/
} DSAL_ADD_MSG;
/*
* The structure of a message that is sent across the network. set up to
* be aligned to an integer. The structure is that of DSAL_ADD_MSG but
* potentially with the record (less the cmd field) portion repeated for
* each name to add.
*/
typedef struct /* dSAL add name(s) message */
{
UINT32 spaceholder[DSAL_NAMES_MSG_SIZE_MAX/sizeof(UINT32) + 1];
} DSAL_GENERIC_NAME_MSG;
/*
* The sns_remove_msg structure is not used directly, but the removal message
* sent across the network uses the fields in this order and meaning when
* constructing and destructing the message.
*/
typedef struct /* dSAL remove name message */
{
UINT32 cmd; /* DSAL Command */
UINT32 scope; /* service scope of the entry */
/* the following is fairly TIPC specific - other protocols may modify
* and the receiver will have to base everything on the ai_family above. */
/* probably best to make the following a union when other protocols added */
UINT32 ai_id_ref; /* TIPC port ID reference */
UINT32 ai_id_node; /* TIPC port ID node */
/* note that all fields above are 32-bit aligned if required */
char name[SAL_SERV_NAME_MAXSIZE]; /* service name (4 byte padded) */
} DSAL_REMOVE_MSG;
typedef struct /* dSAL SNS server change message */
{
UINT32 cmd; /* DSAL Command */
UINT32 nodeId; /* node number of SNS server */
UINT32 ref; /* socket ref of SNS server */
} DSAL_SNS_MSG;
typedef struct /* dSAL Get Names message */
{
UINT32 cmd; /* DSAL Command */
} DSAL_SNS_GET_NAMES_MSG;
typedef struct serv_sock /* service socked info */
{
struct addrinfo sockInfo; /* info for first/next socket */
struct sockaddr_max sockAddr; /* socket address */
} SNS_SERV_SOCK;
enum sns_cmd_value /* SNS message codes */
{
SNS_CMD_NOOP = 0,
SNS_CMD_REGISTER = 1, /* register a service */
SNS_CMD_REGCONT = 2, /* continue the registeration */
SNS_CMD_DEREGISTER = 3, /* deregister */
SNS_CMD_REMOVE = 4, /* SNS entry remove by name */
SNS_CMD_FINDSERV = 5, /* find a service */
SNS_CMD_GETSOCK = 6, /* get a service sock info */
SNS_CMD_NEXTSERV = 7, /* find the next service */
SNS_CMD_CLEANUP = 8, /* cleanup services of dead RTP */
SNS_CMD_MAX
};
enum dsal_cmd_value /* DSAL message codes */
{
DSAL_CMD_SNS_WITHDRAWN = 20, /* specified node has disappeared */
DSAL_CMD_SNS_PUBLISHED = 21, /* specified node has appeared */
DSAL_CMD_GET_NAMES = 22, /* request full database */
DSAL_CMD_ADD_NAMES = 23, /* specified names are available */
DSAL_CMD_REMOVE_NAMES = 24, /* specified names are removed */
DSAL_CMD_SNS_NETWORK = 25, /* our node now in network mode */
DSAL_CMD_MAX
};
/* SERVICE REGISTRATION MESSAGE STRUCTURES */
typedef struct sns_register_msg /* service registration message */
{
uint8_t cmd; /* SNS_CMD_REGISTER */
long rtpId; /* RTP making request */
int scope; /* scope (NONE forces decode) */
char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */
struct addrinfo sockInfo; /* first socket to register */
struct sockaddr_max sockAddr; /* socket address */
BOOL done; /* TRUE if no more to register */
} SNS_REGISTER_MSG;
typedef struct sns_register_reply /* service registration reply */
{
snsServDesc service; /* service descriptor */
int regErrno; /* registration result */
} SNS_REGISTER_REPLY_MSG;
/* CONTINUE SERVICE REGISTRATION MESSAGE STRUCTURES */
typedef struct sns_regcont_msg /* continue registration message */
{
uint8_t cmd; /* SNS_CMD_REGCONT */
long rtpId; /* RTP making request */
snsServDesc service; /* service descriptor */
struct addrinfo sockInfo; /* next socket to register */
struct sockaddr_max sockAddr; /* socket address */
BOOL done; /* TRUE if no more to register */
} SNS_REGCONT_MSG;
/* note: uses the same reply as a service registration msg */
/* SERVICE DEREGISTRATION MESSAGE STRUCTURES */
typedef struct sns_deregister_msg /* service deregistration message */
{
uint8_t cmd; /* SNS_CMD_DEREGISTER */
long rtpId; /* RTP making request */
snsServDesc service; /* service descriptor */
} SNS_DEREGISTER_MSG;
typedef struct sns_deregister_reply /* service deregistration reply */
{
int deregErrno; /* deregistration result */
} SNS_DEREGISTER_REPLY_MSG;
/* SERVICE REMOVAL BY NAME MESSAGE STRUCTURES */
typedef struct sns_remove_msg /* service remove message */
{
uint8_t cmd; /* SNS_CMD_REMOVE */
long rtpId; /* RTP making the request */
int scope; /* service scope of entry */
char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */
} SNS_REMOVE_MSG;
typedef struct sns_remove_reply /* service remove reply */
{
int removeErrno; /* deregistration result */
} SNS_REMOVE_REPLY_MSG;
/* FIND SERVICE MESSAGE STRUCTURES */
typedef struct sns_findserv_msg /* find service message */
{
uint8_t cmd; /* SNS_CMD_FINDSERV */
BOOL findSocket; /* TRUE for salSocketFind req */
/* FALSE for salNameFind req */
snsServDesc service; /* last matching addr */
long rtpId; /* RTP making request */
char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */
} SNS_FINDSERV_MSG;
/* note: uses the same reply as a get socket info message */
/* GET SOCKET INFO MESSAGE STRUCTURES */
typedef struct sns_getsock_msg /* get socket info message */
{
uint8_t cmd; /* SNS_CMD_GETSOCK */
long rtpId; /* RTP making request */
snsServDesc service; /* service descriptor */
int numSockets; /* # sockets already gotten */
} SNS_GETSOCK_MSG;
/* reply to sns_findserv_msg or sns_getsock_msg */
typedef struct sns_get_namesock_reply /* get name or socket reply */
{
snsServDesc service; /* service descriptor */
int getSockErrno; /* error # (if invalid service) */
BOOL done; /* TRUE if no more info to get */
union { /* server socket or name info */
SNS_SERV_SOCK servSocketinfo; /* server socket info */
char name[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */
} serNameSockInfo; /* server socket or name info */
#define serName serNameSockInfo.name
#define servSockInfo serNameSockInfo.servSocketinfo.sockInfo
#define servSockAddr serNameSockInfo.servSocketinfo.sockAddr
} SNS_GET_NAMESOCK_REPLY_MSG;
/* GET NEXT SERVICE MESSAGE STRUCTURES */
typedef struct sns_nextserv_msg /* get next service message */
{
uint8_t cmd; /* SNS_CMD_NEXTSERV */
snsServDesc service; /* last known service */
} SNS_NEXTSERV_MSG;
typedef struct sns_nextserv_reply /* get next service reply */
{
snsServDesc service; /* service descriptor */
int nextServErrno; /* error # (if invalid service) */
BOOL servAvail; /* service completely registered */
long servOwner; /* RTP that registered service */
int servScope; /* service scope */
char servName[SAL_SERV_NAME_SCOPE_MAXSIZE]; /* service name or pattern */
} SNS_NEXTSERV_REPLY_MSG;
/* RTP SERVICE CLEANUP MESSAGE STRUCTURES */
typedef struct sns_serv_cleanup
{
uint8_t cmd; /* SNS_CMD_CLEANUP */
long rtpId; /* rtp being deleted */
} SNS_SERV_CLEANUP_MSG;
/* GENERIC MESSAGE STRUCTURES */
union sns_msg /* summary of all SNS protocol messages */
{
SNS_REGISTER_MSG reg_msg;
SNS_REGISTER_REPLY_MSG regreply_msg;
SNS_REGCONT_MSG regcont_msg;
SNS_DEREGISTER_MSG dereg_msg;
SNS_DEREGISTER_REPLY_MSG deregreply_msg;
SNS_REMOVE_MSG remove_msg;
SNS_REMOVE_REPLY_MSG remreply_msg;
SNS_FINDSERV_MSG findserv_msg;
SNS_GETSOCK_MSG getsock_msg;
SNS_GET_NAMESOCK_REPLY_MSG getnmsockreply_msg;
SNS_NEXTSERV_MSG nextserv_msg;
SNS_NEXTSERV_REPLY_MSG nextservreply_msg;
SNS_SERV_CLEANUP_MSG servcleanup_msg;
};
/* size of largest message used by SNS */
#define SNS_MSG_MAXSIZE sizeof (union sns_msg)
struct sns_dsal_msg
{
union /* summary of all Distributed SAL messages */
{
DSAL_BASE_MSG base_msg;
DSAL_SNS_MSG node_msg;
DSAL_SNS_GET_NAMES_MSG get_msg;
DSAL_ADD_MSG add_msg;
DSAL_REMOVE_MSG remove_msg;
} dsal;
};
/* size of largest message used by Distributed SAL */
#define DSAL_MSG_MAXSIZE sizeof (struct sns_dsal_msg)
struct sns_max_msg /* largest possible SNS message */
{
uint8_t cmd; /* command byte */
char dummy[SNS_MSG_MAXSIZE-1]; /* space for rest of message */
};
struct sns_scope_info /* scope information structure */
{
int value; /* numeric form of scope */
char * exactScope; /* exact scope */
char * uptoScope; /* text form of exact scope */
char * displayScope; /* displayed text for snsShow */
};
/* function declarations */
void snsfreeaddrinfo (struct addrinfo * ai );
extern int snsPatMatch (const char * pat, const char * str);
/* externs */
/* table used in converting text form of scope to numeric form */
extern const struct sns_scope_info snsScopeTbl[];
#ifdef __cplusplus
}
#endif
#endif /* __INCsnsLibPh */
+48
View File
@@ -0,0 +1,48 @@
/* salClient.h - socket application library client header file */
/* Copyright 2003 - 2004, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01g,28apr10,pad Moved extern C statement after include statements.
01f,19may04,ymz modified for coding convention
01e,08apr04,ymz code review modifications.
01d,31mar04,ymz renamed salFind to salSocketFind, added salNameFind.
01c,11mar04,ymz removed salClose and client structure.
01b,20feb04,ymz code review changes
01a,26nov03,als created
*/
#ifndef __INCsalClienth
#define __INCsalClienth
/* includes */
#include "vxWorks.h"
#include "netdb.h"
#include "dsi/salCommon.h"
#ifdef __cplusplus
extern "C" {
#endif
/* function declarations */
extern int salOpen (const char * servId);
extern int salCall (int sockfd, void * pSendBuff, int sendLen,
void * pRecvBuff, int recvLen);
extern STATUS salSocketFind (const char * name, int sockFamily,
int sockType, int sockProtocol,
struct addrinfo ** ppSockInfoList);
extern int salNameFind (const char * pattern,
char servName[][SAL_SERV_NAME_MAXSIZE], int num,
void ** ppCookie);
#ifdef __cplusplus
}
#endif
#endif /* __INCsalClienth */
+65
View File
@@ -0,0 +1,65 @@
/* salCommon.h - socket application library common header file */
/* Copyright 2003-2005, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01e,28apr10,pad Moved extern C statement after include statements.
01d,16feb05,ebh rename sockopt struct to salSockopt (it conflicts with
target/h/wrn/coreip/net/socketvar.h)
01d,09feb05,vvv temporary change to workaround sockopt redefinition
01c,20apr04,ymz code review changes.
01b,03dec03,als snsLib error codes now part of salLib.
01a,26nov03,als created.
*/
#ifndef __INCsalCommonh
#define __INCsalCommonh
/* includes */
#include "vwModNum.h"
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
/* error codes */
#define S_salLib_INTERNAL_ERROR (M_salLib | 0x0001)
#define S_salLib_INVALID_ARGUMENT (M_salLib | 0x0002)
#define S_salLib_SNS_UNAVAILABLE (M_salLib | 0x0003)
#define S_salLib_SNS_DID_NOT_REPLY (M_salLib | 0x0004)
#define S_salLib_SNS_PROTOCOL_ERROR (M_salLib | 0x0005)
#define S_salLib_CLIENT_SOCKET_ERROR (M_salLib | 0x0006)
#define S_salLib_SERVER_SOCKET_ERROR (M_salLib | 0x0007)
#define S_salLib_SERVER_EXIT (M_salLib | 0x0008)
#define S_salLib_SNS_INTERNAL_ERROR (M_salLib | 0x0009)
#define S_salLib_SNS_OUT_OF_MEMORY (M_salLib | 0x000a)
#define S_salLib_INVALID_SERVICE_ID (M_salLib | 0x000b)
#define S_salLib_INVALID_SERVICE_DESCRIPTOR (M_salLib | 0x000c)
#define S_salLib_SERVICE_NOT_FOUND (M_salLib | 0x000d)
#define S_salLib_SERVICE_ALREADY_EXISTS (M_salLib | 0x000e)
#define S_salLib_NO_SOCKET_FOUND (M_salLib | 0x000f)
#define SAL_SERV_NAME_MAXSIZE 63 /* max length for an SAL service name */
/* (including trailing null) */
/* typedefs */
struct salSockopt /* socket option structure */
{
int so_level; /* option level */
int so_name; /* option name */
void * so_value; /* ptr to option value */
int so_length; /* option length */
};
#ifdef __cplusplus
}
#endif
#endif /* __INCsalCommonh */
+79
View File
@@ -0,0 +1,79 @@
/* salServer.h - socket application library server header file */
/* Copyright 2003-2004, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01h,28apr10,pad Moved extern C statement after include statements.
01g,16feb05,ebh rename sockopt struct to salSockopt (it conflicts with
target/h/wrn/coreip/net/socketvar.h)
01f,07jun04,ymz removed private functions.
01e,19may04,ymz changed for coding convention.
01d,13apr04,ymz code review changes.
01c,30mar04,ymz added salRemove, modified to event based cleanup.
01b,13feb04,ymz added timeoutFn entry to salServer.
01a,26nov03,als created
*/
#ifndef __INCsalServerh
#define __INCsalServerh
/* includes */
#include "vxWorks.h"
#include "netdb.h"
#include "dsi/snsLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/* typedefs */
/* SAL server processing routine type */
typedef enum
{
SAL_RTN_READ = 1, /* socket read routine Id */
SAL_RTN_ACCEPT /* socket accept routine Id */
} SAL_RTN_TYPE;
/* return value from SAL processing routine indicating salRun what to do */
typedef enum
{
SAL_SOCK_KEEP, /* keep the socket */
SAL_SOCK_CLOSE, /* close the socket */
SAL_SOCK_IGNORE, /* do not polling the socket any more */
SAL_RUN_TERMINATE /* terminate salRun */
} SAL_RTN_STATUS;
/* typedef SAL server processing routine */
typedef SAL_RTN_STATUS (* SAL_SERV_RTN)(int sockfd, void * pData);
typedef struct salServer * SAL_SERVER_ID;
/* function declarations */
extern SAL_SERVER_ID salCreate (const char * name, int sockFamily,
int sockType, int sockProtocol,
const struct salSockopt * options,
int numOptions);
extern STATUS salDelete (SAL_SERVER_ID servId);
extern STATUS salServerRtnSet (SAL_SERVER_ID servId, SAL_RTN_TYPE id,
SAL_SERV_RTN rtn);
extern STATUS salRun (SAL_SERVER_ID servId, void * pData);
extern STATUS salRemove (const char * name);
#ifdef __cplusplus
}
#endif
#endif /* __INCsalServerh */
+93
View File
@@ -0,0 +1,93 @@
/* snsLib.h - Socket Name Service library header file */
/*
* Copyright (c) 2003-2005, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01k,28apr10,pad Moved extern C statement after include statements.
01j,10may05,ebh parameterize SNS server type and instance for DSAL
01i,18apr05,ebh added parameter to snsServer declaration
added truncated scopy strings for snsShow command
01h,05jan05,bwa made listen socket's backlog configurable (SPR#102955).
01g,19may04,ymz changed for coding convention alignment.
01f,13apr04,ymz code review changes.
01e,30mar04,ymz changed scope expression syntax.
01d,01mar04,ymz code review changes.
01c,09feb04,ymz added URL support.
01b,03dec03,als snsLib error codes now part of salLib.
01a,26nov03,als created.
*/
#ifndef __INCsnsLibh
#define __INCsnsLibh
/* includes */
#include "vwModNum.h"
#include "dsi/salCommon.h"
#ifdef __cplusplus
extern "C" {
#endif
/* defines */
/* define service scope string used in the URL, must be in lower case */
#define SNS_SCOPE_URL_DELIMITER '@'
#define SNS_SCOPE_PRIVATE_STR "private"
#define SNS_SCOPE_UPTO_PRIVATE_STR "upto_private"
#define SNS_SCOPE_NODE_STR "node"
#define SNS_SCOPE_UPTO_NODE_STR "upto_node"
#define SNS_SCOPE_CLUSTER_STR "cluster"
#define SNS_SCOPE_UPTO_CLUSTER_STR "upto_cluster"
#define SNS_SCOPE_SYSTEM_STR "system"
#define SNS_SCOPE_UPTO_SYSTEM_STR "upto_system"
/* !! MAKE SURE THE NEXT ENTRY IS THE LONGEST SCOPE ENTRY - used internally !!*/
#define SNS_SCOPE_LONGEST_ENTRY_STR "longest_scope"
#define SNS_SCOPE_SHOW_PRIVATE_STR "priv"
#define SNS_SCOPE_SHOW_NODE_STR "node"
#define SNS_SCOPE_SHOW_CLUSTER_STR "clust"
#define SNS_SCOPE_SHOW_SYSTEM_STR "systm"
#define SNS_URL_SCHEME "sns:"
#define SNS_NUM_SCOPES 4 /* number of SNS scopes supported */
/* typedefs */
enum sns_scopes_value /* SNS service scope */
{
/* define in the increasing scale and value */
SNS_SCOPE_NONE = -1, /* unassigned value (used by overrideScope) */
SNS_SCOPE_PRIVATE = 1, /* address space (kernel/rtp) scope */
SNS_SCOPE_NODE = 3, /* local processor scope */
SNS_SCOPE_CLUSTER = 5, /* multiprocessor support using TIPC */
SNS_SCOPE_SYSTEM = 7 /* multiprocessor support not yet available */
};
typedef void * snsServDesc; /* SNS service descriptor */
/* function declarations */
extern STATUS snsServer (const int backlog, const int distributedFlag,
const int snsServerType, const int snsServerInstance);
extern void snsShow (const char * name);
extern STATUS dsalMonitor (const unsigned int dsalSnsServerType,
const unsigned int dsalSnsServerInstance);
#ifdef __cplusplus
}
#endif
#endif /* __INCsnsLibh */
+280
View File
@@ -0,0 +1,280 @@
/* dsi/socketvar.h - internal socket structures and definitions for DSI */
/*
* Copyright (c) 2007 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
* Copyright (c) 1982, 1986, 1990, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)socketvar.h 8.3 (Berkeley) 2/19/95
* $FreeBSD: src/sys/sys/socketvar.h,v 1.46.2.9 2002/08/14 22:23:10 dg Exp $
*/
/*
modification history
--------------------
01a,22jun07,ebh Created from net/socketvar.h (02g,27dec06,wap) for DSI changes
*/
#ifndef _DSI_SOCKETVAR_H_
#define _DSI_SOCKETVAR_H_
#include <net/protosw.h>
#include <sys/queue.h>
#include <semLib.h>
#include <selectLib.h>
#include <sockFunc.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Kernel structure per socket.
* Contains send and receive buffer queues,
* handle on protocol and pointer to protocol
* private data and error information.
*/
typedef u_quad_t so_gen_t;
/*
* WRS-port
* - if 0'd so_zone, and the accept filter members
*/
#ifdef _WRS_KERNEL
struct socket {
struct sockFunc *pSockFuncTbl; /* socket backend function table */
short so_type; /* generic type, see socket.h */
short so_options; /* from socket call, see socket.h */
u_short so_linger; /* time to linger while closing */
short so_state; /* internal state flags SS_*, below */
caddr_t so_pcb; /* protocol control block */
struct protosw *so_proto; /* protocol handle */
/*
* Variables for connection queuing.
* Socket where accepts occur is so_head in all subsidiary sockets.
* If so_head is 0, socket is not related to an accept.
* For head socket so_incomp queues partially completed connections,
* while so_comp is a queue of connections ready to be accepted.
* If a connection is aborted and it has so_head set, then
* it has to be pulled out of either so_incomp or so_comp.
* We allow connections to queue up based on current queue lengths
* and limit on number of queued connections for this socket.
*/
struct socket *so_head; /* back pointer to accept socket */
TAILQ_HEAD(, socket) so_incomp; /* queue of partial unaccepted connections */
TAILQ_HEAD(, socket) so_comp; /* queue of complete unaccepted connections */
TAILQ_ENTRY(socket) so_list; /* list of unaccepted connections */
short so_qlen; /* number of unaccepted connections */
short so_incqlen; /* number of unaccepted incomplete
connections */
short so_qlimit; /* max number queued connections */
short so_timeo; /* connection timeout */
u_short so_error; /* error affecting connection */
u_long so_oobmark; /* chars to oob mark */
short so_pgrp; /* WRS extension for ASYNC oper */
int so_fd; /* WRS extension for storing FD */
SEL_WAKEUP_LIST so_selWakeupList; /* WRS extension for select */
/*
* Variables for socket buffering.
*/
struct sockbuf {
u_long sb_cc; /* actual chars in buffer */
u_long sb_hiwat; /* max actual char count */
u_long sb_mbcnt; /* chars of mbufs used */
u_long sb_mbmax; /* max chars of mbufs to use */
long sb_lowat; /* low water mark */
struct mbuf *sb_mb; /* the mbuf chain */
short sb_flags; /* flags, see below */
short sb_timeo; /* timeout for read/write */
u_long sb_selCount;
SEMAPHORE sb_Sem; /* WRS extension for sb semaphore */
int sb_refCount; /* WRS extension for users of sem */
/* struct socket * sb_so; ptr to socket if closing, or NULL */
} so_rcv, so_snd;
#define SB_MAX (256*1024) /* default for max chars in sockbuf */
#define SB_LOCK 0x01 /* lock on data queue */
#define SB_WANT 0x02 /* someone is waiting to lock */
#define SB_WAIT 0x04 /* someone is waiting for data/space */
#define SB_SEL 0x08 /* someone is selecting */
#define SB_ASYNC 0x10 /* ASYNC I/O, need signals */
#define SB_UPCALL 0x20 /* someone wants an upcall */
#define SB_NOINTR 0x40 /* operations not interruptible */
#define SB_AIO 0x80 /* AIO operations queued */
#define SB_KNOTE 0x100 /* kernel note attached */
void (*so_upcall) __P((struct socket *, void *, int));
void *so_upcallarg;
/* NB: generation count must not be first; easiest to make it last. */
so_gen_t _so_gencnt; /* generation count */
void *so_emuldata; /* private data for emulators */
int connTimeo; /* connection establishment timeout */
void *so_bkendaux; /* socket backend auxiliary data */
};
#endif /* _WRS_KERNEL */
/*
* Socket state bits.
*/
#define SS_NOFDREF 0x0001 /* no file table ref any more */
#define SS_ISCONNECTED 0x0002 /* socket connected to a peer */
#define SS_ISCONNECTING 0x0004 /* in process of connecting to peer */
#define SS_ISDISCONNECTING 0x0008 /* in process of disconnecting */
#define SS_CANTSENDMORE 0x0010 /* can't send more data to peer */
#define SS_CANTRCVMORE 0x0020 /* can't receive more data from peer */
#define SS_RCVATMARK 0x0040 /* at mark on input */
#define SS_PRIV 0x0080 /* privileged for broadcast, raw... */
#define SS_NBIO 0x0100 /* non-blocking ops */
#define SS_ASYNC 0x0200 /* async i/o notify */
#define SS_ISCONFIRMING 0x0400 /* deciding to accept connection req */
#define SS_INCOMP 0x0800 /* unaccepted, incomplete connection */
#define SS_COMP 0x1000 /* unaccepted, complete connection */
#define SS_ISDISCONNECTED 0x2000 /* socket disconnected from peer */
/*
* Macros for sockets and socket buffering.
*/
/*
* Do we need to notify the other side when I/O is possible?
*/
#define sb_notify(sb) (((sb)->sb_flags & (SB_WAIT | SB_SEL | SB_ASYNC | \
SB_UPCALL | SB_AIO | SB_KNOTE)) != 0)
/*
* How much space is there in a socket buffer (so->so_snd or so->so_rcv)?
* This is problematical if the fields are unsigned, as the space might
* still be negative (cc > hiwat or mbcnt > mbmax). Should detect
* overflow and return 0. Should use "lmin" but it doesn't exist now.
*/
#define sbspace(sb) \
((long) imin((int)((sb)->sb_hiwat - (sb)->sb_cc), \
(int)((sb)->sb_mbmax - (sb)->sb_mbcnt)))
/* do we have to send all at once on a socket? */
#define sosendallatonce(so) \
((so)->so_proto->pr_flags & PR_ATOMIC)
/* can we read something from so? */
#define soreadable(so) \
((so)->so_rcv.sb_cc >= (so)->so_rcv.sb_lowat || \
((so)->so_state & SS_CANTRCVMORE) || \
(so)->so_comp.tqh_first || (so)->so_error)
/* can we write something to so? */
#define sowriteable(so) \
((sbspace(&(so)->so_snd) >= (so)->so_snd.sb_lowat && \
(((so)->so_state&SS_ISCONNECTED) || \
((so)->so_proto->pr_flags&PR_CONNREQUIRED)==0)) || \
((so)->so_state & SS_CANTSENDMORE) || \
(so)->so_error)
/* adjust counters in sb reflecting freeing of m */
#define sbfree(sb, m) { \
(sb)->sb_cc -= (m)->m_len; \
(sb)->sb_mbcnt -= MSIZE; \
if ((m)->m_flags & M_EXT) \
(sb)->sb_mbcnt -= (m)->m_extSize; \
}
/* return total number of pended users of this socket */
#define sbusercount(so) \
((int)((so)->so_rcv.sb_refCount + (so)->so_snd.sb_refCount))
#ifdef _WRS_KERNEL
/*
* Macro to add the socket-based VLAN to the m_pkthdr. This is in the
* _WRS_KERNEL section because it will never be used by user code.
*/
#ifdef SOCKET_VLAN
/*
* Keep the vlan in the m_pkthdr in host byte order until it needs to be
* put into the packet (by the MUX-L2 egress code).
*/
#define SO_VLAN_ADD(m, so) \
if ((so)->so_options & SO_VLAN) \
{ \
(m)->m_pkthdr.vlan = (so)->so_vlan; \
(m)->m_pkthdr.csum_flags |= (so)->so_vlan_options; \
}
#endif /* SOCKET_VLAN */
/*
* Argument structure for sosetopt et seq. This is in the _WRS_KERNEL
* section because it will never be visible to user code.
*/
enum sopt_dir { SOPT_GET, SOPT_SET };
struct sockopt {
enum sopt_dir sopt_dir; /* is this a get or a set? */
int sopt_level; /* second arg of [gs]etsockopt */
int sopt_name; /* third arg of [gs]etsockopt */
void *sopt_val; /* fourth arg of [gs]etsockopt */
size_t sopt_valsize; /* (almost) fifth arg of [gs]etsockopt */
struct proc *sopt_p; /* calling process or null if kernel */
};
struct sf_buf {
SLIST_ENTRY(sf_buf) free_list; /* list of free buffer slots */
int refcnt; /* reference count */
};
extern STATUS unixIoctlMemValidate (unsigned int cmd, const void * pData);
#endif /* _WRS_KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* !_DSI_SOCKETVAR_H_ */
+29
View File
@@ -0,0 +1,29 @@
/* unCompLib.h - AF_LOCAL/COMP protocol initialization header file */
/* Copyright 2003-2005 Wind River Systems, Inc. */
/*
modification history
--------------------
01c,04jan05,bwa removed 'Inst' part of init routine names (SPR#103232).
01b,26nov03,bwa moved errno definitions to netinet/unLib.h
01a,05nov03,bwa written
*/
#ifndef __INCunCompLibh
#define __INCunCompLibh
#ifdef __cplusplus
extern "C" {
#endif
/* function prototypes */
STATUS unCompInit (void * pInitValues);
#ifdef __cplusplus
}
#endif
#endif /* __INCunCompLibh */
+40
View File
@@ -0,0 +1,40 @@
/* unLib.h - AF_LOCAL domain initialization header file */
/* Copyright 2003-2005, 2010 Wind River Systems, Inc. */
/*
modification history
--------------------
01e,29apr10,pad Moved extern C statement after include statements.
01d,04jan05,bwa removed 'Inst' part of init routine names (SPR#103232).
01c,24feb04,bwa added PROTOCOL_SWITCH_FULL definition
01b,26nov03,bwa moved protos/unCompLib.h errno definitions here
01a,10oct03,bwa written
*/
#ifndef __INCunLibh
#define __INCunLibh
#include <vwModNum.h>
#ifdef __cplusplus
extern "C" {
#endif
/* errnos */
#define S_unLib_ALREADY_INITIALIZED (M_unLib | 0x0001)
#define S_unLib_COMP_ALREADY_INITIALIZED (M_unLib | 0x0002)
#define S_unLib_PROTOCOL_SWITCH_FULL (M_unLib | 0x0003)
/* function prototypes */
STATUS unInit (void * pInitValues);
#ifdef __cplusplus
}
#endif
#endif /* __INCunLibh */
+29
View File
@@ -0,0 +1,29 @@
/* unShow.h - header file for AF_LOCAL show routine functionalities */
/* Copyright 2004 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,26jan04,bwa written
*/
#ifndef __INCunShowh
#define __INCunShowh
#ifdef __cplusplus
extern "C" {
#endif
/* function declarations */
extern void unShowInit (void);
extern void uncompShowInit (void);
extern void unstatShow (void);
#ifdef __cplusplus
}
#endif
#endif /* __INCunShowh */
+27
View File
@@ -0,0 +1,27 @@
/* uncomp.h - AF_LOCAL/COMP protocol header file */
/* Copyright 2003 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,05nov03,bwa written
*/
#ifndef __INCuncomph
#define __INCuncomph
#ifdef __cplusplus
extern "C" {
#endif
/* function prototypes */
void uncomp_init (void);
#ifdef __cplusplus
}
#endif
#endif /* __INCuncomph */
+36
View File
@@ -0,0 +1,36 @@
/* uncomp_fsm.h - AF_LOCAL/COMP protocol: Finite state machine */
/* Copyright 2003 Wind River Systems, Inc. */
/*
modification history
--------------------
01a,30sep03,bwa written.
*/
#ifndef __INCuncomp_fsmh
#define __INCuncomp_fsmh
#ifdef __cplusplus
extern "C" {
#endif
/* COMP state machine state definitions */
#define UNCOMPS_NSTATES 6 /* number of defined states */
/* STATE VALUE [ WHO? ] HOW & WHEN */
/* ------------------------------------------------------------------------- */
#define UNCOMPS_CLOSED 0 /* [ both ] before connect()/after close() */
#define UNCOMPS_REQUEST 1 /* [ client ] connect() issued before accept()*/
#define UNCOMPS_LISTENING 2 /* [ server ] listen() issued */
#define UNCOMPS_EXCHANGING 3 /* [ both ] connect() accepted by accept() */
#define UNCOMPS_DONE_SEND 4 /* [ both ] shutdown (write) issued by self */
#define UNCOMPS_DONE_RECV 5 /* [ both ] shutdown (write) issued by peer */
#ifdef __cplusplus
}
#endif
#endif /* __INCuncomp_fsmh */
+62
View File
@@ -0,0 +1,62 @@
/* uncomp_var.h - AF_LOCAL/COMP protocol control block definition */
/*
* Copyright (c) 2003-2004, 2007, 2010 Wind River Systems, Inc.
*
* The right to copy, distribute, modify or otherwise make use
* of this software may be licensed only pursuant to the terms
* of an applicable Wind River license agreement.
*/
/*
modification history
--------------------
01d,29apr10,pad Moved extern C statement after include statements.
01c,22jun07,ebh change reference to dsi/socketvar.h from net/socketvar.h
01b,12apr04,bwa moved DS_xxx macros to h/dsiSockLib.h.
01b,20jan04,bwa added pRegQTail field; renamed pExpQ field to pExpQTail;
added pRecvPacket field;
removed selfGenCnt and xxxMaxData fields;
removed _ASM_LANGUAGE references.
01a,30sep03,bwa written.
*/
#ifndef __INCuncomp_varh
#define __INCuncomp_varh
#include <vxWorks.h>
#include <dllLib.h>
#ifdef __cplusplus
extern "C" {
#endif
struct socket;
/* data structures */
typedef struct uncompcb /* AF_LOCAL/COMP protocol control block */
{ /* ------------------------------------- */
DL_NODE node; /* 0x00: entry in the uncomp socket list */
struct socket * pSelfSocket; /* 0x08: back pointer to socket */
struct socket * pPeerSocket; /* 0x0c: connected socket */
uint16_t selfState; /* 0x10: state of socket */
uint16_t selfName; /* 0x12: name of socket (/comp/socket/X) */
struct mbuf * pLastReg; /* 0x14: ptr to last regular message */
struct mbuf * pLastExp; /* 0x18: ptr to last express message */
struct mbuf * pRecvPacket; /* 0x1c: ptr to packet being received */
uint16_t hiwatermark; /* 0x1e: largest amount of data queued */
uint16_t dropped; /* 0x20: amount of packets dropped */
} UNCOMPCB; /* 0x24: TOTAL SIZE */
/* useful macros */
#define SO_TO_UNCOMPCB(so) ((struct uncompcb *)(so->so_pcb))
#define UNCOMPCB_TO_SO(cb) ((struct socket *)(cb->pSelfSocket))
#ifdef __cplusplus
}
#endif
#endif /* __INCuncomp_varh */