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,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 */