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,69 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipappl.h,v $ $Revision: 1.6 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipappl.h,v $
* $Author: ulf $ $Date: 2007-10-13 07:04:51 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Joel Hortelius <joel.hortelius@interpeak.se>
******************************************************************************
*/
#ifndef IPAPPL_H
#define IPAPPL_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
#define IPAPPL_RELEASE 60600
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,466 @@
/* ipdhcpc.h - API of DHCP client */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdhcpc.h,v $ $Revision: 1.29.16.3 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipdhcpc.h,v $
* $Author: jwang9 $ $Date: 2016-05-20 07:17:44 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Lennart Bang <lob@interpeak.se>
* and Jonas Rendel <jonas@interpeak.se>
******************************************************************************
*/
#ifndef IPDHCPC_H
#define IPDHCPC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
This library contains the API for the DHCP client
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include <ipcom_cstyle.h>
#include <ipcom_tmo.h>
#include <ipcom_tags.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* DHCP option codes
*===========================================================================
* Option codes automatically handled by IPDHCP.
*/
/*
*===========================================================================
* DHCP option codes - auto
*===========================================================================
* Option codes handled transparantly by IPDHCPC, i.e. user code does not
* need to add/remove/modify these options.
*/
#define IPDHCPC_OPTCODE_DHCP_MESSAGE_TYPE 53
#define IPDHCPC_OPTCODE_DHCP_SERVER_IDENTIFIER 54
#define IPDHCPC_OPTCODE_DHCP_MAX_MESSAGE_SIZE 57
#define IPDHCPC_OPTCODE_DHCP_CLIENT_IDENTIFIER 61
#define IPDHCPC_OPTCODE_END 255
/*
*===========================================================================
* DHCP option codes - used
*===========================================================================
* Option codes used by IPDHCPC in some way or another.
*/
#define IPDHCPC_OPTCODE_PAD 0
#define IPDHCPC_OPTCODE_SUBNET_MASK 1
#define IPDHCPC_OPTCODE_ROUTERS 3
#define IPDHCPC_OPTCODE_DOMAIN_NAME_SERVERS 6
#define IPDHCPC_OPTCODE_DOMAIN_NAME 15
#define IPDHCPC_OPTCODE_DHCP_LEASE_TIME 51
#define IPDHCPC_OPTCODE_OPTION_OVERLOAD 52
#define IPDHCPC_OPTCODE_DHCP_PARAMETER_REQUEST_LIST 55
#define IPDHCPC_OPTCODE_DHCP_MESSAGE 56
#define IPDHCPC_OPTCODE_DHCP_RENEWAL_TIME 58
#define IPDHCPC_OPTCODE_DHCP_REBINDING_TIME 59
/*
*===========================================================================
* DHCP option codes - user
*===========================================================================
* Option codes not read or written by IPDHCPC.
*/
#define IPDHCPC_OPTCODE_TIME_OFFSET 2
#define IPDHCPC_OPTCODE_TIME_SERVERS 4
#define IPDHCPC_OPTCODE_NAME_SERVERS 5
#define IPDHCPC_OPTCODE_LOG_SERVERS 7
#define IPDHCPC_OPTCODE_COOKIE_SERVERS 8
#define IPDHCPC_OPTCODE_LPR_SERVERS 9
#define IPDHCPC_OPTCODE_IMPRESS_SERVERS 10
#define IPDHCPC_OPTCODE_RESOURCE_LOCATION_SERVERS 11
#define IPDHCPC_OPTCODE_HOST_NAME 12
#define IPDHCPC_OPTCODE_BOOT_SIZE 13
#define IPDHCPC_OPTCODE_MERIT_DUMP 14
#define IPDHCPC_OPTCODE_SWAP_SERVER 16
#define IPDHCPC_OPTCODE_ROOT_PATH 17
#define IPDHCPC_OPTCODE_EXTENSIONS_PATH 18
#define IPDHCPC_OPTCODE_IP_FORWARDING 19
#define IPDHCPC_OPTCODE_NON_LOCAL_SOURCE_ROUTING 20
#define IPDHCPC_OPTCODE_POLICY_FILTER 21
#define IPDHCPC_OPTCODE_MAX_DGRAM_REASSEMBLY 22
#define IPDHCPC_OPTCODE_DEFAULT_IP_TTL 23
#define IPDHCPC_OPTCODE_PATH_MTU_AGING_TIMEOUT 24
#define IPDHCPC_OPTCODE_PATH_MTU_PLATEAU_TABLE 25
#define IPDHCPC_OPTCODE_INTERFACE_MTU 26
#define IPDHCPC_OPTCODE_ALL_SUBNETS_LOCAL 27
#define IPDHCPC_OPTCODE_BROADCAST_ADDRESS 28
#define IPDHCPC_OPTCODE_PERFORM_MASK_DISCOVERY 29
#define IPDHCPC_OPTCODE_MASK_SUPPLIER 30
#define IPDHCPC_OPTCODE_ROUTER_DISCOVERY 31
#define IPDHCPC_OPTCODE_ROUTER_SOLICITATION_ADDRESS 32
#define IPDHCPC_OPTCODE_STATIC_ROUTES 33
#define IPDHCPC_OPTCODE_TRAILER_ENCAPSULATION 34
#define IPDHCPC_OPTCODE_ARP_CACHE_TIMEOUT 35
#define IPDHCPC_OPTCODE_IEEE802_3_ENCAPSULATION 36
#define IPDHCPC_OPTCODE_DEFAULT_TCP_TTL 37
#define IPDHCPC_OPTCODE_TCP_KEEPALIVE_INTERVAL 38
#define IPDHCPC_OPTCODE_TCP_KEEPALIVE_GARBAGE 39
#define IPDHCPC_OPTCODE_NIS_DOMAIN 40
#define IPDHCPC_OPTCODE_NIS_SERVERS 41
#define IPDHCPC_OPTCODE_NTP_SERVERS 42
#define IPDHCPC_OPTCODE_VENDOR_ENCAPSULATED_OPTIONS 43
#define IPDHCPC_OPTCODE_NETBIOS_NAME_SERVERS 44
#define IPDHCPC_OPTCODE_NETBIOS_DD_SERVER 45
#define IPDHCPC_OPTCODE_NETBIOS_NODE_TYPE 46
#define IPDHCPC_OPTCODE_NETBIOS_SCOPE 47
#define IPDHCPC_OPTCODE_FONT_SERVERS 48
#define IPDHCPC_OPTCODE_X_DISPLAY_MANAGER 49
#define IPDHCPC_OPTCODE_DHCP_REQUESTED_ADDRESS 50
#define IPDHCPC_OPTCODE_VENDOR_CLASS_IDENTIFIER 60
#define IPDHCPC_OPTCODE_TFTP_SERVER_NAME 66
#define IPDHCPC_OPTCODE_BOOTFILE_NAME 67
#define IPDHCPC_OPTCODE_VI_VENDOR_CLASS 124
#define IPDHCPC_OPTCODE_VI_VENDOR_INFORMATION 125
#define IPDHCPC_OPTCODE_TFTP_SERVER_ADDRESS 0 /* Fake option code */
/*
*===========================================================================
* DHCP magic cookie
*===========================================================================
* See RFC 2132.
*/
#define IPDHCPC_MAGIC_COOKIE 0x63825363
/*
*===========================================================================
* DHCP reply callback event codes
*===========================================================================
* Possible events to be sent and handled by a DHCP client reply callback.
*/
#define IPDHCPC_REPLY_CB_EVENT_ACK 1 /* Received an ACK */
#define IPDHCPC_REPLY_CB_EVENT_NAK 2 /* Received a NAK */
#define IPDHCPC_REPLY_CB_EVENT_EXPIRE 3 /* Lease expiration */
#define IPDHCPC_REPLY_CB_EVENT_FAIL_IFLOST 4 /* Lost the interface */
#define IPDHCPC_REPLY_CB_EVENT_BOOTREPLY 5 /* Received a boot reply */
#define IPDHCPC_REPLY_CB_EVENT_OFFER 6 /* Received an offer */
#define IPDHCPC_REPLY_CB_EVENT_FAIL_RETRY 7 /* Retries expired */
/*
*===========================================================================
* DHCP reply callback return codes
*===========================================================================
* Possible return values to be returned by a DHCP client reply callback.
*/
#define IPDHCPC_REPLY_CB_ERROR -1
#define IPDHCPC_REPLY_CB_SUCCESS 0
/*
*===========================================================================
* RFC2131 3.6 Use of DHCP in clients with multiple interfaces
*===========================================================================
* A client with multiple network interfaces must use DHCP through each
interface independently to obtain configuration information
parameters for those separate interfaces.
*/
#define IPDHCPC_OPTION_DOMAIN_CONF 1
#define IPDHCPC_OPTION_DNSSERVER_CONF 2
#define IPDHCPC_OPTION_NTPSERVER_CONF 4
#define IPDHCPC_SNAME_LEN (64)
#define IPDHCPC_BOOTFILE_NAME_LEN (128)
/* Reply callback for DHCP replies. */
struct Ipdhcpc_handle_priv_struct;
struct Ipdhcpc_handle_struct;
typedef int (*Ipdhcpc_reply_cb)(struct Ipdhcpc_handle_struct *handle, int event);
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
*===========================================================================
* Ipdhcpc_info
*===========================================================================
* This structure is filled in by the IPDHCPC code upon valid DHCP client
* request reply.
*/
typedef struct Ipdhcpc_info_struct
{
Ip_err status; /* IPCOM_SUCCESS else IPCOM_ERR_XXX. */
Ip_u32 ipaddr_n; /* Client IP address (yiaddr). */
Ip_u32 serveraddr_n; /* Server IP in network endian. Default = 0 -> broadcast */
Ip_u16 serverport_n; /* Server UDP port in network endian. Default = ip_htons(67). */
Ip_u16 reserved;
int optlen; /* Options length excluding cookie. */
Ip_u8 *options; /* DHCP options */
Ip_u8 sname[IPDHCPC_SNAME_LEN]; /* Optional server host name, null terminated string. */
Ip_u32 bootaddr_n; /* IP address of next bootstrap server (siaddr). */
Ip_u8 file[IPDHCPC_BOOTFILE_NAME_LEN]; /* Optional boot file name, null terminated string. */
Ip_time_t t1; /* Time at which we enter RENEWING state */
Ip_time_t t2; /* Time at which we enter REBINDING state */
}
Ipdhcpc_info;
/*
*===========================================================================
* Ipdhcpc_handle
*===========================================================================
* Created and initialized by ipdhcpc_handle_malloc() to prepare for a
* DHCP client request. User may modify the handle before calling
* ipdhcpc_ifrequest().
*
*/
typedef struct Ipdhcpc_handle_struct
{
Ip_u32 user_res[2]; /* Reserved for user use. IPDHCPC does not touch it. */
Ip_u32 ifindex; /* DHCP interface index. Set by ipdhcpc_handle_malloc(). */
Ip_u32 clientaddr_n; /* Desired IP in network endian else 0. */
Ip_u32 serveraddr_n; /* Server IP in network endian. Default = 0 -> broadcast */
Ip_u16 serverport_n; /* Server UDP port in network endian. Default = ip_htons(67). */
Ip_u16 reserved;
Ip_u32 magic_cookie; /* Magic vendor cookie. Default=0x63825363. */
char file[IPDHCPC_BOOTFILE_NAME_LEN]; /* Optional boot file name, null terminated string. */
char sname[IPDHCPC_SNAME_LEN]; /* Optional server host name, null terminated string. */
/* User callback for the reply. Set to IP_NULL for blocking mode. */
Ipdhcpc_reply_cb reply_cb;
int optlen; /* User options length. */
Ip_u8 *options; /* Additional user options. */
Ip_u32 option_confvar;/* interface set sysvar of dnsserver ,doname, or ntpserver */
/***** IPDHCPC info for the user after succesful DHCP server reply. */
Ipdhcpc_info info;
/***** IPDHCPC private info. do not read/write *****/
struct Ipdhcpc_handle_priv_struct *priv;
}
Ipdhcpc_handle;
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipdhcpc_option_callback - apply user-defined actions based on DHCP option
*
* This callback routine examines each DHCP option returned by a DHCP server and
* can execute user-defined operations for specific options. For example, it can
* be implemented to apply a different operation to each of three vendor-specific
* options received from the server.
*
* The callback is executed before any other client action on the server\'s
* response and can be used to change the contents of the response before it is
* acted on further. For a sample implementation, see 'ipdhcpc_example.c'.
*
* Parameter:
* \is
* \i <option>
* A pointer to the starting location of an option, where:
*
* \ml
* \m -
* <option>[0] is a DHCP option code.
* \m -
* <option>[1] is the length of the option, in bytes, from the start of the
* option to the end of its data portion.
* \m -
* <option>[2] is the first element containing data for the option.
* \me
* \i <handle>
* A pointer to the request handle passed in ipdhcpc_ifrequest.
* \ie
*
* RETURNS: Either 'IP_TRUE', in which case the DHCP client can take further
* action on the option, or 'IP_FALSE', in which case the client takes no further
* action based on the option.
*
* ERRNO:
*/
IP_PUBLIC Ip_err ipdhcpc_option_callback
(
Ipdhcpc_handle *handle,
Ip_u8 *option
);
/*******************************************************************************
*
* ipdhcpc_reply_callback - apply user-defined actions based on DHCP reply
*
* This callback routine examines each DHCP reply returned by a DHCP server and
* can execute user-defined operations for specific replies. For example, it can
* be implemented to apply a different operation to NAK's, ACK's, Lease
* expiration, etc.
*
* The callback is executed before any other client action on the server\'s
* response and can be used to change the contents of the response before it is
* acted on further. For a sample implementation, see 'ipdhcpc_example.c'.
*
* Parameter:
* \is
* \i <handle>
* A pointer to the ipdhcpc handle
* \ie
* \is
* \i <event>
* The reply type
* \ie
* RETURNS: Either 'IP_TRUE', in which case the DHCP client can take further
* action on the option, or 'IP_FALSE', in which case the client takes no further
* action based on the option.
*
* ERRNO:
*/
IP_PUBLIC Ip_err ipdhcpc_reply_callback
(
Ipdhcpc_handle *handle,
int event
);
/*******************************************************************************
*
* ipdhcpc_renew_get - allow user to send RENEW message before Lease expiration
*
* This routine gives a way of sending RENEW message before Lease expiration,
* it is convenient for someone who can't wait, but wants to renew the lease
* immediately.
*
* Parameter:
* \is
* \i <ifname>
* A pointer to an interface
* \ie
* RETURNS: Either 'IPCOM_SUCCESS', in which case the DHCP client can send the
* RENEW message, or 'IPCOM_ERR_XX', in which case the client fails to send, here
* 'IPCOM_ERR_XX' can be IPCOM_ERR_INVALID_ARG, IPCOM_ERR_INVALID_INTERFACE, etc.
*
* ERRNO:
*/
IP_PUBLIC Ip_err ipdhcpc_renew_get
(
char *ifname
);
/*******************************************************************************
*
* ipdhcpc_inform_get - allow user to send INFORM message to server
*
* This routine gives a way of sending INFORM message, Sometime client already
* has an address through other method, just wants to get several parameters
* from server, that's what this routine is all about.
*
*
* Parameter:
* \is
* \i <ifname>
* A pointer to an interface.
* \ie
* \is
* \i <addr>
* A pointer to an address of the interface.
* \ie
* RETURNS: Either 'IPCOM_SUCCESS', in which case the DHCP client can send the
* RENEW message, or 'IPCOM_ERR_XX', in which case the client fails to send, here
* 'IPCOM_ERR_XX' can be IPCOM_ERR_INVALID_ARG, IPCOM_ERR_INVALID_INTERFACE, etc.
*
* ERRNO:
*/
IP_PUBLIC Ip_err ipdhcpc_inform_get
(
char *ifname,
char *addr
);
/*
*===========================================================================
* ipdhcpc_reply_cb
*===========================================================================
* Description:
* Parameters:
* Returns:
*
*/
IP_GLOBAL int ipdhcpc_reply_cb
(
Ipdhcpc_handle *handle,
int event
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,524 @@
/* ipdnsc.h - Public API of Wind River DNS client */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipdnsc.h,v $ $Revision: 1.16.10.1 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipdnsc.h,v $
* $Author: ulf $ $Date: 2011-11-16 10:33:22 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
******************************************************************************
*/
#ifndef IPDNSC_H
#define IPDNSC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
DESCRIPTION
This library contains the APIs provided by the WindRiver DNS client.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#define IPCOM_USE_CLIB_PROTO
#include <ipcom_type.h>
#include <ipcom_cstyle.h>
#include <ipcom_clib.h>
#include <ipcom_sock.h>
#include <ipcom_tags.h>
#include <ipcom_os.h>
#include <ipcom_err.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* release
*===========================================================================
*/
#define IPDNSC_RELEASE 60500
/* Error codes for lookup functions */
#define IPDNSC_HOST_NOT_FOUND 1
#define IPDNSC_TRY_AGAIN 2
#define IPDNSC_NO_RECOVERY 3
#define IPDNSC_NO_DATA 4
#define IPDNSC_NO_ADDRESS IPDNSC_NO_DATA
/* Error codes returned by DNS update API */
#define IPDNSC_UPDATE_OK 0 /* success */
#define IPDNSC_UPDATE_ERR_GENERAL -1 /* An unexpected general error */
#define IPDNSC_UPDATE_ERR_INVALID -2 /* Invalid argument */
#define IPDNSC_UPDATE_ERR_MSGSIZE -3 /* An invalid message length */
#define IPDNSC_UPDATE_ERR_EPROTOTYPE -4 /* The answer to a query had the wrong domain name */
#define IPDNSC_UPDATE_ERR_NOTSUPPORT_TYPE -5 /* Update type is not supported */
#define IPDNSC_UPDATE_ERR_NOTSUPPORT_ALG -6 /* Not supported Algorithm */
#define IPDNSC_UPDATE_ERR_MD5_DISABLED -7 /* MD5 lib is disabled */
#define IPDNSC_UPDATE_ERR_NO_TSIG -8 /* No TSIG */
#define IPDNSC_UPDATE_ERR_TSIG_NO_SPACE -9 /* No enough space fro TSIG */
#define IPDNSC_UPDATE_ERR_TSIG_BADFORMAT -10 /* Bad TSIG format */
#define IPDNSC_UPDATE_ERR_TSIG_BADKEY -11 /* Bad TSIG KEY */
#define IPDNSC_UPDATE_ERR_TSIG_SERVER_BADKEY -12 /* Reply key from the server is bad */
#define IPDNSC_UPDATE_ERR_TSIG_SERVER_BADTIME -13 /* Reply time from the server is bad */
#define IPDNSC_UPDATE_ERR_YXRRSET -14
/* used by dynamic dns RFC2136 */
#define IPDNSC_MAXDNAME 1025 /* maximum domain name */
#define IPDNSC_MAXCDNAME 255 /* maximum compressed domain name */
#define IPDNSC_MAX_ALG_NAME 128 /* maximum Algorithm name */
/* DNS TSIG Algorithm */
#define IPDNSC_TSIG_ALG_HMAC_MD5 "HMAC-MD5.SIG-ALG.REG.INT"
/* Flags for lookup functions */
#define IPDNSC_AI_V4MAPPED 0x00000008
#define IPDNSC_AI_ALL 0x00000010
#define IPDNSC_AI_ADDRCONFIG 0x00000020
#define IPDNSC_AI_DEFAULT (IPDNSC_AI_V4MAPPED | IPDNSC_AI_ADDRCONFIG)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/* defined section field */
typedef enum Ipdnsc_section_enum {
IPDNSC_SECTION_QD = 0, /* Query: Question. */
IPDNSC_SECTION_ZN = 0, /* Update: Zone. */
IPDNSC_SECTION_AN = 1, /* Query: Answer. */
IPDNSC_SECTION_PR = 1, /* Update: Prerequisites. */
IPDNSC_SECTION_NS = 2, /* Query: Name servers. */
IPDNSC_SECTION_UP = 2, /* Update: Update. */
IPDNSC_SECTION_AR = 3, /* Query|Update: Additional records. */
IPDNSC_SECTION_MAX = 4
}
Ipdnsc_section;
/* Query class codes */
typedef enum Ipdnsc_qclass_enum {
IPDNSC_QCLASS_INVALID = 0, /* Cookie. */
IPDNSC_QCLASS_INET = 1, /* Internet. */
/* Query class values which do not appear in resource records */
IPDNSC_QCLASS_NONE = 254, /* for prereq. sections in update requests */
IPDNSC_QCLASS_ANY = 255, /* Wildcard match. */
IPDNSC_QCLASS_MAX = 65536
}
Ipdnsc_qclass;
/* Query type codes for resources and queries. */
typedef enum Ipdnsc_qtype_enum {
IPDNSC_QTYPE_INVALID = 0, /* Cookie. */
IPDNSC_QTYPE_A = 1, /* Host address. */
IPDNSC_QTYPE_NS = 2, /* Authoritative server. */
IPDNSC_QTYPE_MD = 3, /* Mail destination. */
IPDNSC_QTYPE_MF = 4, /* Mail forwarder. */
IPDNSC_QTYPE_CNAME = 5, /* Canonical name. */
IPDNSC_QTYPE_SOA = 6, /* Start of authority zone. */
IPDNSC_QTYPE_MB = 7, /* Mailbox domain name. */
IPDNSC_QTYPE_MG = 8, /* Mail group member. */
IPDNSC_QTYPE_MR = 9, /* Mail rename name. */
IPDNSC_QTYPE_NULL = 10, /* Null resource record. */
IPDNSC_QTYPE_WKS = 11, /* Well known service. */
IPDNSC_QTYPE_PTR = 12, /* Domain name pointer. */
IPDNSC_QTYPE_HINFO = 13, /* Host information. */
IPDNSC_QTYPE_MINFO = 14, /* Mailbox information. */
IPDNSC_QTYPE_MX = 15, /* Mail routing information. */
IPDNSC_QTYPE_TXT = 16, /* Text strings. */
IPDNSC_QTYPE_RP = 17, /* Responsible person. */
IPDNSC_QTYPE_AFSDB = 18, /* AFS cell database. */
IPDNSC_QTYPE_X25 = 19, /* X_25 calling address. */
IPDNSC_QTYPE_ISDN = 20, /* ISDN calling address. */
IPDNSC_QTYPE_RT = 21, /* Router. */
IPDNSC_QTYPE_NSAP = 22, /* NSAP address. */
IPDNSC_QTYPE_NSAP_PTR = 23, /* Reverse NSAP lookup (deprecated). */
IPDNSC_QTYPE_SIG = 24, /* Security signature. */
IPDNSC_QTYPE_KEY = 25, /* Security key. */
IPDNSC_QTYPE_PX = 26, /* X.400 mail mapping. */
IPDNSC_QTYPE_GPOS = 27, /* Geographical position (withdrawn). */
IPDNSC_QTYPE_AAAA = 28, /* Ip6 Address. */
IPDNSC_QTYPE_LOC = 29, /* Location Information. */
IPDNSC_QTYPE_NXT = 30, /* Next domain (security). */
IPDNSC_QTYPE_EID = 31, /* Endpoint identifier. */
IPDNSC_QTYPE_NIMLOC = 32, /* Nimrod Locator. */
IPDNSC_QTYPE_SRV = 33, /* Server Selection. */
IPDNSC_QTYPE_ATMA = 34, /* ATM Address */
IPDNSC_QTYPE_NAPTR = 35, /* Naming Authority PoinTeR */
IPDNSC_QTYPE_KX = 36, /* Key Exchange */
IPDNSC_QTYPE_CERT = 37, /* Certification record */
IPDNSC_QTYPE_A6 = 38, /* IPv6 address (deprecates AAAA) */
IPDNSC_QTYPE_DNAME = 39, /* Non-terminal DNAME (for IPv6) */
IPDNSC_QTYPE_SLINK = 40, /* Kitchen sink (experimentatl) */
IPDNSC_QTYPE_OPT = 41, /* EDNS0 option (meta-RR) */
IPDNSC_QTYPE_APL = 42, /* Address prefix list (RFC3123) */
IPDNSC_QTYPE_TKEY = 249, /* Transaction key */
IPDNSC_QTYPE_TSIG = 250, /* Transaction signature. */
IPDNSC_QTYPE_IXFR = 251, /* Incremental zone transfer. */
IPDNSC_QTYPE_AXFR = 252, /* Transfer zone of authority. */
IPDNSC_QTYPE_MAILB = 253, /* Transfer mailbox records. */
IPDNSC_QTYPE_MAILA = 254, /* Transfer mail agent records. */
IPDNSC_QTYPE_ANY = 255, /* Wildcard match. */
IPDNSC_QTYPE_ZXFR = 256, /* BIND-specific, nonstandard. */
IPDNSC_QTYPE_MAX = 65536
}
Ipdnsc_qtype;
/* defined response codes. */
typedef enum Ipdnsc_rcode_enum {
IPDNSC_RCODE_NOERROR = 0, /* No error occurred. */
IPDNSC_RCODE_FORMERR = 1, /* Format error. */
IPDNSC_RCODE_SERVFAIL = 2, /* Server failure. */
IPDNSC_RCODE_NXDOMAIN = 3, /* Name error. */
IPDNSC_RCODE_NOTIMPL = 4, /* Unimplemented. */
IPDNSC_RCODE_REFUSED = 5, /* Operation refused. */
/* these are for BIND_UPDATE */
IPDNSC_RCODE_YXDOMAIN = 6, /* Name exists */
IPDNSC_RCODE_YXRRSET = 7, /* RRset exists */
IPDNSC_RCODE_NXRRSET = 8, /* RRset does not exist */
IPDNSC_RCODE_NOTAUTH = 9, /* Not authoritative for zone */
IPDNSC_RCODE_NOTZONE= 10, /* Zone of record different from zone section */
/* 11-15 available for assignment */
/* The following are TSIG errors */
IPDNSC_RCODE_BADSIG = 16,
IPDNSC_RCODE_BADKEY = 17,
IPDNSC_RCODE_BADTIME = 18,
IPDNSC_RCODE_BADMODE = 19,
IPDNSC_RCODE_BADNAME = 20,
IPDNSC_RCODE_BADALG = 21,
IPDNSC_RCODE_MAX = 22
}
Ipdnsc_rcode;
/* DNS update operation */
typedef enum Ipdnsc_update_operation_enum {
IPDNSC_UPOP_DELETE = 0,
IPDNSC_UPOP_ADD = 1,
IPDNSC_UPOP_MAX = 2
}
Ipdnsc_update_operation;
/*
* This structure is used for TSIG authenticated messages
*/
typedef struct Ipdnsc_tsig_key_struct {
char name[IPDNSC_MAXDNAME]; /* the name of key must also exist on the DNS server */
char alg[IPDNSC_MAX_ALG_NAME]; /* DNS TSIG Algorithm */
Ip_u8 *secret; /* base64 secret must also be same with the DNS server */
Ip_u32 len; /* the length of secret */
}
Ipdnsc_tsig_key;
/*
* This RR-like structure is particular to UPDATE.
*/
typedef struct Ipdnsc_updrec_struct {
struct Ipdnsc_updrec_struct *next; /* next update record defined by caller */
struct Ipdnsc_updrec_struct *samezone_next; /* point the next update record belongs to a same zone on the nameserver.
It should be initialized by NULL. */
Ipdnsc_section r_section; /* ZONE/PREREQUISITE/UPDATE */
char *r_dname; /* owner of the RR */
Ip_u16 r_class; /* class number */
Ip_u16 r_type; /* type number */
Ip_u32 r_ttl; /* time to live */
Ip_u8 *r_data; /* rdata fields as text string */
Ip_u32 r_size; /* size of r_data field */
Ip_s32 r_opcode; /* type of operation */
}
Ipdnsc_updrec;
/*
*===========================================================================
* Ipdnsc_api
*===========================================================================
* For better binary scalability at image build time, access to
* the DNS resolver interface may be done through the following
* set of function pointers:
*/
typedef struct Ipdnsc_api_struct
{
struct Ip_hostent *(*getipnodebyname)(const char *name, int af,
int flags, int *error_num);
struct Ip_hostent *(*getipnodebyaddr)(const void *src, Ip_size_t len,
int af, int *error_num);
void (*freehostent)(struct Ip_hostent *he);
void (*cache_flush)(void);
}
Ipdnsc_api;
/*
****************************************************************************
* 6 LOCAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* ipdnsc_getipnodebyname - get host information by node name
*
* This routine can be used instead of the older standard gethostbyname() routine.
* gethostbyname() is inadequate for many applications, first because it provides
* no way for the caller to specify anything about the types of addresses desired
* (IPv4 only, IPv6 only, IPv4-mapped IPv6 are 'OK', and so forth), and second because
* many implementations of this function are not thread safe.
*
* Parameters:
* \is
* \i <name>
* A pointer to either a node name or a numeric address string (for example, a
* dotted-decimal IPv4 address or an IPv6 hex address).
* \i <af>
* Specifies the address family, either 'IPDNSC_AF_INET' or 'IPDNSC_AF_INET6'.
* \i <flags>
* Specifies the types of addresses that are searched for and the types of
* addresses that are returned. Applications desiring finer control over the
* types of addresses searched for and returned can specify other combinations
* of the <flags> parameter. A <flags> parameter of '0' implies a strict
* interpretation of the <af> parameter:
*
* If <flags> is '0' and <af> is 'AF_INET', then the caller wants only IPv4
* addresses. A query is made for A records. If successful, the IPv4 addresses
* are returned and the <h_length> member of the hostent structure is '4',
* otherwise the function returns a NULL pointer.
*
* If <flags> is '0' and if< af> is 'AF_INET6', then the caller wants only IPv6
* addresses. A query is made for AAAA records. If successful, the IPv6
* addresses are returned and the <h_length> member of the hostent structure is
* 16, otherwise the function returns a NULL pointer.
*
* Other constants can be logically-ORed into the <flags> parameter to modify the
* behavior of the function.
*
* If the 'AI_V4MAPPED' flag is specified along with an <af> of 'AF_INET6', then
* the caller will accept IPv4-mapped IPv6 addresses. That is, if no AAAA
* records are found then a query is made for A records and any found are
* returned as IPv4-mapped IPv6 addresses (<h_length> is 16). The 'AI_V4MAPPED'
* flag is ignored unless af equals 'AF_INET6'.
*
* The 'AI_ALL' flag is used in conjunction with the 'AI_V4MAPPED' flag, and is
* only used with the IPv6 address family. When 'AI_ALL' is logically or'd with
* 'AI_V4MAPPED' flag then the caller wants all addresses: IPv6 and IPv4-mapped
* IPv6. A query is first made for AAAA records and if successful, the IPv6
* addresses are returned. Another query is then made for A records and any found
* are returned as IPv4-mapped IPv6 addresses. <h_length> is 16. Only if both
* queries fail does the function return a NULL pointer. This flag is ignored
* unless af equals 'AF_INET6'.
*
* The 'AI_ADDRCONFIG' flag specifies that a query for AAAA records should occur
* only if the node has at least one IPv6 source address configured and a query
* for A records should occur only if the node has at least one IPv4 source
* address configured. For example, if the node has no IPv6 source addresses
* configured and <af> equals 'AF_INET6', and if the node name being looked up
* has both AAAA and A records, then:
*
* \ml
* \m -
* If only 'AI_ADDRCONFIG' is specified, the function returns a NULL pointer.
* \m -
* If 'AI_ADDRCONFIG' \| 'AI_V4MAPPED' is specified, the A records are returned
* as IPv4-mapped IPv6 addresses.
* \me
* \i <error_num>
* A pointer to an error code. <error_num> value is returned to the caller, via a
* pointer, with the appropriate error code in <error_num> to support thread safe
* error code returns.
*
* <error_num> is set to one of the following values:
*
* \is
* \i 'IPDNSC_HOST_NOT_FOUND'
* No such host is known.
* \i 'IPDNSC_NO_ADDRESS'
* The server recognized the request and the name but address is available.
* Another type of request to the name server for the domain might return an
* answer.
* \i 'IPDNSC_NO_RECOVERY'
* An unexpected server failure occurred which cannot be recovered.
* \i 'IPDNSC_TRY_AGAIN'
* A temporary and possibly transient error occurred, such as a failure of a
* server to respond.
* \ie
* \ie
*
* RETURNS:
*
* ERRNO:
*/
IP_PUBLIC struct Ip_hostent* ipdnsc_getipnodebyname
(
const char *name,
int af,
int flags,
int *error_num
);
/*******************************************************************************
*
* ipdnsc_getipnodebyaddr - get host information by IP address
*
* This routine gets host information based on the host\'s IP address. It is
* similar to the older standard gethostbyaddr() routine but adds an error number
* and is thread safe.
*
* Parameters:
* \is
* \i <src>
* A pointer to an IPv4 address or an IPv6 address in network endian.
* \i <len>
* The length of the address, in bytes.
* \i <af>
* The address family, either 'IPDNSC_AF_INET' or 'IPDNSC_AF_INET6'.
* \i <error_num>
* A pointer to an error code. <error_num> value is returned to the caller, via a
* pointer, with the appropriate error code in <error_num>, to support thread
* safe error code returns. The following error conditions may be returned for
* <error_num>:
*
* \is
* \i 'IPDNSC_HOST_NOT_FOUND'
* No such host is known.
* \i 'IPDNSC_NO_ADDRESS'
* The server recognized the request and the name but no address is available.
* Another type of request to the name server for the domain might return an
* answer.
* \i 'IPDNSC_NO_RECOVERY'
* An unexpected server failure occurred which cannot be recovered.
* \i 'IPDNSC_TRY_AGAIN'
* A temporary and possibly transient error occurred, such as a failure of a
* server to respond.
* \ie
* \ie
*
* RETURNS:
*
* ERRNO:
*/
IP_PUBLIC struct Ip_hostent* ipdnsc_getipnodebyaddr
(
const void *src,
Ip_size_t len,
int af,
int *error_num
);
/*******************************************************************************
*
* ipdnsc_freehostent - free memory allocated for an 'ip_hostent' structure
*
* This routine frees memory allocated for an 'ip_hostent' structure. An
* 'ip_hostent' structure is dynamically allocated by the
* ipdnsc_getipnodebyname() and ipdnsc_getipnodebyaddr() functions and must
* therefore be freed after use.
*
* Parameter:
* \is
* \i <he>
* A pointer to an 'ip_hostent' structure.
* \ie
*
* RETURNS:
*
* ERRNO:
*/
IP_PUBLIC void ipdnsc_freehostent
(
struct Ip_hostent *he
);
/*******************************************************************************
*
* ipdnsc_cache_flush - remove all entries in the resolver cache.
*
* This routine removes all entries in the resolver cache. It is useful after
* the name server has been updated with new information about a specific host.
*
* RETURNS:
*
* ERRNO:
*/
IP_PUBLIC void ipdnsc_cache_flush(void);
/*******************************************************************************
*
* ipdnsc_do_update - build and send Dynamic Updates to correct name server
*
* This routine handle a complete DNS update process.It separates the linked list of
* update records into groups so that all records in a group will belong to a single
* zone on the nameserver. It creates a dynamic update packet for each zone and sends
* it to the nameservers for that zone. Then it will receive and parse the response.
*
* Parameter:
* \is
* \i <update_records>
* The pointer to the linked list of update records.
* \i <r_buf>
* The pointer to the buffer to be filled with the update response packet.
* \i <r_buflen>
* The length of the r_buf, in bytes.
* \i <key>
* The pointer to the key to use for authentication. This key must exist on the name server..
* \i <error>
* error code returned.
* \ie
*
* RETURNS:
* n (successful), where n is the number of zones updated or -1 (unsuccessful)
*
* ERRNO:
*/
IP_PUBLIC Ip_s32 ipdnsc_do_update
(
Ipdnsc_updrec *update_records, Ip_u8 *r_buf, Ip_s32* r_buflen, Ipdnsc_tsig_key *key, Ip_s32 *error
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,77 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipftpc.h,v $ $Revision: 1.5 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipftpc.h,v $
* $Author: ulf $ $Date: 2006-09-27 12:23:05 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Ulf Olofsson <ulf@interpeak.se>
******************************************************************************
*/
#ifndef IPFTPC_H
#define IPFTPC_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipftpc_api.h"
#include "ipftpc_cmd.h"
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* release
*===========================================================================
*/
#define IPFTPC_RELEASE 060004
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 LOCAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,174 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipftpc_api.h,v $ $Revision: 1.9.12.2 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipftpc_api.h,v $
* $Author: hxu0 $ $Date: 2013-04-18 08:48:02 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Ulf Olofsson <ulf@interpeak.se>
******************************************************************************
*/
#ifndef IPFTPC_API_H
#define IPFTPC_API_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipcom.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/* Select level of verbosity for syslog messages */
#ifdef IPCOM_SYSLOG_PRIORITY
#undef IPCOM_SYSLOG_PRIORITY
#endif
#if defined(_WRS_CONFIG_IPFTPC_SYSLOG_PRIORITY)
#define IPCOM_SYSLOG_PRIORITY _WRS_CONFIG_IPFTPC_SYSLOG_PRIORITY
#else
#define IPCOM_SYSLOG_PRIORITY IPCOM_LOG_WARNING
#endif
/* Transport protocol for FTPC */
#ifdef IPFTPC_USE_SCTP
#define IPFTPC_PROTO IP_IPPROTO_SCTP
#else
#define IPFTPC_PROTO 0
#endif
/* Error classes */
#define IPFTPC_CFTPS 0 /* FTP server error (RFC 959) */
#define IPFTPC_CFTPC 1000 /* FTP client error (IPFTPC_Exxx) */
#define IPFTPC_CACCEPT 2000 /* Accept failed */
#define IPFTPC_CBIND 3000 /* Bind failed */
#define IPFTPC_CCONNECT 4000 /* Connect failed */
#define IPFTPC_CLISTEN 5000 /* Listen failed */
#define IPFTPC_COPEN 6000 /* Open failed */
#define IPFTPC_CREAD 7000 /* Read failed */
#define IPFTPC_CMUTEX 8000 /* Read failed */
#define IPFTPC_CSCLOSE 9000 /* Socket close failed */
#define IPFTPC_CSELECT 10000 /* Select failed */
#define IPFTPC_CSOCKET 11000 /* Socket failed */
#define IPFTPC_CWRITE 12000 /* Write failed */
#define IPFTPC_GET_C(x) ((x) - IPFTPC_GET_E(x))
/* Error codes */
#define IPFTPC_ESUCCESS 299 /* Success (in the FTP server group
so that x / 100 == 2) */
#define IPFTPC_EBUSY 901 /* Session is busy */
#define IPFTPC_ECONSOLE 902 /* Console write error */
#define IPFTPC_EID 903 /* Invalid ID */
#define IPFTPC_EINVHOST 904 /* Invalid host */
#define IPFTPC_ENOMEM 905 /* Out of memory */
#define IPFTPC_EPORT 906 /* Invalid port */
#define IPFTPC_ESESSIONMAX 907 /* No more sessions allowed */
#define IPFTPC_ETIMEOUT 908 /* Timeout */
#ifdef IPFTP_TLS
#define IPFTPC_ETLS 909
#endif
#define IPFTPC_GET_E(x) ((x) % 1000)
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/* Session ID */
typedef Ip_u16 Ipftpc_id;
/* Generic IP address */
typedef union
{
struct Ip_sockaddr sa; /* Generic address */
struct Ip_sockaddr_in sin; /* IPv4 address */
#ifdef IPCOM_USE_INET6
struct Ip_sockaddr_in6 sin6; /* IPv6 address */
#endif
}
Ipftpc_addr;
/* Session attributes */
typedef struct Ipftpc_attr
{
Ip_bool extended; /* Use extended addressing */
Ip_bool passive; /* Passive mode */
Ip_bool ipcheck; /* Disable proxy FTP */
Ip_bool verbose; /* Enable verbose printouts */
Ip_bool fb_extended; /* Allow fallback extended->normal */
Ip_bool fb_passive; /* Allow fallback passive->active */
Ip_u16 pportbase; /* Reject peer ports <= pportbase */
Ip_u16 lportbase; /* Use local ports from lportbase+1 */
void *data; /* User data */
int (*conout)(struct Ipftpc_attr *attr, const char *buf, int len);
/* Console input */
void (*ctrlin)(struct Ipftpc_attr *attr, const char *buf, int len);
/* Control input (if debug) */
void (*ctrlout)(struct Ipftpc_attr *attr, const char *buf, int len);
/* Control output (if debug) */
#ifdef IPFTP_TLS
Ip_bool tlsenble;
char *certfile;
char *keyfile;
void *tls;
Ip_bool ccc;
char prot[4];
#endif
}
Ipftpc_attr;
/*
****************************************************************************
* 6 LOCAL FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
#ifndef IPFTPC_API_C
#include "ipftpc_api_proto.h"
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,79 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipftpc_cmd.h,v $ $Revision: 1.4 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipftpc_cmd.h,v $
* $Author: ulf $ $Date: 2004-02-09 12:15:38 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Ulf Olofsson <ulf@interpeak.se>
******************************************************************************
*/
#ifndef IPFTPC_CMD_H
#define IPFTPC_CMD_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#include "ipcom.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 LOCAL FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
#ifndef IPFTPC_CMD_C
#include "ipftpc_cmd_proto.h"
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,873 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipftpc_cmd_proto.h,v $ $Revision: 1.7 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipftpc_cmd_proto.h,v $
* $Author: lob $ $Date: 2004-10-01 10:28:33 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Ulf Olofsson <ulf@interpeak.se>
******************************************************************************
*/
#ifndef IPFTPC_CMD_PROTO_H
#define IPFTPC_CMD_PROTO_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 LOCAL FUNCTIONS
****************************************************************************
*/
#ifdef IPFTPC_CMD_C
/*
*===========================================================================
* ipftpc_conout
*===========================================================================
* Description:
* Print command output console.
*
* Parameters
* vars Session variables.
* msg Error message.
* eno Error number.
*
* Returns:
*/
IP_STATIC int
ipftpc_conout(Ipftpc_attr *attr, const char *buf, int len);
/*
*===========================================================================
* ipftpc_ctrlin
*===========================================================================
* Description:
* Print control input to console.
*
* Parameters
* vars Session variables.
* msg Error message.
* eno Error number.
*
* Returns:
*/
IP_STATIC void
ipftpc_ctrlin(Ipftpc_attr *attr, const char *buf, int len);
/*
*===========================================================================
* ipftpc_ctrlout
*===========================================================================
* Description:
* Print control output to console.
*
* Parameters
* vars Session variables.
* msg Error message.
* eno Error number.
*
* Returns:
*/
IP_STATIC void
ipftpc_ctrlout(Ipftpc_attr *attr, const char *buf, int len);
/*
*===========================================================================
* ipftpc_perror
*===========================================================================
* Description:
* Print error message.
*
* Parameters
* vars Session variables.
* msg Error message.
* eno Error number.
*
* Returns:
*/
IP_STATIC void
ipftpc_perror(Ipftpc_vars *vars, const char *msg, int eno);
/*
*===========================================================================
* ipftpc_setextended
*===========================================================================
* Description:
* Set extended mode.
*
* Parameters
* extended New value.
*
* Returns:
*/
IP_STATIC int
ipftpc_setextended(Ipftpc_vars *vars, int extended);
/*
*===========================================================================
* ipftpc_setpassive
*===========================================================================
* Description:
* Set passive mode.
*
* Parameters
* passive New value.
*
* Returns:
*/
IP_STATIC int
ipftpc_setpassive(Ipftpc_vars *vars, int passive);
/*
*===========================================================================
* ipftpc_setverbose
*===========================================================================
* Description:
* Set verbose mode.
*
* Parameters
* verbose New value.
*
* Returns:
*/
IP_STATIC int
ipftpc_setverbose(Ipftpc_vars *vars, int verbose);
/*
*===========================================================================
* ipftpc_flag
*===========================================================================
* Description:
* Prepare for handling flag in command routine.
*
* Parameters
* vars Session variables.
* func Command routine.
* flag Flag.
*
* Returns:
*/
IP_STATIC void
ipftpc_flag(Ipftpc_vars *vars,
int (*func)(struct Ipftpc_vars_struct *vars, int argc, char *argv[]),
int flag);
/*
*===========================================================================
* ipftpc_do_append
*===========================================================================
* Description:
* append command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_append(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_ascii
*===========================================================================
* Description:
* ascii command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_ascii(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_binary
*===========================================================================
* Description:
* binary command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_binary(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_cd
*===========================================================================
* Description:
* cd command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_cd(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_cdup
*===========================================================================
* Description:
* cdup command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_cdup(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_close
*===========================================================================
* Description:
* close command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_close(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_delete
*===========================================================================
* Description:
* delete command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_delete(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_dir
*===========================================================================
* Description:
* dir command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_dir(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_extended
*===========================================================================
* Description:
* extended command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_extended(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_family
*===========================================================================
* Description:
* family command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_family(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_get
*===========================================================================
* Description:
* get command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_get(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_help
*===========================================================================
* Description:
* help command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_help(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_ipcheck
*===========================================================================
* Description:
* ipcheck command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_ipcheck(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_lbase
*===========================================================================
* Description:
* lbase command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_lbase(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_lcd
*===========================================================================
* Description:
* lcd command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_lcd(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_lpwd
*===========================================================================
* Description:
* lpwd command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_lpwd(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_ls
*===========================================================================
* Description:
* ls command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_ls(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_mkdir
*===========================================================================
* Description:
* mkdir command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_mkdir(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_open
*===========================================================================
* Description:
* open command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_open(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_passive
*===========================================================================
* Description:
* passive command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_passive(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_port
*===========================================================================
* Description:
* port command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_port(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_put
*===========================================================================
* Description:
* put command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_put(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_pwd
*===========================================================================
* Description:
* pwd command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_pwd(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_quit
*===========================================================================
* Description:
* quit command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_quit(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_quote
*===========================================================================
* Description:
* quote command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_quote(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_rbase
*===========================================================================
* Description:
* rbase command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_rbase(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_rename
*===========================================================================
* Description:
* rename command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_rename(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_rhelp
*===========================================================================
* Description:
* rhelp command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_rhelp(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_rmdir
*===========================================================================
* Description:
* rmdir command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_rmdir(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_rstatus
*===========================================================================
* Description:
* rstatus command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_rstatus(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_status
*===========================================================================
* Description:
* status command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_status(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_system
*===========================================================================
* Description:
* system command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_system(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_do_verbose
*===========================================================================
* Description:
* verbose command.
*
* Parameters
* vars Session variables.
* argc No of arguments.
* argv Argument vector.
*
* Returns:
* 0 if success, 1 if error, -1 if exit required.
*/
IP_STATIC int
ipftpc_do_verbose(Ipftpc_vars *vars, int argc, char *argv[]);
/*
*===========================================================================
* ipftpc_getline
*===========================================================================
* Description:
* Get command line.
*
* Parameters
*
* Returns:
*/
IP_STATIC int
ipftpc_getline(Ipftpc_vars *vars, const char *prompt, char *buf, int size);
/*
*===========================================================================
* ipftpc_cmdloop
*===========================================================================
* Description:
* Loop and get commands.
*
* Parameters
*
* Returns:
*/
IP_STATIC void
ipftpc_cmdloop(Ipftpc_vars *vars);
#endif
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,190 @@
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: ipftps.h,v $ $Revision: 1.8.12.5 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/ipftps.h,v $
* $Author: svc-cmnet $ $Date: 2018-08-15 23:33:07 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Ulf Olofsson <ulf@interpeak.se>
******************************************************************************
*/
#ifndef IPFTPS_H
#define IPFTPS_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
#include "ipftps_config.h"
#include "ipcom_config.h"
#include "ipcom_list.h"
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* release
*===========================================================================
*/
#define IPFTPS_RELEASE 060004
/* Transport protocol for FTPS */
#ifdef IPFTPS_USE_SCTP
#define IPFTPS_PROTO IP_IPPROTO_SCTP
#else
#define IPFTPS_PROTO 0
#endif
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/* dummy, see below for real struct */
struct Ipftps_session;
/* Socket control block */
typedef struct
{
union Ip_sockaddr_union paddr; /* Peer address */
union Ip_sockaddr_union laddr; /* Local address */
Ip_fd fd; /* File descriptor */
}
Ipftps_sockcb;
/* Command descriptor */
typedef struct
{
const char *name; /* Command name */
void (*func)(struct Ipftps_session *, int argc, char *argv[]);
/* Command handler */
Ip_u8 min; /* Min no of arguments */
Ip_u8 max; /* Max no of arguments */
Ip_u8 argtype; /* Command argument. 1 if string */
Ip_bool login; /* Requires login */
const char *help; /* Help text */
}
Ipftps_cmd;
/* Session descriptor */
typedef struct Ipftps_session
{
Ipcom_list head; /* List header */
Ipftps_sockcb csock; /* Control socket */
Ipftps_sockcb dsock; /* Data socket */
const Ipftps_cmd *last; /* Last command */
char *username; /* Username */
char *rnfr; /* Rename from this name */
char *root; /* Directory root */
char *cwd; /* Current working directory */
Ip_u32 trnow; /* Transferred bytes*/
Ip_u32 trtotal; /* Total bytes */
Ip_u16 pportbase; /* Reject peer ports <= pportbase */
Ip_u16 lportbase; /* Use local ports from lportbase+1 */
Ip_bool occupied; /* Session has a handler */
Ip_bool login; /* Login performed */
Ip_bool cwdroot; /* Use root as next CWD */
Ip_bool epsvonly; /* Use only extended passive mode */
Ip_bool passive; /* Passive mode */
Ip_bool binary; /* Binary mode */
Ip_bool readonly; /* Readonly mode */
Ip_bool proxy; /* Enable proxy FTP */
int authentications; /* Number of authentications */
int cmdlen; /* Length of current command */
int cmdbuflen; /* Length of all commands */
char cmdbuf[IPFTPS_CMDBUFSIZE + 1]; /* Command buffer */
char name[20]; /* Session name */
#ifdef IPFTP_TLS
void * tlsopt;
#endif
}
Ipftps_session;
/*
****************************************************************************
* 6 LOCAL FUNCTIONS
****************************************************************************
*/
/*
****************************************************************************
* 10 PUBLIC FUNCTIONS
****************************************************************************
*/
/*
*===========================================================================
* ipftps_authenticate
*===========================================================================
* Description:
* Authenticate user.
*
* Parameters:
* session Session descriptor.
* password Password.
*
* Returns:
* 0 if successful authentication, 1 otherwise.
*/
IP_PUBLIC int
ipftps_authenticate(Ipftps_session *session, char *password);
/*******************************************************************************
*
* ipftps_get_activesession - Get the current active session number of ftp server
*
* Get the current active session number of ftp server.
*
* Parameters:
* \is
* \ie
*
* RETURNS: The current active session number
*
* ERRNO:
*/
IP_PUBLIC int
ipftps_get_activesession(void);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/
@@ -0,0 +1,176 @@
/* iptftp.h - Public API of Wind River TFTP */
/*
******************************************************************************
* HEADER FILE
*
* Document no: @(#) $Name: VXWORKS_ITER40_2019102207 $ $RCSfile: iptftp.h,v $ $Revision: 1.10 $
* $Source: /home/interpeak/CVSRoot/ipappl/include/iptftp.h,v $
* $Author: hsun $ $Date: 2010-11-07 19:57:31 $
* $State: Exp $ $Locker: $
*
* INTERPEAK_COPYRIGHT_STRING
* Design and implementation by Markus Carlstedt <markus@interpeak.se>
******************************************************************************
*/
#ifndef IPTFTP_H
#define IPTFTP_H
/*
****************************************************************************
* 1 DESCRIPTION
****************************************************************************
* TFTP public header file.
*/
/*
DESCRIPTION
This library contains the APIs provided by the WindRiver TFTP.
*/
/*
****************************************************************************
* 2 CONFIGURATION
****************************************************************************
*/
/*
****************************************************************************
* 3 INCLUDE FILES
****************************************************************************
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
****************************************************************************
* 4 DEFINES
****************************************************************************
*/
/*
*===========================================================================
* release
*===========================================================================
*/
#define IPTFTP_RELEASE 60500
/* TFTP Client error codes */
#define IPTFTP_SUCCESS 0
#define IPTFTP_ERR_SERVER_ADDR 1
#define IPTFTP_ERR_MEMORY_FAIL 2
#define IPTFTP_ERR_FILE_OPEN 3
#define IPTFTP_ERR_FILE_READ 4
#define IPTFTP_ERR_FILE_WRITE 5
#define IPTFTP_ERR_TRANSFER_TIMEOUT 6
#define IPTFTP_ERR_SOCKET_FAIL 7
#define IPTFTP_ERR_ILLEGAL_MESSAGE 8
#define IPTFTP_ERR_ERROR_MESSAGE 9
/*
****************************************************************************
* 5 TYPES
****************************************************************************
*/
/*
****************************************************************************
* 6 FUNCTIONS
****************************************************************************
*/
/*******************************************************************************
*
* iptftp_client_put - transfer a file from the target to a TFTP server
*
* This routine transfers a file from the target to a TFTP server.
*
* Parameters:
* \is
* \i <server>
* A pointer to a string with either the Internet address or the hostname of the
* TFTP server.
* \i <srcfile>
* A pointer to a string with the source-file name.
* \i <dstfile>
* A pointer to a string with the destination-file name.
* \i <binary>
* A boolean that specifies binary (octet) or 'netascii' mode.
* \i <verbose>
* A boolean that specifies whether the routine prints status information to the
* standard output.
* \i <port>
* An int that specifies server tftp port other than the default value. If 0 use default.
* \ie
*
* RETURNS: 'IPTFTP_SUCCESS' or an error code.
*
* ERRNO:
*/
IP_PUBLIC Ip_err iptftp_client_put
(
const char *server,
const char *srcfile,
const char *dstfile,
Ip_bool binary,
Ip_bool verbose,
int port
);
/*******************************************************************************
*
* iptftp_client_get - transfer a file to the target from a TFTP server
*
* This routine transfers a file to the target from a TFTP server.
*
* Parameters:
* \is
* \i <server>
* A pointer to a string containing either the Internet address or the hostname
* of the TFTP server.
* \i <srcfile>
* A pointer to a string with the source-file name.
* \i <dstfile>
* A pointer to a string with the destination-file name.
* \i <binary>
* A boolean that specifies binary (octet) or 'netascii' mode.
* \i <verbose>
* A boolean that specifies whether the routine prints status information to the
* standard output.
* \i <port>
* An int that specifies server tftp port other than the default value. If 0 use default.
* \ie
*
* RETURNS: 'IPTFTP_SUCCESS' or an error code.
*
* ERRNO:
*/
IP_PUBLIC Ip_err iptftp_client_get
(
const char *server,
const char *srcfile,
const char *dstfile,
Ip_bool binary,
Ip_bool verbose,
int port
);
#ifdef __cplusplus
}
#endif
#endif
/*
****************************************************************************
* END OF FILE
****************************************************************************
*/