Import ncpfs 2.2.1

This commit is contained in:
ncpfs archive import
2026-04-28 20:39:59 +02:00
parent 0979ae6a41
commit 82706139bf
547 changed files with 176953 additions and 12604 deletions

View File

@@ -1,40 +0,0 @@
/*
* Header file for common error description library.
*
* Copyright 1988, Student Information Processing Board of the
* Massachusetts Institute of Technology.
*
* For copyright and distribution info, see the documentation supplied
* with this package.
*/
#ifndef __COM_ERR_H
typedef long errcode_t;
#ifdef __STDC__
#include <stdarg.h>
/* ANSI C -- use prototypes etc */
void com_err(const char *, long, const char *,...);
void com_err_va(const char *whoami, errcode_t code, const char *fmt,
va_list args);
char const *error_message(long);
extern void (*com_err_hook) (const char *, long, const char *, va_list);
void (*set_com_err_hook(void (*)(const char *, long, const char *, va_list)))
(const char *, long, const char *, va_list);
void (*reset_com_err_hook(void)) (const char *, long, const char *, va_list);
int init_error_table(const char *const *msgs, int base, int count);
#else
/* no prototypes */
void com_err();
void com_err_va();
char *error_message();
extern void (*com_err_hook) ();
void (*set_com_err_hook()) ();
void (*reset_com_err_hook()) ();
int init_error_table();
#endif
#define __COM_ERR_H
#endif /* ! defined(__COM_ERR_H) */

330
include/config.h.in Normal file
View File

@@ -0,0 +1,330 @@
/* include/config.h.in. Generated from configure.ac by autoheader. */
/* If you want native IP support, uncomment CONFIG_NATIVE_IP Do not forget
that it is VERY ALPHA code, with almost no support Enable only if you are
interested in NCP over IP and you want help me. -A ip.address is your
friend. At this time you have to silently ignore Login to server XXXX as
YYYY - think that XXXX is ip.address and not one taken from .nwclient.
Also, if you have not .nwclient, you have to add -S DUMMY on commandline.
*/
#undef CONFIG_NATIVE_IP
/* If you do not want IPX support, comment CONFIG_NATIVE_IPX out... I cannot
recommend doing it */
#undef CONFIG_NATIVE_IPX
/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP
systems. This function is required for `alloca.c' support on those systems.
*/
#undef CRAY_STACKSEG_END
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Define to 1 if you have `alloca', as a function or macro. */
#undef HAVE_ALLOCA
/* Define to 1 if you have <alloca.h> and it should be used (not on Ultrix).
*/
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the <argz.h> header file. */
#undef HAVE_ARGZ_H
/* Define if the GNU dcgettext() function is already present or preinstalled.
*/
#undef HAVE_DCGETTEXT
/* Define to 1 if you have the `feof_unlocked' function. */
#undef HAVE_FEOF_UNLOCKED
/* Define to 1 if you have the `fgets_unlocked' function. */
#undef HAVE_FGETS_UNLOCKED
/* Define to 1 if you have the `getcwd' function. */
#undef HAVE_GETCWD
/* Define to 1 if you have the `getc_unlocked' function. */
#undef HAVE_GETC_UNLOCKED
/* Define to 1 if you have the `getegid' function. */
#undef HAVE_GETEGID
/* Define to 1 if you have the `geteuid' function. */
#undef HAVE_GETEUID
/* Define to 1 if you have the `getgid' function. */
#undef HAVE_GETGID
/* Define to 1 if you have the `getpagesize' function. */
#undef HAVE_GETPAGESIZE
/* Define if the GNU gettext() function is already present or preinstalled. */
#undef HAVE_GETTEXT
/* Define to 1 if you have the `getuid' function. */
#undef HAVE_GETUID
/* Define if you have the iconv() function. */
#undef HAVE_ICONV
/* Define to 1 if you have the <iconv.h> header file. */
#undef HAVE_ICONV_H
/* Define if <inttypes.h> exists and doesn't clash with <sys/types.h>. */
#undef HAVE_INTTYPES_H
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
declares uintmax_t. */
#undef HAVE_INTTYPES_H_WITH_UINTMAX
/* Define if you have <langinfo.h> and nl_langinfo(CODESET). */
#undef HAVE_LANGINFO_CODESET
/* Define if your <locale.h> file defines LC_MESSAGES. */
#undef HAVE_LC_MESSAGES
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have IPX header linux/ipx.h */
#undef HAVE_LINUX_IPX_H
/* Define to 1 if you have the <locale.h> header file. */
#undef HAVE_LOCALE_H
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `mempcpy' function. */
#undef HAVE_MEMPCPY
/* Define to 1 if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define to 1 if you have the `munmap' function. */
#undef HAVE_MUNMAP
/* Define if you have IPX header netipx/ipx.h */
#undef HAVE_NETIPX_IPX_H
/* Define to 1 if you have the <nl_types.h> header file. */
#undef HAVE_NL_TYPES_H
/* Define to 1 if you have the `putenv' function. */
#undef HAVE_PUTENV
/* Define to 1 if you have the `setenv' function. */
#undef HAVE_SETENV
/* Define to 1 if you have the `setlocale' function. */
#undef HAVE_SETLOCALE
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
uintmax_t. */
#undef HAVE_STDINT_H_WITH_UINTMAX
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the `stpcpy' function. */
#undef HAVE_STPCPY
/* Define to 1 if you have the `strcasecmp' function. */
#undef HAVE_STRCASECMP
/* Define to 1 if you have the `strdup' function. */
#undef HAVE_STRDUP
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define to 1 if you have the `tsearch' function. */
#undef HAVE_TSEARCH
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define if you have the unsigned long long type. */
#undef HAVE_UNSIGNED_LONG_LONG
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the `wcscasecmp' function. */
#undef HAVE_WCSCASECMP
/* Define to 1 if you have the `wcscmp' function. */
#undef HAVE_WCSCMP
/* Define to 1 if you have the `wcscpy' function. */
#undef HAVE_WCSCPY
/* Define to 1 if you have the `wcsdup' function. */
#undef HAVE_WCSDUP
/* Define to 1 if you have the `wcslen' function. */
#undef HAVE_WCSLEN
/* Define to 1 if you have the `wcsncasecmp' function. */
#undef HAVE_WCSNCASECMP
/* Define to 1 if you have the `wcsncmp' function. */
#undef HAVE_WCSNCMP
/* Define to 1 if you have the `wcsrev' function. */
#undef HAVE_WCSREV
/* Define to 1 if you have the `__argz_count' function. */
#undef HAVE___ARGZ_COUNT
/* Define to 1 if you have the `__argz_next' function. */
#undef HAVE___ARGZ_NEXT
/* Define to 1 if you have the `__argz_stringify' function. */
#undef HAVE___ARGZ_STRINGIFY
/* Define as const if the declaration of iconv() needs const. */
#undef ICONV_CONST
/* Define if integer division by zero raises signal SIGFPE. */
#undef INTDIV0_RAISES_SIGFPE
/* If defined, support for Linux2.0.x is compiled in */
#undef MOUNT2
/* If defined, support for Linux2.1-3.x is compiled in */
#undef MOUNT3
/* Define to 8 (big-endian) or 16 (32 bit little-endian except i386) or 32
(i386) */
#undef MULTUNITSIZE
/* Enable support for NCP_DEBUG environment variable. */
#undef NCP_DEBUG
/* If you want to trace ncp calls uncomment this. */
#undef NCP_TRACE_ENABLE
/* If you want to include NDS support, define NDS_SUPPORT symbol Change only
through 'configure', copies of this value are in makefiles */
#undef NDS_SUPPORT
/* neither net/if.h nor linux/if.h was found, so ipx_* will not build... */
#undef NO_NET_IF_SUPPORT
/* neither net/route.h nor linux/route.h was found ... */
#undef NO_NET_ROUTE_SUPPORT
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define if <inttypes.h> exists and defines unusable PRI* macros. */
#undef PRI_MACROS_BROKEN
/* If you want to include packet signature support uncomment this. If you are
using 2.0.x Linux kernel, make sure that you also applied kernel patches.
Change only through 'configure', copies of this value are in makefiles */
#undef SIGNATURES
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown */
#undef STACK_DIRECTION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Define to 8 (big-endian) or 16 (32 bit little-endian except i386) or 32
(i386) */
#undef UNITSIZE
/* Define when compiling for Linux kernel */
#undef USE_KERNEL
/* Define if you need this for correct threading_MIT_POSIX_THREADS ... */
#undef _MIT_POSIX_THREADS
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define as `__inline' if that's what the C compiler calls it, or to nothing
if it is not supported. */
#undef inline
/* Define to `int' if <sys/types.h> does not define. */
#undef mode_t
/* Define to `long' if <sys/types.h> does not define. */
#undef off_t
/* Define to `int' if <sys/types.h> does not define. */
#undef pid_t
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define to unsigned long or unsigned long long if <inttypes.h> and
<stdint.h> don't define. */
#undef uintmax_t
/* Define to 'unsigned int' if wchar_t is not defined. */
#undef wchar_t

View File

@@ -1,22 +0,0 @@
#ifndef __GLIBSTUB_H__
#define __GLIBSTUB_H__
#undef GLIBCHDR
#ifdef __GLIBC__
#if __GLIBC__ >= 2
#define GLIBCHDR
#endif
#endif
#ifdef GLIBCHDR
#define HAVE_NETIPX_IPX_H
#define HAVE_SYS_MOUNT_H
#define HAVE_NET_ROUTE_H
#define HAVE_NET_IF_H
#else
#undef HAVE_NETIPX_IPX_H
#undef HAVE_SYS_MOUNT_H
#undef HAVE_NET_ROUTE_H
#undef HAVE_NET_IF_H
#endif
#endif /* __GLIBSTUB_H__ */

View File

@@ -1,98 +0,0 @@
/*
* ipxlib.h
*
* Copyright (C) 1995 by Volker Lendecke
*
*/
#ifndef _IPXLIB_H
#define _IPXLIB_H
#include "kernel/types.h"
#include "ncp.h"
#include "kernel/ipx.h"
typedef u_int32_t IPXNet;
typedef u_int16_t IPXPort;
typedef u_int8_t IPXNode[IPX_NODE_LEN];
typedef const u_int8_t CIPXNode[IPX_NODE_LEN];
#define IPX_USER_PTYPE (0x00)
#define IPX_RIP_PTYPE (0x01)
#define IPX_SAP_PTYPE (0x04)
#define IPX_AUTO_PORT (0x0000)
#define IPX_SAP_PORT (0x0452)
#define IPX_RIP_PORT (0x0453)
#define IPX_SAP_GENERAL_QUERY (0x0001)
#define IPX_SAP_GENERAL_RESPONSE (0x0002)
#define IPX_SAP_NEAREST_QUERY (0x0003)
#define IPX_SAP_NEAREST_RESPONSE (0x0004)
#define IPX_SAP_FILE_SERVER (0x0004)
struct sap_query
{
u_int16_t query_type; /* net order */
u_int16_t server_type; /* net order */
};
struct sap_server_ident
{
u_int16_t server_type __attribute__((packed));
char server_name[48] __attribute__((packed));
IPXNet server_network __attribute__((packed));
IPXNode server_node __attribute__((packed));
IPXPort server_port __attribute__((packed));
u_int16_t intermediate_network __attribute__((packed));
};
#define IPX_RIP_REQUEST (0x1)
#define IPX_RIP_RESPONSE (0x2)
struct ipx_rip_packet
{
u_int16_t operation __attribute__((packed));
struct ipx_rt_def
{
u_int32_t network __attribute__((packed));
u_int16_t hops __attribute__((packed));
u_int16_t ticks __attribute__((packed));
}
rt[1] __attribute__((packed));
};
#define IPX_BROADCAST_NODE ("\xff\xff\xff\xff\xff\xff")
#define IPX_THIS_NODE ("\0\0\0\0\0\0")
#define IPX_THIS_NET (0)
#ifndef IPX_NODE_LEN
#define IPX_NODE_LEN (6)
#endif
void
ipx_print_node(IPXNode node);
void
ipx_print_network(IPXNet net);
void
ipx_print_port(IPXPort port);
void
ipx_print_saddr(struct sockaddr_ipx *sipx);
void
ipx_fprint_node(FILE * file, IPXNode node);
void
ipx_fprint_network(FILE * file, IPXNet net);
void
ipx_fprint_port(FILE * file, IPXPort port);
void
ipx_fprint_saddr(FILE * file, struct sockaddr_ipx *sipx);
int
ipx_sscanf_node(char *buf, unsigned char node[IPX_NODE_LEN]);
void
ipx_assign_node(IPXNode dest, CIPXNode src);
int
ipx_node_equal(CIPXNode n1, CIPXNode n2);
int
ipx_sscanf_saddr(char* buf, struct sockaddr_ipx* sipx);
#endif /* _IPXLIB_H */

View File

@@ -1,11 +0,0 @@
#ifndef _KERNEL_FS_H
#define _KERNEL_FS_H
#include "glibstub.h"
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#else
#include <linux/fs.h>
#endif
#endif

View File

@@ -1,11 +0,0 @@
#ifndef _KERNEL_IF_H
#define _KERNEL_IF_H
#include "glibstub.h"
#ifdef HAVE_NET_IF_H
#include <net/if.h>
#else
#include <linux/if.h>
#endif
#endif

View File

@@ -1,15 +0,0 @@
#ifndef _KERNEL_IPX_H
#define _KERNEL_IPX_H
#include "glibstub.h"
#ifdef HAVE_NETIPX_IPX_H
#include <netipx/ipx.h>
#else
#include <linux/ipx.h>
#endif
#ifndef IPXPROTO_IPX
#define IPXPROTO_IPX (PF_IPX)
#endif
#endif

View File

@@ -1,213 +0,0 @@
/*
* ncp.h
*
* Copyright (C) 1995 by Volker Lendecke
* Modified for sparc by J.F. Chadima
*
*/
#ifndef _LINUX_NCP_H
#define _LINUX_NCP_H
#include "kernel/types.h"
#include "kernel/ipx.h"
#define NCP_PTYPE (0x11)
#define NCP_PORT (0x0451)
#define NCP_ALLOC_SLOT_REQUEST (0x1111)
#define NCP_REQUEST (0x2222)
#define NCP_DEALLOC_SLOT_REQUEST (0x5555)
struct ncp_request_header {
u_int16_t type __attribute__((packed));
u_int8_t sequence __attribute__((packed));
u_int8_t conn_low __attribute__((packed));
u_int8_t task __attribute__((packed));
u_int8_t conn_high __attribute__((packed));
u_int8_t function __attribute__((packed));
u_int8_t data[0] __attribute__((packed));
};
#define NCP_REPLY (0x3333)
#define NCP_POSITIVE_ACK (0x9999)
struct ncp_reply_header {
__u16 type __attribute__((packed));
__u8 sequence __attribute__((packed));
__u8 conn_low __attribute__((packed));
__u8 task __attribute__((packed));
__u8 conn_high __attribute__((packed));
__u8 completion_code __attribute__((packed));
__u8 connection_state __attribute__((packed));
__u8 data[0] __attribute__((packed));
};
#define NCP_VOLNAME_LEN (16)
#define NCP_NUMBER_OF_VOLUMES (64)
struct ncp_volume_info {
__u32 total_blocks;
__u32 free_blocks;
__u32 purgeable_blocks;
__u32 not_yet_purgeable_blocks;
__u32 total_dir_entries;
__u32 available_dir_entries;
__u8 sectors_per_block;
char volume_name[NCP_VOLNAME_LEN + 1];
};
/* these define the attribute byte as seen by NCP */
#define aRONLY (ntohl(0x01000000))
#define aHIDDEN (ntohl(0x02000000))
#define aSYSTEM (ntohl(0x04000000))
#define aEXECUTE (ntohl(0x08000000))
#define aDIR (ntohl(0x10000000))
#define aARCH (ntohl(0x20000000))
#define AR_READ (ntohs(0x0100))
#define AR_WRITE (ntohs(0x0200))
#define AR_EXCLUSIVE (ntohs(0x2000))
#define NCP_FILE_ID_LEN 6
/* Defines for Name Spaces */
#define NW_NS_DOS 0
#define NW_NS_MAC 1
#define NW_NS_NFS 2
#define NW_NS_FTAM 3
#define NW_NS_OS2 4
#if 0 /* Sorry, I do not think so... VANA */
/* Defines for ReturnInformationMask */
#define RIM_NAME (ntohl(0x01000000L))
#define RIM_SPACE_ALLOCATED (ntohl(0x02000000L))
#define RIM_ATTRIBUTES (ntohl(0x04000000L))
#define RIM_DATA_SIZE (ntohl(0x08000000L))
#define RIM_TOTAL_SIZE (ntohl(0x10000000L))
#define RIM_EXT_ATTR_INFO (ntohl(0x20000000L))
#define RIM_ARCHIVE (ntohl(0x40000000L))
#define RIM_MODIFY (ntohl(0x80000000L))
#define RIM_CREATION (ntohl(0x00010000L))
#define RIM_OWNING_NAMESPACE (ntohl(0x00020000L))
#define RIM_DIRECTORY (ntohl(0x00040000L))
#define RIM_RIGHTS (ntohl(0x00080000L))
#define RIM_ALL (ntohl(0xFF0F0000L))
#define RIM_COMPRESSED_INFO (ntohl(0x00000080L))
#else
#define RIM_NAME 0x00000001
#define RIM_SPACE_ALLOCATED 0x00000002
#define RIM_ATTRIBUTES 0x00000004
#define RIM_DATA_SIZE 0x00000008
#define RIM_TOTAL_SIZE 0x00000010
#define RIM_EXT_ATTR_INFO 0x00000020
#define RIM_ARCHIVE 0x00000040
#define RIM_MODIFY 0x00000080
#define RIM_CREATION 0x00000100
#define RIM_OWNING_NAMESPACE 0x00000200
#define RIM_DIRECTORY 0x00000400
#define RIM_RIGHTS 0x00000800
#define RIM_ALL 0x00000FFF
#define RIM_COMPRESSED_INFO 0x80000000UL
#endif
/* open/create modes */
#define OC_MODE_OPEN 0x01
#define OC_MODE_TRUNCATE 0x02
#define OC_MODE_REPLACE 0x02
#define OC_MODE_CREATE 0x08
/* open/create results */
#define OC_ACTION_NONE 0x00
#define OC_ACTION_OPEN 0x01
#define OC_ACTION_CREATE 0x02
#define OC_ACTION_TRUNCATE 0x04
#define OC_ACTION_REPLACE 0x04
/* access rights attributes */
#ifndef AR_READ_ONLY
#define AR_READ_ONLY 0x0001
#define AR_WRITE_ONLY 0x0002
#define AR_DENY_READ 0x0004
#define AR_DENY_WRITE 0x0008
#define AR_COMPATIBILITY 0x0010
#define AR_WRITE_THROUGH 0x0040
#define AR_OPEN_COMPRESSED 0x0100
#endif
struct nw_info_struct {
__u32 spaceAlloc __attribute__((packed));
__u32 attributes __attribute__((packed));
__u16 flags __attribute__((packed));
__u32 dataStreamSize __attribute__((packed));
__u32 totalStreamSize __attribute__((packed));
__u16 numberOfStreams __attribute__((packed));
__u16 creationTime __attribute__((packed));
__u16 creationDate __attribute__((packed));
__u32 creatorID __attribute__((packed));
__u16 modifyTime __attribute__((packed));
__u16 modifyDate __attribute__((packed));
__u32 modifierID __attribute__((packed));
__u16 lastAccessDate __attribute__((packed));
__u16 archiveTime __attribute__((packed));
__u16 archiveDate __attribute__((packed));
__u32 archiverID __attribute__((packed));
__u16 inheritedRightsMask __attribute__((packed));
__u32 dirEntNum __attribute__((packed));
__u32 DosDirNum __attribute__((packed));
__u32 volNumber __attribute__((packed));
__u32 EADataSize __attribute__((packed));
__u32 EAKeyCount __attribute__((packed));
__u32 EAKeySize __attribute__((packed));
__u32 NSCreator __attribute__((packed));
__u8 nameLen __attribute__((packed));
__u8 entryName[256] __attribute__((packed));
};
/* modify mask - use with MODIFY_DOS_INFO structure */
#define DM_ATTRIBUTES (ntohl(0x02000000L))
#define DM_CREATE_DATE (ntohl(0x04000000L))
#define DM_CREATE_TIME (ntohl(0x08000000L))
#define DM_CREATOR_ID (ntohl(0x10000000L))
#define DM_ARCHIVE_DATE (ntohl(0x20000000L))
#define DM_ARCHIVE_TIME (ntohl(0x40000000L))
#define DM_ARCHIVER_ID (ntohl(0x80000000L))
#define DM_MODIFY_DATE (ntohl(0x00010000L))
#define DM_MODIFY_TIME (ntohl(0x00020000L))
#define DM_MODIFIER_ID (ntohl(0x00040000L))
#define DM_LAST_ACCESS_DATE (ntohl(0x00080000L))
#define DM_INHERITED_RIGHTS_MASK (ntohl(0x00100000L))
#define DM_MAXIMUM_SPACE (ntohl(0x00200000L))
struct nw_modify_dos_info {
__u32 attributes __attribute__((packed));
__u16 creationDate __attribute__((packed));
__u16 creationTime __attribute__((packed));
__u32 creatorID __attribute__((packed));
__u16 modifyDate __attribute__((packed));
__u16 modifyTime __attribute__((packed));
__u32 modifierID __attribute__((packed));
__u16 archiveDate __attribute__((packed));
__u16 archiveTime __attribute__((packed));
__u32 archiverID __attribute__((packed));
__u16 lastAccessDate __attribute__((packed));
__u16 inheritanceGrantMask __attribute__((packed));
__u16 inheritanceRevokeMask __attribute__((packed));
__u32 maximumSpace __attribute__((packed));
};
struct nw_file_info {
struct nw_info_struct i;
int opened;
int access;
__u32 server_file_handle __attribute__((packed));
__u8 open_create_action __attribute__((packed));
__u8 file_handle[6] __attribute__((packed));
};
struct nw_search_sequence {
__u8 volNumber __attribute__((packed));
__u32 dirBase __attribute__((packed));
__u32 sequence __attribute__((packed));
};
#endif /* _LINUX_NCP_H */

View File

@@ -1,110 +0,0 @@
/*
* ncp_fs.h
*
* Copyright (C) 1995, 1996 by Volker Lendecke
*
*/
#ifndef _KERNEL_NCP_FS_H
#define _KERNEL_NCP_FS_H
#include "kernel/fs.h"
#include <netinet/in.h>
#include <sys/types.h>
/*
* ioctl commands
*/
struct ncp_ioctl_request {
unsigned int function;
unsigned int size;
char *data;
};
struct ncp_fs_info {
int version;
struct sockaddr_ipx addr;
__kerXX_uid_t mounted_uid;
int connection; /* Connection number the server assigned us */
int buffer_size; /* The negotiated buffer size, to be
used for read/write requests! */
int volume_number;
__u32 directory_id;
};
struct ncp_sign_init
{
char sign_root[8];
char sign_last[16];
};
struct ncp_lock_ioctl
{
#define NCP_LOCK_LOG 0
#define NCP_LOCK_SH 1
#define NCP_LOCK_EX 2
#define NCP_LOCK_CLEAR 256
int cmd;
int origin;
unsigned int offset;
unsigned int length;
#define NCP_LOCK_DEFAULT_TIMEOUT 18
#define NCP_LOCK_MAX_TIMEOUT 180
int timeout;
};
struct ncp_setroot_ioctl
{
int volNumber;
int namespace;
__u32 dirEntNum;
};
struct ncp_objectname_ioctl
{
#define NCP_AUTH_NONE 0x00
#define NCP_AUTH_BIND 0x31
#define NCP_AUTH_NDS 0x32
int auth_type;
size_t object_name_len;
void* object_name;
};
struct ncp_privatedata_ioctl
{
size_t len;
void* data; /* ~1000 for NDS */
};
#define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request)
#define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_uid_t)
#define NCP_IOC_CONN_LOGGED_IN _IO('n', 3)
#define NCP_GET_FS_INFO_VERSION (1)
#define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info)
#define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init)
#define NCP_IOC_SIGN_WANTED _IOR('n', 6, int)
#define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int)
#define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl)
#define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl)
#define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl)
#define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl)
#define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl)
#define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl)
#define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl)
/*
* The packet size to allocate. One page should be enough.
*/
#define NCP_PACKET_SIZE 4070
#define NCP_MAXPATHLEN 255
#define NCP_MAXNAMELEN 14
#endif /* _LINUX_NCP_FS_H */

View File

@@ -1,12 +0,0 @@
#ifndef __KERNEL_ROUTE_H__
#define __KERNEL_ROUTE_H__
#include "glibstub.h"
#ifdef HAVE_NET_ROUTE_H
#include <net/route.h>
#else
#include <linux/route.h>
#endif
#endif /* __KERNEL_ROUTE_H__ */

View File

@@ -1,40 +0,0 @@
#ifndef __KERNEL_TYPES_H__
#define __KERNEL_TYPES_H__
#include <sys/types.h>
#undef __u8
#undef __u16
#undef __u32
#define __u8 u_int8_t
#define __u16 u_int16_t
#define __u32 u_int32_t
typedef u_int16_t __kerXX_uid_t;
#include <linux/posix_types.h>
typedef __kernel_pid_t __ker20_pid_t;
typedef __kernel_uid_t __ker20_uid_t;
typedef __kernel_gid_t __ker20_gid_t;
typedef __kernel_mode_t __ker20_mode_t;
typedef __kernel_pid_t __ker21_pid_t;
typedef __kernel_uid_t __ker21_uid_t;
typedef __kernel_gid_t __ker21_gid_t;
typedef __kernel_mode_t __ker21_mode_t;
#ifdef __GLIBC__
/* why is this defined in posix_types ???? dirty hack... */
#undef __FD_CLR
#undef __FD_SET
#undef __FD_ISSET
#undef __FD_ZERO
#ifdef _SELECTBITS_H
#undef _SELECTBITS_H
#include <selectbits.h>
#endif
#endif
#endif /* __KERNEL_TYPES_H__ */

View File

@@ -1,122 +0,0 @@
/*
* ncp.h
*
* Copyright (C) 1995 by Volker Lendecke
* Modified for sparc by J.F. Chadima
*
*/
#ifndef _NCP_H
#define _NCP_H
#include "kernel/types.h"
#include "kernel/ipx.h"
#include "kernel/ncp.h"
#include "kernel/ncp_fs.h"
#define NCP_BINDERY_USER (0x0001)
#define NCP_BINDERY_UGROUP (0x0002)
#define NCP_BINDERY_PQUEUE (0x0003)
#define NCP_BINDERY_FSERVER (0x0004)
#define NCP_BINDERY_NAME_LEN (48)
struct ncp_bindery_object {
__u32 object_id;
__u16 object_type;
__u8 object_name[NCP_BINDERY_NAME_LEN];
__u8 object_flags;
__u8 object_security;
__u8 object_has_prop;
};
struct nw_property {
__u8 value[128];
__u8 more_flag;
__u8 property_flag;
};
struct prop_net_address {
__u32 network __attribute__((packed));
__u8 node[IPX_NODE_LEN] __attribute__((packed));
__u16 port __attribute__((packed));
};
struct ncp_filesearch_info {
__u8 volume_number;
__u16 directory_id;
__u16 sequence_no;
__u8 access_rights;
};
#define NCP_MAX_FILENAME (14)
struct ncp_file_info {
__u8 file_id[NCP_FILE_ID_LEN];
char file_name[NCP_MAX_FILENAME + 1];
__u8 file_attributes;
__u8 file_mode;
__u32 file_length;
__u16 creation_date;
__u16 access_date;
__u16 update_date;
__u16 update_time;
};
struct nw_queue_job_entry {
__u16 InUse __attribute__((packed));
__u32 prev __attribute__((packed));
__u32 next __attribute__((packed));
__u32 ClientStation __attribute__((packed));
__u32 ClientTask __attribute__((packed));
__u32 ClientObjectID __attribute__((packed));
__u32 TargetServerID __attribute__((packed));
__u8 TargetExecTime[6] __attribute__((packed));
__u8 JobEntryTime[6] __attribute__((packed));
__u32 JobNumber __attribute__((packed));
__u16 JobType __attribute__((packed));
__u16 JobPosition __attribute__((packed));
__u16 JobControlFlags __attribute__((packed));
__u8 FileNameLen __attribute__((packed));
char JobFileName[13] __attribute__((packed));
__u32 JobFileHandle __attribute__((packed));
__u32 ServerStation __attribute__((packed));
__u32 ServerTaskNumber __attribute__((packed));
__u32 ServerObjectID __attribute__((packed));
char JobTextDescription[50] __attribute__((packed));
char ClientRecordArea[152] __attribute__((packed));
};
struct queue_job {
struct nw_queue_job_entry j;
__u8 file_handle[6];
};
#define QJE_OPER_HOLD 0x80
#define QJE_USER_HOLD 0x40
#define QJE_ENTRYOPEN 0x20
#define QJE_SERV_RESTART 0x10
#define QJE_SERV_AUTO 0x08
/* ClientRecordArea for print jobs */
#define KEEP_ON 0x0400
#define NO_FORM_FEED 0x0800
#define NOTIFICATION 0x1000
#define DELETE_FILE 0x2000
#define EXPAND_TABS 0x4000
#define PRINT_BANNER 0x8000
struct print_job_record {
__u8 Version __attribute__((packed));
__u8 TabSize __attribute__((packed));
__u16 Copies __attribute__((packed));
__u16 CtrlFlags __attribute__((packed));
__u16 Lines __attribute__((packed));
__u16 Rows __attribute__((packed));
char FormName[16] __attribute__((packed));
__u8 Reserved[6] __attribute__((packed));
char BannerName[13] __attribute__((packed));
char FnameBanner[13] __attribute__((packed));
char FnameHeader[14] __attribute__((packed));
char Path[80] __attribute__((packed));
};
#endif /* _NCP_H */

148
include/ncp/eas.h Normal file
View File

@@ -0,0 +1,148 @@
/*
eas.h
Copyright (C) 2000 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision History:
1.00 2000, August 26 Petr Vandrovec <vandrove@vc.cvut.cz>
Initial release.
1.01 2001, December 31 Petr Vandrovec <vandrove@vc.cvut.cz>
Updated for SWIG.
*/
#ifndef __NCP_EAS_H__
#define __NCP_EAS_H__
#include <ncp/nwcalls.h>
#define NWEA_FL_CLOSE_IMM 0x0080
#define NWEA_FL_INFO(X) ((X) << 4)
#define NWEA_FL_INFO0 NWEA_FL_INFO(0)
#define NWEA_FL_INFO1 NWEA_FL_INFO(1)
#define NWEA_FL_INFO6 NWEA_FL_INFO(6)
#define NWEA_FL_INFO7 NWEA_FL_INFO(7)
#define NWEA_FL_CLOSE_ERR 0x0004
#define NWEA_FL_SRC_DIRENT 0x0000 /* volume + DOS dirEnt */
#define NWEA_FL_SRC_NWHANDLE 0x0001 /* handle from open */
#define NWEA_FL_SRC_EAHANDLE 0x0002 /* handle from previous EA op */
struct ncp_ea_enumerate_info {
uint_fast32_t errorCode;
uint_fast32_t totalEAs;
uint_fast32_t totalEAsDataSize;
uint_fast32_t totalEAsKeySize;
uint_fast32_t newEAhandle;
uint_fast16_t enumSequence;
uint_fast16_t returnedItems;
};
struct ncp_ea_read_info {
uint_fast32_t errorCode;
uint_fast32_t totalValuesLength;
uint_fast32_t newEAhandle;
uint_fast32_t accessFlag;
};
struct ncp_ea_write_info {
uint_fast32_t errorCode;
uint_fast32_t written;
uint_fast32_t newEAhandle;
};
/* level0 has no special info */
struct ncp_ea_info_level1 {
uint_fast32_t valueLength;
uint_fast32_t accessFlag;
#ifdef SWIG
%pragma(swig) readonly
uint_fast16_t keyLength;
uint_fast16_tLenPrefixCharArray key[256];
%pragma(swig) readwrite
#else
uint_fast16_t keyLength;
u_int8_t key[256];
#endif
};
struct ncp_ea_info_level6 {
uint_fast32_t valueLength;
uint_fast32_t accessFlag;
uint_fast32_t valueExtants;
uint_fast32_t keyExtants;
#ifdef SWIG
%pragma(swig) readonly
uint_fast16_t keyLength;
uint_fast16_tLenPrefixCharArray key[256];
%pragma(swig) readwrite
#else
uint_fast16_t keyLength;
u_int8_t key[256];
#endif
};
/* level7 is returned as char array */
NWCCODE ncp_ea_close(NWCONN_HANDLE conn, uint_fast32_t EAHandle);
NWCCODE ncp_ea_duplicate(NWCONN_HANDLE conn,
uint_fast16_t srcFlags,
uint_fast32_t srcHandleOrVol, uint_fast32_t srcZeroOrDir,
uint_fast16_t dstFlags,
uint_fast32_t dstHandleOrVol, uint_fast32_t dstZeroOrDir,
u_int32_t* duplicateCount,
u_int32_t* dataSizeDuplicated,
u_int32_t* keySizeDuplicated);
NWCCODE ncp_ea_enumerate(NWCONN_HANDLE conn,
uint_fast16_t flags,
uint_fast32_t handleOrVol, uint_fast32_t zeroOrDir,
uint_fast32_t inspectSize,
const void* key, size_t keyLen,
struct ncp_ea_enumerate_info* info,
void* data, size_t datalen, size_t* rdatalen);
NWCCODE ncp_ea_read(NWCONN_HANDLE conn,
uint_fast16_t flags,
uint_fast32_t handleOrVol, uint_fast32_t zeroOrDir,
uint_fast32_t inspectSize,
const void* key, size_t keyLen,
uint_fast32_t readOffset,
struct ncp_ea_read_info* info,
void* data, size_t datalen, size_t* rdatalen);
NWCCODE ncp_ea_write(NWCONN_HANDLE conn,
uint_fast16_t flags,
uint_fast32_t handleOrVol, uint_fast32_t zeroOrDir,
uint_fast32_t totalWriteSize,
const void* key, size_t keyLen,
uint_fast32_t writeOffset,
uint_fast32_t accessFlag,
struct ncp_ea_write_info* info,
const void* data, size_t datalen);
NWCCODE ncp_ea_extract_info_level1(const unsigned char* buffer,
const unsigned char* endbuf,
struct ncp_ea_info_level1* info, size_t maxsize,
size_t* needsize, const unsigned char** next);
NWCCODE ncp_ea_extract_info_level6(const unsigned char* buffer,
const unsigned char* endbuf,
struct ncp_ea_info_level6* info, size_t maxsize,
size_t* needsize, const unsigned char** next);
NWCCODE ncp_ea_extract_info_level7(const unsigned char* buffer,
const unsigned char* endbuf,
char* key, size_t maxsize, size_t* needsize,
const unsigned char** next);
#endif /* __NCP_EAS_H__ */

View File

@@ -0,0 +1,10 @@
#ifndef __EXT_SOCKET__
#define __EXT_SOCKET__
#include <sys/socket.h>
@socklen_t@
#endif /* __EXT_SOCKET__ */

View File

@@ -0,0 +1,33 @@
#ifndef __EXT_STDINT_H__
#define __EXT_STDINT_H__
#if @stdint_types@
/* we have stdint.h header */
#include <stdint.h>
#else
/* we have not stdint.h */
#include <ncp/kernel/types.h>
/* Signed. */
#define int_least8_t int8_t
#define int_least16_t int16_t
#define int_least32_t int32_t
/* Unsigned. */
#define uint_least8_t u_int8_t
#define uint_least16_t u_int16_t
#define uint_least32_t u_int32_t
/* Fast types. */
/* Signed. */
#define int_fast8_t u_int8_t
/* fix for WORDSIZE==16 ! */
#define int_fast16_t int
#define int_fast32_t int
/* Unsigned. */
#define uint_fast8_t u_int8_t
/* fix for WORDSIZE==16 ! */
#define uint_fast16_t unsigned int
#define uint_fast32_t unsigned int
#endif
#endif /* __EXT_STDINT_H__ */

142
include/ncp/ipxlib.h Normal file
View File

@@ -0,0 +1,142 @@
/*
ipxlib.h
Copyright (C) 1995 by Volker Lendecke
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
0.00 1995 Volker Lendecke
Initial revision.
1.00 2001, September 15 Petr Vandrovec <vandrove@vc.cvut.cz>
Fixes for SWIG processing. Unwind nested structs so names
are defined here and not by SWIG.
*/
#ifndef _IPXLIB_H
#define _IPXLIB_H
#include <ncp/kernel/types.h>
#include <ncp/ncp.h>
#include <ncp/kernel/ipx.h>
typedef u_int32_t IPXNet;
typedef u_int16_t IPXPort;
typedef u_int8_t IPXNode[IPX_NODE_LEN];
typedef const u_int8_t CIPXNode[IPX_NODE_LEN];
#define IPX_USER_PTYPE (0x00)
#define IPX_RIP_PTYPE (0x01)
#define IPX_SAP_PTYPE (0x04)
#define IPX_AUTO_PORT (0x0000)
#define IPX_SAP_PORT (0x0452)
#define IPX_RIP_PORT (0x0453)
#define IPX_SAP_GENERAL_QUERY (0x0001)
#define IPX_SAP_GENERAL_RESPONSE (0x0002)
#define IPX_SAP_NEAREST_QUERY (0x0003)
#define IPX_SAP_NEAREST_RESPONSE (0x0004)
#define IPX_SAP_SPECIFIC_QUERY (0x000E)
#define IPX_SAP_SPECIFIC_RESPONSE (0x000F)
#define IPX_SAP_FILE_SERVER (0x0004)
struct sap_query
{
u_int16_t query_type; /* net order */
u_int16_t server_type; /* net order */
};
struct sap_server_ident
{
u_int16_t server_type __attribute__((packed));
char server_name[48] __attribute__((packed));
IPXNet server_network __attribute__((packed));
#ifdef SWIG
u_int8_t server_node[6] __attribute__((packed));
#else
IPXNode server_node __attribute__((packed));
#endif
IPXPort server_port __attribute__((packed));
u_int16_t intermediate_network __attribute__((packed));
};
#define IPX_RIP_REQUEST (0x1)
#define IPX_RIP_RESPONSE (0x2)
struct ipx_rt_def {
u_int32_t network __attribute__((packed));
u_int16_t hops __attribute__((packed));
u_int16_t ticks __attribute__((packed));
};
struct ipx_rip_packet
{
u_int16_t operation __attribute__((packed));
struct ipx_rt_def rt[1] __attribute__((packed));
};
#ifdef SWIG
#define IPX_BROADCAST_NODE "\xff\xff\xff\xff\xff\xff"
#define IPX_THIS_NODE "\0\0\0\0\0\0"
#else
#define IPX_BROADCAST_NODE ("\xff\xff\xff\xff\xff\xff")
#define IPX_THIS_NODE ("\0\0\0\0\0\0")
#endif
#define IPX_THIS_NET (0)
#ifndef IPX_NODE_LEN
#define IPX_NODE_LEN (6)
#endif
#ifdef __cplusplus
extern "C" {
#endif
void
ipx_print_node(IPXNode node);
void
ipx_print_network(IPXNet net);
void
ipx_print_port(IPXPort port);
void
ipx_fprint_node(FILE * file, IPXNode node);
void
ipx_fprint_network(FILE * file, IPXNet net);
void
ipx_fprint_port(FILE * file, IPXPort port);
int
ipx_sscanf_node(char *buf, unsigned char node[IPX_NODE_LEN]);
void
ipx_assign_node(IPXNode dest, CIPXNode src);
int
ipx_node_equal(CIPXNode n1, CIPXNode n2);
#ifdef NCP_IPX_SUPPORT
void
ipx_print_saddr(struct sockaddr_ipx *sipx);
void
ipx_fprint_saddr(FILE * file, struct sockaddr_ipx *sipx);
int
ipx_sscanf_saddr(char* buf, struct sockaddr_ipx* sipx);
#endif
#ifdef __cplusplus
}
#endif
#endif /* _IPXLIB_H */

View File

@@ -0,0 +1,7 @@
#ifndef _KERNEL_FS_H
#define _KERNEL_FS_H
@ncp_sys_mount_h@
@ncp_linux_fs_h@
#endif

View File

@@ -0,0 +1,6 @@
#ifndef _KERNEL_IF_H
#define _KERNEL_IF_H
@ncp_net_if_h@
#endif

View File

@@ -0,0 +1,25 @@
#ifndef _KERNEL_IPX_H
#define _KERNEL_IPX_H
#include <ncp/ext/socket.h>
@ncp_ipx_headers_1@
@ncp_ipx_headers_2@
@ncp_ipx_defsiocprotoprivate@
#undef SIOCPROTOPRIVATE
#define SIOCPROTOPRIVATE 0x89E0
#endif
@ncp_ipx_defsiocaipx@
#undef SIOCAIPXITFCRT
#undef SIOCAIPXPRISLT
#undef SIOCIPXCFGDATA
#define SIOCAIPXITFCRT (SIOCPROTOPRIVATE)
#define SIOCAIPXPRISLT (SIOCPROTOPRIVATE+1)
#define SIOCIPXCFGDATA (SIOCPROTOPRIVATE+2)
#endif
#ifndef IPXPROTO_IPX
#define IPXPROTO_IPX (PF_IPX)
#endif
#endif

296
include/ncp/kernel/ncp.h Normal file
View File

@@ -0,0 +1,296 @@
/*
ncp.h
Copyright (C) 1995 by Volker Lendecke
Copyright (C) 1996 J.F. Chadima
Copyright (C) 1997, 1998, 1999 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
0.00 1995 Volker Lendecke
Initial revision.
0.01 1996 J.F. Chadima
Modified for sparc.
0.02 1998 Petr Vandrovec <vandrove@vc.cvut.cz>
New flags...
1.00 1999, November 20 Petr Vandrovec <vandrove@vc.cvut.cz>
Added license.
1.01 2001, November 4 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NW_NS_LONG definition.
Added couple of SWIG fixes.
*/
#ifndef _LINUX_NCP_H
#define _LINUX_NCP_H
#include <ncp/kernel/types.h>
#define NCP_PTYPE (0x11)
#define NCP_PORT (0x0451)
#define NCP_ALLOC_SLOT_REQUEST (0x1111)
#define NCP_REQUEST (0x2222)
#define NCP_DEALLOC_SLOT_REQUEST (0x5555)
struct ncp_request_header {
u_int16_t type __attribute__((packed));
u_int8_t sequence __attribute__((packed));
u_int8_t conn_low __attribute__((packed));
u_int8_t task __attribute__((packed));
u_int8_t conn_high __attribute__((packed));
u_int8_t function __attribute__((packed));
u_int8_t data[0] __attribute__((packed));
};
#define NCP_REPLY (0x3333)
#define NCP_POSITIVE_ACK (0x9999)
struct ncp_reply_header {
u_int16_t type __attribute__((packed));
u_int8_t sequence __attribute__((packed));
u_int8_t conn_low __attribute__((packed));
u_int8_t task __attribute__((packed));
u_int8_t conn_high __attribute__((packed));
u_int8_t completion_code __attribute__((packed));
u_int8_t connection_state __attribute__((packed));
u_int8_t data[0] __attribute__((packed));
};
#define NCP_VOLNAME_LEN (16)
#define NCP_NUMBER_OF_VOLUMES (64)
#ifdef SWIG
struct ncp_volume_info {
u_int32_t total_blocks;
u_int32_t free_blocks;
u_int32_t purgeable_blocks;
u_int32_t not_yet_purgeable_blocks;
u_int32_t total_dir_entries;
u_int32_t available_dir_entries;
u_int8_t sectors_per_block;
fixedCharArray volume_name[NCP_VOLNAME_LEN + 1];
};
#else
struct ncp_volume_info {
u_int32_t total_blocks;
u_int32_t free_blocks;
u_int32_t purgeable_blocks;
u_int32_t not_yet_purgeable_blocks;
u_int32_t total_dir_entries;
u_int32_t available_dir_entries;
u_int8_t sectors_per_block;
char volume_name[NCP_VOLNAME_LEN + 1];
};
#endif
#define NCP_FILE_ID_LEN 6
/* Defines for Name Spaces */
#define NW_NS_DOS 0
#define NW_NS_MAC 1
#define NW_NS_NFS 2
#define NW_NS_FTAM 3
#define NW_NS_OS2 4
#define NW_NS_LONG NW_NS_OS2
#define RIM_NAME 0x00000001
#define RIM_SPACE_ALLOCATED 0x00000002
#define RIM_ATTRIBUTES 0x00000004
#define RIM_DATA_SIZE 0x00000008
#define RIM_TOTAL_SIZE 0x00000010
#define RIM_EXT_ATTR_INFO 0x00000020
#define RIM_ARCHIVE 0x00000040
#define RIM_MODIFY 0x00000080
#define RIM_CREATION 0x00000100
#define RIM_OWNING_NAMESPACE 0x00000200
#define RIM_DIRECTORY 0x00000400
#define RIM_RIGHTS 0x00000800
#define RIM_ALL 0x00000FFF
#define RIM_REFERENCE_ID 0x00001000
#define RIM_NS_ATTRIBUTES 0x00002000
#define RIM_DATASTREAM_SIZES 0x00004000
#define RIM_DATASTREAM_LOGICALS 0x00008000
#define RIM_UPDATE_TIME 0x00010000
#define RIM_DOS_NAME 0x00020000
#define RIM_FLUSH_TIME 0x00040000
#define RIM_PARENT_BASE_ID 0x00080000
#define RIM_MAC_FINDER_INFO 0x00100000
#define RIM_SIBLING_COUNT 0x00200000
#define RIM_EFFECTIVE_RIGHTS 0x00400000
#define RIM_MAC_TIMES 0x00800000
#define RIM_LAST_ACCESS_TIME 0x01000000
#ifdef MAKE_NCPLIB
#define RIM_UNKNOWN25 0x02000000 /* fixme! */
#endif
#define RIM_SIZE64 0x04000000
#define RIM_NSS_LARGE_SIZES 0x40000000
#define RIM_COMPRESSED_INFO 0x80000000U
/* open/create modes */
#define OC_MODE_OPEN 0x01
#define OC_MODE_TRUNCATE 0x02
#define OC_MODE_REPLACE 0x02
#define OC_MODE_CREATE 0x08
#define OC_MODE_OPEN_64BIT_ACCESS 0x20
#define OC_MODE_READONLY_OK 0x40
#define OC_MODE_CALLBACK 0x80
/* open/create results */
#define OC_ACTION_NONE 0x00
#define OC_ACTION_OPEN 0x01
#define OC_ACTION_CREATE 0x02
#define OC_ACTION_TRUNCATE 0x04
#define OC_ACTION_REPLACE 0x04
#define OC_ACTION_COMPRESSED 0x08
#define OC_ACTION_READONLY 0x80
/* access rights attributes */
#ifndef AR_READ_ONLY
#define AR_READ_ONLY 0x0001
#define AR_WRITE_ONLY 0x0002
#define AR_DENY_READ 0x0004
#define AR_DENY_WRITE 0x0008
#define AR_COMPATIBILITY 0x0010
#define AR_WRITE_THROUGH 0x0040
#define AR_OPEN_COMPRESSED 0x0100
#endif
#ifdef SWIG
struct nw_info_struct {
u_int32_t spaceAlloc __attribute__((packed));
u_int32_t attributes __attribute__((packed));
u_int16_t flags __attribute__((packed));
u_int32_t dataStreamSize __attribute__((packed));
u_int32_t totalStreamSize __attribute__((packed));
u_int16_t numberOfStreams __attribute__((packed));
u_int16_t creationTime __attribute__((packed));
u_int16_t creationDate __attribute__((packed));
u_int32_t creatorID __attribute__((packed));
u_int16_t modifyTime __attribute__((packed));
u_int16_t modifyDate __attribute__((packed));
u_int32_t modifierID __attribute__((packed));
u_int16_t lastAccessDate __attribute__((packed));
u_int16_t archiveTime __attribute__((packed));
u_int16_t archiveDate __attribute__((packed));
u_int32_t archiverID __attribute__((packed));
u_int16_t inheritedRightsMask __attribute__((packed));
u_int32_t dirEntNum __attribute__((packed));
u_int32_t DosDirNum __attribute__((packed));
u_int32_t volNumber __attribute__((packed));
u_int32_t EADataSize __attribute__((packed));
u_int32_t EAKeyCount __attribute__((packed));
u_int32_t EAKeySize __attribute__((packed));
u_int32_t NSCreator __attribute__((packed));
%pragma(swig) readonly
u_int8_t nameLen __attribute__((packed));
%pragma(swig) readwrite
byteLenPrefixCharArray entryName[255] __attribute__((packed));
};
#else
struct nw_info_struct {
u_int32_t spaceAlloc __attribute__((packed));
u_int32_t attributes __attribute__((packed));
u_int16_t flags __attribute__((packed));
u_int32_t dataStreamSize __attribute__((packed));
u_int32_t totalStreamSize __attribute__((packed));
u_int16_t numberOfStreams __attribute__((packed));
u_int16_t creationTime __attribute__((packed));
u_int16_t creationDate __attribute__((packed));
u_int32_t creatorID __attribute__((packed));
u_int16_t modifyTime __attribute__((packed));
u_int16_t modifyDate __attribute__((packed));
u_int32_t modifierID __attribute__((packed));
u_int16_t lastAccessDate __attribute__((packed));
u_int16_t archiveTime __attribute__((packed));
u_int16_t archiveDate __attribute__((packed));
u_int32_t archiverID __attribute__((packed));
u_int16_t inheritedRightsMask __attribute__((packed));
u_int32_t dirEntNum __attribute__((packed));
u_int32_t DosDirNum __attribute__((packed));
u_int32_t volNumber __attribute__((packed));
u_int32_t EADataSize __attribute__((packed));
u_int32_t EAKeyCount __attribute__((packed));
u_int32_t EAKeySize __attribute__((packed));
u_int32_t NSCreator __attribute__((packed));
u_int8_t nameLen __attribute__((packed));
u_int8_t entryName[256] __attribute__((packed));
};
#endif
/* modify mask - use with MODIFY_DOS_INFO structure */
#define DM_ATTRIBUTES (0x00000002L)
#define DM_CREATE_DATE (0x00000004L)
#define DM_CREATE_TIME (0x00000008L)
#define DM_CREATOR_ID (0x00000010L)
#define DM_ARCHIVE_DATE (0x00000020L)
#define DM_ARCHIVE_TIME (0x00000040L)
#define DM_ARCHIVER_ID (0x00000080L)
#define DM_MODIFY_DATE (0x00000100L)
#define DM_MODIFY_TIME (0x00000200L)
#define DM_MODIFIER_ID (0x00000400L)
#define DM_LAST_ACCESS_DATE (0x00000800L)
#define DM_INHERITED_RIGHTS_MASK (0x00001000L)
#define DM_MAXIMUM_SPACE (0x00002000L)
struct nw_modify_dos_info {
u_int32_t attributes __attribute__((packed));
u_int16_t creationDate __attribute__((packed));
u_int16_t creationTime __attribute__((packed));
u_int32_t creatorID __attribute__((packed));
u_int16_t modifyDate __attribute__((packed));
u_int16_t modifyTime __attribute__((packed));
u_int32_t modifierID __attribute__((packed));
u_int16_t archiveDate __attribute__((packed));
u_int16_t archiveTime __attribute__((packed));
u_int32_t archiverID __attribute__((packed));
u_int16_t lastAccessDate __attribute__((packed));
u_int16_t inheritanceGrantMask __attribute__((packed));
u_int16_t inheritanceRevokeMask __attribute__((packed));
u_int32_t maximumSpace __attribute__((packed));
};
#ifdef SWIG
struct nw_file_info {
struct nw_info_struct i;
int opened;
int access;
u_int32_t server_file_handle __attribute__((packed));
u_int8_t open_create_action __attribute__((packed));
fixedArray file_handle[6] __attribute__((packed));
};
#else
struct nw_file_info {
struct nw_info_struct i;
int opened;
int access;
u_int32_t server_file_handle __attribute__((packed));
u_int8_t open_create_action __attribute__((packed));
u_int8_t file_handle[6] __attribute__((packed));
};
#endif
struct nw_search_sequence {
u_int8_t volNumber __attribute__((packed));
u_int32_t dirBase __attribute__((packed));
u_int32_t sequence __attribute__((packed));
};
#endif /* _LINUX_NCP_H */

199
include/ncp/kernel/ncp_fs.h Normal file
View File

@@ -0,0 +1,199 @@
/*
ncp_fs.h
Copyright (C) 1995, 1996 by Volker Lendecke
Copyright (C) 1998, 1999 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
0.00 1995 Volker Lendecke
Initial revision.
0.01 1998 Petr Vandrovec <vandrove@vc.cvut.cz>
New ioctl: LOCKUNLOCK, GETROOT, SETROOT, GETOBJECTNAME,
SETOBJECTNAME, GETPRIVATEDATA, SETPRIVATEDATA
0.02 1998 Wolfram Pienkoss <wp@bszh.de>
New ioctl: GETCHARSETS, SETCHARSETS
0.03 1999, September Petr Vandrovec <vandrove@vc.cvut.cz>
New ioctl: GETDENTRYTTL, SETDENTRYTTL
1.00 1999, November 20 Petr Vandrovec <vandrove@vc.cvut.cz>
Added license.
*/
/* TODO: These are all internal to ncpfs... Do something with them :-) */
#ifndef _KERNEL_NCP_FS_H
#define _KERNEL_NCP_FS_H
#include <ncp/kernel/fs.h>
#include <ncp/kernel/types.h>
#include <netinet/in.h>
#include <ncp/kernel/ipx.h>
struct ncp_sign_init
{
char sign_root[8];
char sign_last[16];
};
union ncp_sockaddr {
struct sockaddr any;
#ifdef NCP_IPX_SUPPORT
struct sockaddr_ipx ipx;
#endif
#ifdef NCP_IN_SUPPORT
struct sockaddr_in inet;
#endif
};
#ifdef NCP_KERNEL_NCPFS_AVAILABLE
/*
* ioctl commands
*/
struct ncp_ioctl_request {
unsigned int function;
unsigned int size;
char *data;
};
struct ncp_fs_info {
int version;
union ncp_sockaddr addr;
__kerXX_uid_t mounted_uid;
int connection; /* Connection number the server assigned us */
int buffer_size; /* The negotiated buffer size, to be
used for read/write requests! */
int volume_number;
u_int32_t directory_id;
};
struct ncp_lock_ioctl
{
#define NCP_LOCK_LOG 0
#define NCP_LOCK_SH 1
#define NCP_LOCK_EX 2
#define NCP_LOCK_CLEAR 256
int cmd;
int origin;
unsigned int offset;
unsigned int length;
#define NCP_LOCK_DEFAULT_TIMEOUT 18
#define NCP_LOCK_MAX_TIMEOUT 180
int timeout;
};
struct ncp_setroot_ioctl
{
int volNumber;
int name_space;
u_int32_t dirEntNum;
};
struct ncp_objectname_ioctl
{
#define NCP_AUTH_NONE 0x00
#define NCP_AUTH_BIND 0x31
#define NCP_AUTH_NDS 0x32
int auth_type;
size_t object_name_len;
void* object_name;
};
struct ncp_privatedata_ioctl
{
size_t len;
void* data; /* ~1000 for NDS */
};
/* NLS charsets by ioctl */
#define NCP_IOCSNAME_LEN 20
struct ncp_nls_ioctl_old
{
int codepage;
unsigned char iocharset[NCP_IOCSNAME_LEN+1];
};
struct ncp_nls_ioctl
{
unsigned char codepage[NCP_IOCSNAME_LEN+1];
unsigned char iocharset[NCP_IOCSNAME_LEN+1];
};
#define NCP_IOC_NCPREQUEST _IOR('n', 1, struct ncp_ioctl_request)
#define NCP_IOC_GETMOUNTUID _IOW('n', 2, __kernel_uid_t)
#define NCP_IOC_GETMOUNTUID2 _IOW('n', 2, unsigned long)
#define NCP_IOC_CONN_LOGGED_IN _IO('n', 3)
#define NCP_GET_FS_INFO_VERSION (1)
#define NCP_IOC_GET_FS_INFO _IOWR('n', 4, struct ncp_fs_info)
#define NCP_IOC_SIGN_INIT _IOR('n', 5, struct ncp_sign_init)
#define NCP_IOC_SIGN_WANTED _IOR('n', 6, int)
#define NCP_IOC_SET_SIGN_WANTED _IOW('n', 6, int)
#define NCP_IOC_LOCKUNLOCK _IOR('n', 7, struct ncp_lock_ioctl)
#define NCP_IOC_GETROOT _IOW('n', 8, struct ncp_setroot_ioctl)
#define NCP_IOC_SETROOT _IOR('n', 8, struct ncp_setroot_ioctl)
#define NCP_IOC_GETOBJECTNAME _IOWR('n', 9, struct ncp_objectname_ioctl)
#define NCP_IOC_SETOBJECTNAME _IOR('n', 9, struct ncp_objectname_ioctl)
#define NCP_IOC_GETPRIVATEDATA _IOWR('n', 10, struct ncp_privatedata_ioctl)
#define NCP_IOC_SETPRIVATEDATA _IOR('n', 10, struct ncp_privatedata_ioctl)
#define NCP_IOC_GETCHARSETS _IOWR('n', 11, struct ncp_nls_ioctl)
#define NCP_IOC_SETCHARSETS _IOR('n', 11, struct ncp_nls_ioctl)
/* never released to Linus, will wanish shortly */
#define NCP_IOC_GETCHARSETS_OLD _IOWR('n', 11, struct ncp_nls_ioctl_old)
#define NCP_IOC_SETCHARSETS_OLD _IOR('n', 11, struct ncp_nls_ioctl_old)
#define NCP_IOC_GETDENTRYTTL _IOW('n', 12, u_int32_t)
#define NCP_IOC_SETDENTRYTTL _IOR('n', 12, u_int32_t)
#else
struct ncp_fs_info {
int version;
union ncp_sockaddr addr;
uid_t mounted_uid;
int connection; /* Connection number the server assigned us */
size_t buffer_size; /* The negotiated buffer size, to be
used for read/write requests! */
int volume_number;
u_int32_t directory_id;
};
#endif /* NCP_KERNEL_NCPFS_AVAILABLE */
/*
* The packet size to allocate. One page should be enough.
*/
#define NCP_PACKET_SIZE 65536
#define NCP_MAXPATHLEN 255
#define NCP_MAXNAMELEN 14
#endif /* _LINUX_NCP_FS_H */

View File

@@ -0,0 +1,7 @@
#ifndef __KERNEL_ROUTE_H__
#define __KERNEL_ROUTE_H__
@ncp_net_route_h@
#endif /* __KERNEL_ROUTE_H__ */

View File

@@ -0,0 +1,55 @@
#ifndef __KERNEL_TYPES_H__
#define __KERNEL_TYPES_H__
#include <sys/types.h>
@ncp_sys_select_h@
@ncp_in_support@
@ncp_ipx_support@
/* FIXME: What about configure?! */
#ifndef __BIT_TYPES_DEFINED__
#define __BIT_TYPES_DEFINED__ 1
/* AIX4.3.x has these types, but does not define
BIT_TYPES_DEFINED... */
#ifndef _H_INTTYPES
typedef unsigned char u_int8_t;
typedef unsigned short int u_int16_t;
typedef unsigned int u_int32_t;
typedef unsigned long long u_int64_t;
typedef signed char int8_t;
typedef signed short int int16_t;
typedef signed int int32_t;
typedef signed long long int64_t;
#endif
#endif /* __BIT_TYPES_DEFINED__ */
#if @USE_KERNEL@
#define NCP_KERNEL_NCPFS_AVAILABLE
typedef u_int16_t __kerXX_uid_t;
#include <linux/posix_types.h>
typedef __kernel_pid_t __ker20_pid_t;
typedef __kernel_uid_t __ker20_uid_t;
typedef __kernel_gid_t __ker20_gid_t;
typedef __kernel_mode_t __ker20_mode_t;
typedef __kernel_pid_t __ker21_pid_t;
typedef __kernel_uid_t __ker21_uid_t;
typedef __kernel_gid_t __ker21_gid_t;
typedef __kernel_mode_t __ker21_mode_t;
#else
#undef NCP_KERNEL_NCPFS_AVAILABLE
#endif /* compiling on linux kernel with ncp support */
#endif /* __KERNEL_TYPES_H__ */

235
include/ncp/ncp.h Normal file
View File

@@ -0,0 +1,235 @@
/*
ncp.h
Copyright (C) 1995 by Volker Lendecke
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
0.00 1995 Volker Lendecke
Initial revision.
0.01 1996 J.F. Chadima
Modified for sparc.
1.00 2001, March 4 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NCP_BINDERY_TREE.
*/
#ifndef _NCP_H
#define _NCP_H
#include <ncp/kernel/types.h>
#include <ncp/kernel/ipx.h>
#include <ncp/kernel/ncp.h>
#include <ncp/kernel/ncp_fs.h>
typedef u_int16_t NWObjectType;
typedef u_int32_t NWObjectID;
#define NCP_BINDERY_WILD (0xffff)
#define NCP_BINDERY_UNKNOWN (0x0000)
#define NCP_BINDERY_USER (0x0001)
#define NCP_BINDERY_UGROUP (0x0002) /* User Group */
#define NCP_BINDERY_PQUEUE (0x0003) /* Print Queue */
#define NCP_BINDERY_FSERVER (0x0004) /* File Server */
#define NCP_BINDERY_JSERVER (0x0005) /* Job Server */
#define NCP_BINDERY_GATEWAY (0x0006)
#define NCP_BINDERY_PSERVER (0x0007) /* Print Server */
#define NCP_BINDERY_ARCHQ (0x0008) /* Archive Queue */
#define NCP_BINDERY_ARCHSERVER (0x0009) /* Archive Server */
#define NCP_BINDERY_JQUEUE (0x000a) /* Job Queue */
#define NCP_BINDERY_ADMIN (0x000b)
#define NCP_BINDERY_BSERVER (0x0026) /* Bridge Server */
#define NCP_BINDERY_ADVPSERVER (0x0047) /* Advertising Print Server */
#define NCP_BINDERY_TREE (0x0278) /* NDS Tree */
#define NCP_BINDERY_NTSERVER (0x0640) /* NT Server */
#define NCP_BINDERY_ID_WILDCARD (0xffffffff)
#define NCP_BINDERY_NAME_LEN (48)
#ifndef IPX_NODE_LEN
#define IPX_NODE_LEN (6)
#endif
struct ncp_bindery_object {
NWObjectID object_id;
NWObjectType object_type;
#ifdef SWIG
fixedCharArray object_name[NCP_BINDERY_NAME_LEN];
#else
u_int8_t object_name[NCP_BINDERY_NAME_LEN];
#endif
u_int8_t object_flags;
u_int8_t object_security;
u_int8_t object_has_prop;
};
struct nw_property {
#ifdef SWIG
fixedArray value[128];
#else
u_int8_t value[128];
#endif
u_int8_t more_flag;
u_int8_t property_flag;
};
struct prop_net_address {
u_int32_t network __attribute__((packed));
#ifdef SWIG
fixedArray node[IPX_NODE_LEN];
#else
u_int8_t node[IPX_NODE_LEN] __attribute__((packed));
#endif
u_int16_t port __attribute__((packed));
};
struct ncp_filesearch_info {
u_int8_t volume_number;
u_int16_t directory_id;
u_int16_t sequence_no;
u_int8_t access_rights;
};
#define NCP_MAX_FILENAME (14)
struct ncp_file_info {
#ifdef SWIG
fixedArray file_id[NCP_FILE_ID_LEN];
fixedCharArray file_name[NCP_MAX_FILENAME + 1];
#else
u_int8_t file_id[NCP_FILE_ID_LEN];
char file_name[NCP_MAX_FILENAME + 1];
#endif
u_int8_t file_attributes;
u_int8_t file_mode;
u_int32_t file_length;
u_int16_t creation_date;
u_int16_t access_date;
u_int16_t update_date;
u_int16_t update_time;
};
#ifdef SWIG
struct nw_queue_job_entry {
u_int16_t InUse __attribute__((packed));
u_int32_t prev __attribute__((packed));
u_int32_t next __attribute__((packed));
u_int32_t ClientStation __attribute__((packed));
u_int32_t ClientTask __attribute__((packed));
u_int32_t ClientObjectID __attribute__((packed));
u_int32_t TargetServerID __attribute__((packed));
fixedArray TargetExecTime[6] __attribute__((packed));
fixedArray JobEntryTime[6] __attribute__((packed));
u_int32_t JobNumber __attribute__((packed));
u_int16_t JobType __attribute__((packed));
u_int16_t JobPosition __attribute__((packed));
u_int16_t JobControlFlags __attribute__((packed));
u_int8_t FileNameLen __attribute__((packed));
byteLenPrefixCharArray JobFileName[13] __attribute__((packed));
u_int32_t JobFileHandle __attribute__((packed));
u_int32_t ServerStation __attribute__((packed));
u_int32_t ServerTaskNumber __attribute__((packed));
u_int32_t ServerObjectID __attribute__((packed));
fixedCharArray JobTextDescription[50] __attribute__((packed));
fixedArray ClientRecordArea[152] __attribute__((packed));
};
struct queue_job {
struct nw_queue_job_entry j;
fixedArray file_handle[6];
};
#else
struct nw_queue_job_entry {
u_int16_t InUse __attribute__((packed));
u_int32_t prev __attribute__((packed));
u_int32_t next __attribute__((packed));
u_int32_t ClientStation __attribute__((packed));
u_int32_t ClientTask __attribute__((packed));
u_int32_t ClientObjectID __attribute__((packed));
u_int32_t TargetServerID __attribute__((packed));
u_int8_t TargetExecTime[6] __attribute__((packed));
u_int8_t JobEntryTime[6] __attribute__((packed));
u_int32_t JobNumber __attribute__((packed));
u_int16_t JobType __attribute__((packed));
u_int16_t JobPosition __attribute__((packed));
u_int16_t JobControlFlags __attribute__((packed));
u_int8_t FileNameLen __attribute__((packed));
char JobFileName[13] __attribute__((packed));
u_int32_t JobFileHandle __attribute__((packed));
u_int32_t ServerStation __attribute__((packed));
u_int32_t ServerTaskNumber __attribute__((packed));
u_int32_t ServerObjectID __attribute__((packed));
char JobTextDescription[50] __attribute__((packed));
char ClientRecordArea[152] __attribute__((packed));
};
struct queue_job {
struct nw_queue_job_entry j;
u_int8_t file_handle[6];
};
#endif
#define QJE_OPER_HOLD 0x80
#define QJE_USER_HOLD 0x40
#define QJE_ENTRYOPEN 0x20
#define QJE_SERV_RESTART 0x10
#define QJE_SERV_AUTO 0x08
/* ClientRecordArea for print jobs */
#define KEEP_ON 0x0400
#define NO_FORM_FEED 0x0800
#define NOTIFICATION 0x1000
#define DELETE_FILE 0x2000
#define EXPAND_TABS 0x4000
#define PRINT_BANNER 0x8000
#ifdef SWIG
struct print_job_record {
u_int8_t Version __attribute__((packed));
u_int8_t TabSize __attribute__((packed));
u_int16_t Copies __attribute__((packed));
u_int16_t CtrlFlags __attribute__((packed));
u_int16_t Lines __attribute__((packed));
u_int16_t Rows __attribute__((packed));
fixedCharArray FormName[16] __attribute__((packed));
fixedArray Reserved[6] __attribute__((packed));
fixedCharArray BannerName[13] __attribute__((packed));
fixedCharArray FnameBanner[13] __attribute__((packed));
fixedCharArray FnameHeader[14] __attribute__((packed));
fixedCharArray Path[80] __attribute__((packed));
};
#else
struct print_job_record {
u_int8_t Version __attribute__((packed));
u_int8_t TabSize __attribute__((packed));
u_int16_t Copies __attribute__((packed));
u_int16_t CtrlFlags __attribute__((packed));
u_int16_t Lines __attribute__((packed));
u_int16_t Rows __attribute__((packed));
char FormName[16] __attribute__((packed));
u_int8_t Reserved[6] __attribute__((packed));
char BannerName[13] __attribute__((packed));
char FnameBanner[13] __attribute__((packed));
char FnameHeader[14] __attribute__((packed));
char Path[80] __attribute__((packed));
};
#endif
#endif /* _NCP_H */

1639
include/ncp/ncplib.h Normal file

File diff suppressed because it is too large Load Diff

101
include/ncp/ndslib.h Normal file
View File

@@ -0,0 +1,101 @@
/*
NDS client for ncpfs
Copyright (C) 1997 Arne de Bruijn
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _NDSLIB_H_
#define _NDSLIB_H_
#include <ncp/ncplib.h>
#define ERR_NOT_ENOUGH_MEMORY -301
#define ERR_BAD_KEY -302
#define ERR_BAD_CONTEXT -303
#define ERR_BUFFER_FULL -304
#define ERR_BAD_SYNTAX -306
#define ERR_BUFFER_EMPTY -307
#define ERR_BAD_VERB -308
#define ERR_EXPECTED_IDENTIFIER -309
#define ERR_ATTR_TYPE_EXPECTED -311
#define ERR_ATTR_TYPE_NOT_EXPECTED -312
#define ERR_FILTER_TREE_EMPTY -313
#define ERR_INVALID_OBJECT_NAME -314
#define ERR_EXPECTED_RDN_DELIMITER -315
#define ERR_TOO_MANY_TOKENS -316
#define ERR_INCONSISTENT_MULTIAVA -317
#define ERR_COUNTRY_NAME_TOO_LONG -318
#define ERR_SYSTEM_ERROR -319
#define ERR_INVALID_HANDLE -322
#define ERR_BUFFER_ZERO_LENGTH -323
#define ERR_CONTEXT_CREATION -328
#define ERR_INVALID_SERVER_RESPONSE -330
#define ERR_NULL_POINTER -331
#define ERR_NO_CONNECTION -333
#define ERR_RDN_TOO_LONG -334
#define ERR_DUPLICATE_TYPE -335
#define ERR_NOT_LOGGED_IN -337
#define ERR_INVALID_PASSWORD_CHARS -338
#define ERR_TRANSPORT -340
#define ERR_NO_SUCH_SYNTAX -341
#define ERR_INVALID_DS_NAME -342
#define ERR_UNICODE_FILE_NOT_FOUND -348
#define ERR_DN_TOO_LONG -353
#define ERR_RENAME_NOT_ALLOWED -354
#define ERR_NO_SUCH_ENTRY -601
#define ERR_NO_SUCH_ATTRIBUTE -603
#define ERR_TRANSPORT_FAILURE -625
#define ERR_ALL_REFERRALS_FAILED -626
#define ERR_NO_REFERRALS -634
#define ERR_REMOTE_FAILURE -635
#define ERR_UNREACHABLE_SERVER -636
#define ERR_INVALID_REQUEST -641
#define ERR_CRUCIAL_REPLICA -656
#define ERR_TIME_NOT_SYNCHRONIZED -659
#define ERR_FAILED_AUTHENTICATION -669
#define ERR_ALIAS_OF_AN_ALIAS -681
#define ERR_INVALID_API_VERSION -683
#define ERR_SECURE_NCP_VIOLATION -684
#define ERR_OBSOLETE_API -700
#define ERR_INVALID_SIGNATURE -707
#ifdef NCP_OBSOLETE
#include <ncp/obsolete/o_ndslib.h>
#endif
#endif /* ifndef _NDSLIB_H_ */

653
include/ncp/nwcalls.h Normal file
View File

@@ -0,0 +1,653 @@
/*
nwcalls.h
Copyright (C) 1998-2001 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
0.00 1998 Petr Vandrovec <vandrove@vc.cvut.cz>
Initial revision.
1.00 1999, November 20 Petr Vandrovec <vandrove@vc.cvut.cz>
Added license.
1.01 2000, June 1 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWGetBinderyAccessLevel.
1.02 2001, January 7 Patrick Pollet <patrick.pollet@insa-lyon.fr>
Added NWCC_INFO_TREE_NAME, NWCCOpenConnByName and
NWCC_NAME_FORMAT_*.
1.03 2001, January 8 Patrick Pollet <patrick.pollet@insa-lyon.fr>
Added disk retrictions API calls.
1.04 2001, January 9 Patrick Pollet <patrick.pollet@insa-lyon.fr>
Added semaphores API calls.
1.05 2001, January 27 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWScanOpenFilesByConn2, ncp_ns_scan_connections_using_file.
Added NWGetNumberNCPExtensions, NWScanNCPExtensions.
1.06 2001, February 7 Patrick Pollet <patrick.pollet@insa-lyon.fr>
Added Broadcast API calls & defines
1.07 2001, February 4 Petr Vandrovec <vandrove@vc.cvut.cz>
Added ncp_ns_scan_physical_locks_by_file.
1.08 2001, February 10 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWGetVolumeName to header.
1.09 2001, February 25 Patrick Pollet <patrick.pollet@insa-lyon.fr>
Added NWIsObjectInSet.
1.10 2001, March 4 Petr Vandrovec <vandrove@vc.cvut.cz>
Added OT_TREE_NAME.
1.11 2001, June 3 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWGetDirSpaceLimitList, NWGetDirSpaceLimitList2,
ncp_get_directory_info.
Added NW_LIMIT_LIST, NW_MAX_VOLUME_NAME_LEN, DIR_SPACE_INFO.
1.12 2001, July 16 Petr Vandrovec <vandrove@vc.cvut.cz>
Added __NWDisableBroadcasts and __NWEnableBroadcasts.
1.13 2001, September 15 Petr Vandrovec <vandrove@vc.cvut.cz>
Fixes for SWIG. Unwind nested structs so that names are defined
in this header and not by SWIG.
1.14 2001, December 12 Hans Grobler <grobh@sun.ac.za>
Added TR_ALL define.
1.15 2001, December 30 Petr Vandrovec <vandrove@vc.cvut.cz>
Updates for SWIG.
*/
#ifndef __NWCALLS_H__
#define __NWCALLS_H__
#include <ncp/ncplib.h>
#include <ncp/ext/stdint.h>
typedef unsigned int nuint;
typedef u_int8_t nuint8;
typedef u_int16_t nuint16;
typedef u_int32_t nuint32;
typedef int nint;
typedef int16_t nint16;
typedef int32_t nint32;
typedef uint_least16_t nuint16a;
typedef uint_least32_t nuint32a;
typedef int_least16_t nint16a;
typedef int_least32_t nint32a;
typedef u_int8_t nbool8;
typedef nuint32a nflag32;
typedef struct nw_info_struct NW_ENTRY_INFO;
typedef nuint NWCONN_NUM; /* nuint16 ? */
#define nameLength nameLen
union NW_FRAGMENT_fragAddr {
void* rw;
const void* ro;
};
typedef struct {
union NW_FRAGMENT_fragAddr fragAddr;
#define fragAddress fragAddr.rw
size_t fragSize;
} NW_FRAGMENT;
/* including null byte... */
#define NW_MAX_VOLUME_NAME_LEN 17
#define TR_READ NCP_PERM_READ
#define TR_WRITE NCP_PERM_WRITE
#define TR_CREATE NCP_PERM_CREATE
#define TR_ERASE NCP_PERM_DELETE
#define TR_ACCESS_CTRL NCP_PERM_OWNER
#define TR_SEARCH NCP_PERM_SEARCH
#define TR_MODIFY NCP_PERM_MODIFY
#define TR_SUPERVISOR NCP_PERM_SUPER
#define TR_ALL NCP_PERM_ALL
#define OT_USER NCP_BINDERY_USER
#define OT_USER_GROUP NCP_BINDERY_UGROUP
#define OT_FILE_SERVER NCP_BINDERY_FSERVER
#define OT_TREE_NAME NCP_BINDERY_TREE
#define IM_NAME RIM_NAME
#define IM_DIRECTORY RIM_DIRECTORY
#define IM_ALL RIM_ALL
#define A_READ_ONLY 0x00000001 /* aRDONLY... but it is htonl-ed... fixme... */
#define A_HIDDEN 0x00000002
#define A_SYSTEM 0x00000004
#define A_EXECUTE_ONLY 0x00000008
#define A_DIRECTORY 0x00000010
#define A_NEEDS_ARCHIVED 0x00000020
#define A_EXECUTE_CONFIRM 0x00000040 /* does not occur in flags */
#define A_SHAREABLE 0x00000080
#define A_SEARCH_MODE 0x00000700
#define A_DONT_SUBALLOCATE 0x00000800
#define A_TRANSACTIONAL 0x00001000
#define A_INDEXED 0x00002000
#define A_READ_AUDIT 0x00004000
#define A_WRITE_AUDIT 0x00008000
#define A_IMMEDIATE_PURGE 0x00010000
#define A_RENAME_INHIBIT 0x00020000
#define A_DELETE_INHIBIT 0x00040000
#define A_COPY_INHIBIT 0x00080000
#define A_FILE_AUDITING 0x00100000
/* reserved 0x00200000 */
#define A_FILE_MIGRATED 0x00400000
#define A_DONT_MIGRATE 0x00800000
#define A_DATA_MIGRATION_SAVE_KEY \
0x01000000
#define A_IMMEDIATE_COMPRESS 0x02000000
#define A_FILE_COMPRESSED 0x04000000
#define A_DONT_COMPRESS 0x08000000
#define A_CREATE_HARDLINK 0x10000000
#define A_CANT_COMPRESS 0x20000000
#define A_ATTRIBUTES_ARCHIVE 0x40000000
/* reserved 0x80000000 */
#define NWCC_RESERVED 0x00000000
/* note that NWCC_TRAN_TYPE_x must match NT_x */
/* in past NWCC_TRAN_TYPE_IPX was equal to 1, but no API
returned it, they returned NT_IPX instead */
#define NWCC_TRAN_TYPE_IPX 0x00000000
#define NWCC_TRAN_TYPE_IPX_old 0x00000001
#define NWCC_TRAN_TYPE_UDP 0x00000008
#define NWCC_TRAN_TYPE_TCP 0x00000009
#define NWCC_TRAN_TYPE_WILD 0x00008000
#define NWCC_OPEN_PRIVATE 0x00000004
#define NWCC_OPEN_PUBLIC 0x00000008
#define NWCC_OPEN_NEW_CONN 0x00080000 /* ncpfs specific */
#define NWCC_INFO_AUTHENT_STATE 1
#define NWCC_INFO_BCAST_STATE 2
#define NWCC_INFO_TREE_NAME 4
#define NWCC_INFO_CONN_NUMBER 5
#define NWCC_INFO_USER_ID 6
#define NWCC_INFO_SERVER_NAME 7
#define NWCC_INFO_MAX_PACKET_SIZE 9
#define NWCC_INFO_SERVER_VERSION 12
#define NWCC_INFO_TRAN_ADDR 13
#define NWCC_INFO_USER_NAME 0x4000
#define NWCC_INFO_ROOT_ENTRY 0x4001
#define NWCC_INFO_MOUNT_UID 0x4002
#define NWCC_INFO_SECURITY 0x4003
#define NWCC_INFO_MOUNT_POINT 0x4004
#define NW_MAX_SERVER_NAME_LEN 49
#define NWCC_SECUR_SIGNING_IN_USE 0x0001
#define NWCC_SECUR_LEVEL_CHECKSUM 0x0100
#define NWCC_SECUR_LEVEL_SIGN_HEADERS 0x0200
#define NWCC_SECUR_LEVEL_SIGN_ALL 0x0400
#define NWCC_SECUR_LEVEL_ENCRYPT 0x0800
/* Authentication States */
#define NWCC_AUTHENT_STATE_NONE 0x0000
#define NWCC_AUTHENT_STATE_BIND 0x0001
#define NWCC_AUTHENT_STATE_NDS 0x0002
/* Broadcast States */
#define NWCC_BCAST_PERMIT_ALL 0x0000
#define NWCC_BCAST_PERMIT_SYSTEM 0x0001
#define NWCC_BCAST_PERMIT_NONE 0x0002
#define NWCC_BCAST_PERMIT_POLL 0x0003
/* Name Format types */
#define NWCC_NAME_FORMAT_NDS 0x0001
#define NWCC_NAME_FORMAT_BIND 0x0002
#define NWCC_NAME_FORMAT_NDS_TREE 0x0008
#define NWCC_NAME_FORMAT_WILD 0x8000
typedef struct {
unsigned int major;
unsigned int minor;
unsigned int revision;
} NWCCVersion;
typedef struct {
nuint32 type;
#ifdef SWIG
%pragma(swig) readonly
size_t len;
%pragma(swig) readwrite
NWCCTranAddr_buffer buffer[32];
#else
size_t len;
void* buffer;
#endif
#if defined(SWIG_BUILD)
nuint8 bufferdata[32];
#endif
} NWCCTranAddr;
struct NWCCRootEntry {
NWVOL_NUM volume;
NWDIR_ENTRY dirEnt;
};
#ifdef __cplusplus
extern "C" {
#endif
/* misc */
NWCCODE NWCallsInit(void* __NULL1, void* __NULL2);
NWCCODE NWRequest(NWCONN_HANDLE __conn, nuint, nuint, const NW_FRAGMENT*, nuint, NW_FRAGMENT*);
NWCCODE NWRequestSimple(NWCONN_HANDLE __conn, nuint, const void*, size_t, NW_FRAGMENT*);
/* bindery */
NWCCODE NWGetObjectName(NWCONN_HANDLE __conn, NWObjectID __objectid,
char* __objectname, NWObjectType* __objecttype);
NWCCODE NWGetObjectID(NWCONN_HANDLE __conn, const char* __objectname,
NWObjectType __objecttype, NWObjectID* __objectid);
NWCCODE NWGetBinderyAccessLevel(NWCONN_HANDLE __conn, nuint8* __rights,
NWObjectID* __objectid);
NWCCODE NWLogoutFromFileServer(NWCONN_HANDLE __conn); /* ncplib.c */
NWCCODE NWVerifyObjectPassword(NWCONN_HANDLE __conn, const char* __objectname,
NWObjectType __objecttype, const char* __objectpassword); /* ncplib.c */
/* filesystem */
NWCCODE NWGetNSEntryInfo(NWCONN_HANDLE __conn, nuint __dirhandle,
const char* __path, nuint __srcns, nuint __dstns,
nuint16 __attr, nuint32 __rim, NW_ENTRY_INFO* target);
NWCCODE NWParsePath(const char* __path, char* __server,
NWCONN_HANDLE* __pconn, char* __volume, char* __volpath);
NWCCODE ncp_get_volume_name(NWCONN_HANDLE __conn, NWVOL_NUM __vol, char* __name, size_t __maxlen); /* filemgmt.c */
NWCCODE NWGetVolumeNumber(NWCONN_HANDLE __conn, const char* __name, NWVOL_NUM* __vol);
NWCCODE NWGetVolumeName(NWCONN_HANDLE __conn, NWVOL_NUM __vol, char* __volume);
NWCCODE NWGetNSLoadedList(NWCONN_HANDLE __conn,
NWVOL_NUM __vol,
size_t __maxlen,
nuint8* __nslist,
size_t* __nslen); /* filemgmt.c */
typedef struct {
u_int16_t nextRequest;
u_int16_t openCount;
#ifdef SWIG
fixedArray buffer[512];
#else
u_int8_t buffer[512];
#endif
u_int16_t curRecord;
} OPEN_FILE_CONN_CTRL;
typedef struct {
u_int16_t taskNumber;
u_int8_t lockType;
u_int8_t accessControl;
u_int8_t lockFlag;
NWVOL_NUM volNumber;
NWDIR_ENTRY parent;
NWDIR_ENTRY dirEntry;
u_int8_t forkCount;
u_int8_t nameSpace;
#ifdef SWIG
%pragma(swig) readonly
size_t nameLen;
%pragma(swig) readwrite
size_tLenPrefixCharArray fileName[255];
#else
size_t nameLen;
char fileName[255];
#endif
} OPEN_FILE_CONN;
NWCCODE
NWScanOpenFilesByConn2(NWCONN_HANDLE conn,
NWCONN_NUM connNum,
u_int16_t *iterHandle,
OPEN_FILE_CONN_CTRL *openCtrl,
OPEN_FILE_CONN *openFile);
typedef struct
#ifndef SWIG
__CONN_USING_FILE
#endif
{
NWCONN_NUM connNumber;
u_int16_t taskNumber;
u_int8_t lockType;
u_int8_t accessControl;
u_int8_t lockFlag;
} CONN_USING_FILE;
typedef struct {
u_int16_t nextRequest;
u_int16_t useCount;
u_int16_t openCount;
u_int16_t openForReadCount;
u_int16_t openForWriteCount;
u_int16_t denyReadCount;
u_int16_t denyWriteCount;
u_int8_t locked;
u_int8_t forkCount;
u_int16_t connCount;
CONN_USING_FILE connInfo[70];
} CONNS_USING_FILE;
NWCCODE
ncp_ns_scan_connections_using_file(
NWCONN_HANDLE conn,
NWVOL_NUM vol,
NWDIR_ENTRY dirent,
int datastream,
u_int16_t *iterHandle,
CONN_USING_FILE *cf,
CONNS_USING_FILE *cfa);
typedef struct
#ifndef SWIG
__PHYSICAL_LOCK
#endif
{
u_int16_t loggedCount;
u_int16_t shareableLockCount;
ncp_off64_t recordStart;
ncp_off64_t recordEnd;
NWCONN_NUM connNumber;
u_int16_t taskNumber;
u_int8_t lockType;
} PHYSICAL_LOCK;
typedef struct {
u_int16_t nextRequest;
u_int16_t numRecords;
PHYSICAL_LOCK locks[32];
u_int16_t curRecord;
#ifdef SWIG
fixedArray reserved[8];
#else
u_int8_t reserved[8];
#endif
} PHYSICAL_LOCKS;
NWCCODE
ncp_ns_scan_physical_locks_by_file(
NWCONN_HANDLE conn,
NWVOL_NUM vol,
NWDIR_ENTRY dirent,
int datastream,
u_int16_t *iterHandle,
PHYSICAL_LOCK *lock,
PHYSICAL_LOCKS *locks);
typedef struct {
u_int16_t openCount;
u_int16_t semaphoreValue;
u_int16_t taskNumber;
#ifdef SWIG
fixedCharArray semaphoreName[128];
#else
char semaphoreName[128];
#endif
} CONN_SEMAPHORE;
typedef struct {
u_int16_t nextRequest;
u_int16_t numRecords;
#ifdef SWIG
fixedArray records[508];
#else
u_int8_t records[508];
#endif
u_int16_t curOffset;
u_int16_t curRecord;
} CONN_SEMAPHORES;
NWCCODE
NWScanSemaphoresByConn(
NWCONN_HANDLE conn,
NWCONN_NUM connNum,
u_int16_t *iterHandle,
CONN_SEMAPHORE *semaphore,
CONN_SEMAPHORES *semaphores);
/* management services */
NWCCODE NWOpenBindery(NWCONN_HANDLE __conn);
NWCCODE NWCloseBindery(NWCONN_HANDLE __conn);
NWCCODE NWDownFileServer(NWCONN_HANDLE __conn, nuint __force);
NWCCODE NWEnableFileServerLogin(NWCONN_HANDLE __conn);
NWCCODE NWDisableFileServerLogin(NWCONN_HANDLE __conn);
NWCCODE NWDisableTTS(NWCONN_HANDLE __conn);
NWCCODE NWEnableTTS(NWCONN_HANDLE __conn);
/* RPC services */
NWCCODE NWSMLoadNLM(NWCONN_HANDLE __conn, const char* __nlm);
NWCCODE NWSMUnloadNLM(NWCONN_HANDLE __conn, const char* __nlm);
NWCCODE NWSMMountVolume(NWCONN_HANDLE __conn, const char* __volume,
nuint32* __volnumber);
NWCCODE NWSMDismountVolumeByName(NWCONN_HANDLE __conn, const char* __volume);
NWCCODE NWSMDismountVolumeByNumber(NWCONN_HANDLE __conn, nuint32 __volnumber);
NWCCODE NWSMExecuteNCFFile(NWCONN_HANDLE __conn, const char* __ncf);
NWCCODE NWSMSetDynamicCmdStrValue(NWCONN_HANDLE __conn, const char* __param,
const char* __value);
NWCCODE NWSMSetDynamicCmdIntValue(NWCONN_HANDLE __conn, const char* __param,
nuint32 __value);
/* connection services */
NWCCODE NWClearConnectionNumber(NWCONN_HANDLE __conn, NWCONN_NUM __connnum);
NWCCODE NWGetObjectConnectionNumbers(NWCONN_HANDLE __conn,
const char* __objectname, NWObjectType __objecttype,
size_t* noOfReturnedConns, NWCONN_NUM* conns, size_t maxConns);
NWCCODE NWGetConnListFromObject(NWCONN_HANDLE __conn, NWObjectID objID,
NWCONN_NUM firstConn,
size_t* noOfReturnedConns, NWCONN_NUM* conns125); /* returned max. 125 */
/* message services */
NWCCODE NWSendBroadcastMessage(NWCONN_HANDLE __conn, const char* message,
size_t conns, NWCONN_NUM* connArray, nuint8* deliveryStatus);
/* local connection services */
NWCCODE NWGetConnectionNumber(NWCONN_HANDLE __conn, NWCONN_NUM* __connnum);
NWCCODE NWGetFileServerName(NWCONN_HANDLE __conn, char* __server);
NWCCODE NWGetFileServerVersion(NWCONN_HANDLE __conn, u_int16_t* version);
NWCCODE NWCCGetConnInfo(NWCONN_HANDLE __conn, nuint info,
size_t conninfolen, void* conninfoaddr);
NWCCODE NWCCOpenConnBySockAddr(const struct sockaddr* addr,
enum NET_ADDRESS_TYPE type, nuint openState,
nuint reserved, NWCONN_HANDLE* __pconn);
NWCCODE NWCCOpenConnByAddr(const NWCCTranAddr* addr, nuint openState,
nuint reserved, NWCONN_HANDLE* __pconn);
NWCCODE NWCCCloseConn(NWCONN_HANDLE __conn);
/* ncp extensions */
#define MAX_NCP_EXTENSION_NAME_BYTES 33
NWCCODE NWGetNumberNCPExtensions(NWCONN_HANDLE __conn, nuint* __exts);
NWCCODE NWScanNCPExtensions(NWCONN_HANDLE __conn, nuint32* __iter,
char* __extname, nuint8* __majorVersion,
nuint8* __minorVersion, nuint8* __revision,
nuint8 __queryData[32]);
NWCCODE NWEnableBroadcasts(NWCONN_HANDLE __conn);
NWCCODE NWDisableBroadcasts(NWCONN_HANDLE __conn);
#ifdef NCPFS_VERSION
NWCCODE __NWEnableBroadcasts(NWCONN_HANDLE __conn);
NWCCODE __NWDisableBroadcasts(NWCONN_HANDLE __conn);
#endif
NWCCODE NWGetBroadcastMode(NWCONN_HANDLE __conn, nuint16* __bcstmode) ;
NWCCODE NWSetBroadcastMode(NWCONN_HANDLE __conn, nuint16 __bcstmode);
NWCCODE NWCCOpenConnByName(NWCONN_HANDLE startConn, const char *serverName,
nuint nameFormat,nuint openState,
nuint reserved, NWCONN_HANDLE* __pconn);
typedef struct
#ifndef SWIG
__NWOBJ_REST
#endif
{
NWObjectID objectID;
nuint32 restriction;
} NWOBJ_REST;
typedef struct {
nuint8 numberOfEntries;
NWOBJ_REST resInfo[12];
} NWVolumeRestrictions;
typedef struct {
nuint8 numberOfEntries;
NWOBJ_REST resInfo[16];
} NWVOL_RESTRICTIONS;
NWCCODE NWGetObjDiskRestrictions(
NWCONN_HANDLE conn,
NWVOL_NUM volNumber,
NWObjectID objectID,
nuint32* restriction,
nuint32* inUse
);
NWCCODE NWScanVolDiskRestrictions(
NWCONN_HANDLE conn,
NWVOL_NUM volNum,
nuint32* iterhandle,
NWVolumeRestrictions * volInfo
);
NWCCODE NWScanVolDiskRestrictions2(
NWCONN_HANDLE conn,
NWVOL_NUM volNum,
nuint32* iterhandle,
NWVOL_RESTRICTIONS* volInfo
);
NWCCODE NWRemoveObjectDiskRestrictions(
NWCONN_HANDLE conn,
NWVOL_NUM volNum,
NWObjectID objID
);
NWCCODE NWSetObjectVolSpaceLimit(
NWCONN_HANDLE conn,
NWVOL_NUM volNum,
NWObjectID objID,
nuint32 restriction
);
NWCCODE NWGetDirSpaceLimitList(NWCONN_HANDLE conn, NWDIR_HANDLE dirhandle,
nuint8* __buffer512);
typedef struct
#ifndef SWIG
__tag_NW_LIMIT_LIST_list
#endif
{
nuint32 level;
nuint32 max;
nuint32 current;
} __NW_LIMIT_LIST_list;
typedef struct {
size_t numEntries;
__NW_LIMIT_LIST_list list[102];
} NW_LIMIT_LIST;
NWCCODE NWGetDirSpaceLimitList2(NWCONN_HANDLE conn, NWDIR_HANDLE dirhandle,
NW_LIMIT_LIST* limitlist);
typedef struct {
nuint32 totalBlocks;
nuint32 availableBlocks;
nuint32 purgeableBlocks;
nuint32 notYetPurgeableBlocks;
nuint32 totalDirEntries;
nuint32 availableDirEntries;
nuint32 reserved;
nuint8 sectorsPerBlock;
#ifdef SWIG
%pragma(swig) readonly
nuint8 volLen;
%pragma(swig) readwrite
byteLenPrefixCharArray volName[NW_MAX_VOLUME_NAME_LEN];
#else
nuint8 volLen;
char volName[NW_MAX_VOLUME_NAME_LEN];
#endif
} DIR_SPACE_INFO;
NWCCODE ncp_get_directory_info(NWCONN_HANDLE conn, NWDIR_HANDLE dirhandle,
DIR_SPACE_INFO* target);
typedef struct {
NWCONN_NUM connNumber;
nuint16 taskNumber;
} SEMAPHORE;
typedef struct {
nuint16 nextRequest;
nuint16 openCount;
nuint16 semaphoreValue;
nuint16 semaphoreCount;
SEMAPHORE semaphores[170];
nuint16 curRecord;
} SEMAPHORES;
/********************* not yet
NWCCODE NWScanSemaphoresByName(
NWCONN_HANDLE conn,
const char* semName,
nint16* iterHandle,
SEMAPHORE * semaphore,
SEMAPHORES * semaphores
);
******************************/
NWCCODE NWSignalSemaphore(NWCONN_HANDLE conn, nuint32 semHandle);
NWCCODE NWCloseSemaphore(NWCONN_HANDLE conn, nuint32 semHandle);
NWCCODE NWOpenSemaphore(NWCONN_HANDLE conn, const char* semName,
nint16 maxCount, nuint32* semHandle, nuint16* semOpenCount);
NWCCODE NWExamineSemaphore(NWCONN_HANDLE conn, nuint32 semHandle,
nint16* semValue, nuint16* semOpenCount);
NWCCODE NWWaitOnSemaphore(NWCONN_HANDLE conn, nuint32 semHandle,
nuint16 timeOutValue);
NWCCODE NWCancelWait(NWCONN_HANDLE conn);
NWCCODE NWCCGetConnAddress(NWCONN_HANDLE conn, nuint32 bufLen,
NWCCTranAddr* tranAddr);
NWCCODE NWCCGetConnAddressLength(NWCONN_HANDLE conn, nuint32* bufLen);
NWCCODE NWIsObjectInSet(NWCONN_HANDLE conn, const char* objectName,
NWObjectType objectType, const char* propertyName,
const char* memberName, NWObjectType memberType);
#ifdef __cplusplus
}
#endif
#endif /* __NWCALLS_H__ */

197
include/ncp/nwclient.h Normal file
View File

@@ -0,0 +1,197 @@
/*
nwclient.h
Copyright (C) 2001 Patrick Pollet
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
1.00 2000, February 27 Patrick Pollet
Initial version.
1.01 2000, February 27 Petr Vandrovec <vandrove@vc.cvut.cz>
Move generic defines into nwcalls.h.
*/
#ifndef __NWCLIENT_H__
#define __NWCLIENT_H__
#include <ncp/nwnet.h>
#define ATTR_LOCATION "L"
#define ATTR_LOGIN_SCRIPT "Login Script"
#define ATTR_GRP_MBS "Group Membership"
#define ATTR_HOST_SERVER "Host Server"
#define ATTR_HOST_RN "Host Resource Name"
#define ATTR_SMTP_EMAIL "Email Address"
#define ATTR_LDAP_EMAIL "Internet Email Address"
#define ATTR_FULL_NAME "Full Name"
#define ATTR_SURNAME "Surname"
#define ATTR_GIVEN_NAME "Given Name"
#define ATTR_POSTAL_ADDRESS "Postal Address"
#define ATTR_HOME_NW "Home Directory"
#define ATTR_MESSAGE_SERVER "Message Server"
#define ATTR_LOGIN_TIME "Login Time"
#define ATTR_PROFILE "Profile"
// the proper naming attribute may be customized here (must be a CI_STRING )
#define ATTR_GECOS ATTR_FULL_NAME
// syntaxes of the used attributes
#define SYN_LOCATION SYN_CI_STRING
#define SYN_LOGIN_SCRIPT SYN_STREAM
#define SYN_UID SYN_INTEGER
#define SYN_PGNAME SYN_DIST_NAME
#define SYN_PGID SYN_INTEGER
#define SYN_GID SYN_INTEGER
#define SYN_SHELL SYN_CE_STRING
#define SYN_COM SYN_CI_STRING
#define SYN_HOME SYN_CE_STRING
#define SYN_GRP_MBS SYN_DIST_NAME
#define SYN_PROFILE SYN_DIST_NAME
#ifdef __cplusplus
extern "C" {
#endif
/* caution to follow the NWIsDSServer convention all NWCXIs* fonctions
return non zero if OK */
int NWCXIsDSServer ( NWCONN_HANDLE conn, NWDSChar * treeName);
/* same as API return 1 if OK but removes the trailings '_____'*/
int NWCXIsSameTree (NWCONN_HANDLE conn, const NWDSChar *treeName) ;
/*return 1 if conn points to the tree treeName */
int NWCXIsSameServer(NWCONN_HANDLE conn, const NWDSChar* server);
/*return 1 if conn points to the server server */
NWCCODE NWCXIsPermanentConnection (NWCONN_HANDLE conn);
/*return 1 if conn is permanent */
NWDSCCODE NWCXIsDSAuthenticated(NWDSContextHandle ctx);
/* return true if a context has authentication keys*/
NWDSCCODE NWCXGetPreferredDSTree (NWDSChar * preferTree, size_t maxLen);
NWDSCCODE NWCXGetDefaultNameContext (const NWDSChar* treeName,NWDSChar * nameContext, size_t maxLen);
NWDSCCODE NWCXGetPreferredServer (const NWDSChar * forTree,NWDSChar *preferedServer, size_t maxLen);
NWDSCCODE NWCXGetDefaultUserName (const NWDSChar * forTree,NWDSChar *defaultName, size_t maxLen);
/*may be we should return current user's Unix name if nothing found in env ? */
NWDSCCODE NWCXGetDefaultPassword (const NWDSChar * forTree,NWDSChar *defaultPwd, size_t maxLen);
NWCCODE NWCXGetPermConnInfo(NWCONN_HANDLE conn, nuint info, size_t len,void* buffer);
/* return infos specific top permanent connexions*/
/* fails if not permanent pass to NWCCGetConnInfo if needed */
NWCCODE NWCXGetPermConnList (NWCONN_HANDLE* conns , int maxEntries, int* curEntries, uid_t uid);
/* returns the list of permanent connexions belonging to user uid*/
/* if uid=-1 = all Permanent connections (Root only can call it) */
NWCCODE NWCXGetPermConnListByTreeName (NWCONN_HANDLE* conns, int maxEntries,
int* curEntries, uid_t uid,
const NWDSChar *treeName);
/* returns the list of permanent connexions belonging to user uid*/
/* and related to tree treeName */
NWCCODE NWCXGetPermConnListByServerName (NWCONN_HANDLE* conns , int maxEntries,
int* curEntries, uid_t uid,
const NWDSChar *serverName);
/* returns the list of permanent connexions belonging to user uid*/
/* and related to server serverName */
NWDSCCODE NWDSCreateContextHandleMnt(NWDSContextHandle* ctx, const NWDSChar * treeName);
/* create a context ,add to it all permanent connections related to treeName */
/* belonging to me (by using getuid()) and */
NWDSCCODE NWCXAttachToTreeByName( NWCONN_HANDLE* conn, const NWDSChar * treeName);
/* open an unauthenticated connection to the first visible server belonging to treeName*/
/* misc NDS properties reading functions to alleviate writing future utilities */
NWDSCCODE NWCXGetNDSVolumeServerAndResourceName(NWDSContextHandle ctx,const NWDSChar* ndsName,
NWDSChar* serverName, size_t serverNameMaxLen,
NWDSChar *resourceName, size_t resourceNameMaxlen);
/* return server name (DN or RN) and volume name of a NDS volume name */
NWDSCCODE NWCXGetObjectHomeDirectory(NWDSContextHandle ctx,
const NWDSChar* ndsName,
NWDSChar* serverName,
size_t serverNameMaxLen,
NWDSChar *resourceName,
size_t resourceNameMaxLen,
NWDSChar* NDSvolumeName,
size_t NDSVolumeNameMaxLen,
NWDSChar* pathName,
size_t pathNameMaxLen);
NWDSCCODE NWCXGetObjectLastLoginTime(NWDSContextHandle ctx,
const NWDSChar* ndsName,
time_t * tm);
NWDSCCODE NWCXGetObjectMessageServer(NWDSContextHandle ctx,
const NWDSChar* ndsName,
NWDSChar* serverName,
int serverNameMaxLen);
NWDSCCODE NWCXGetObjectLoginScript(NWDSContextHandle ctx,const NWDSChar* objectName,
char* buffer, int * len, int maxlen);
NWDSCCODE NWCXGetContextLoginScript(NWDSContextHandle ctx,const NWDSChar* objectName,
char* buffer, int * len,int maxlen);
NWDSCCODE NWCXGetProfileLoginScript(NWDSContextHandle ctx,const NWDSChar* objectName,
char* buffer, int * len, int maxlen);
/* read a single valued string attribute */
NWDSCCODE NWCXGetStringAttributeValue (NWDSContextHandle ctx,
const NWDSChar* objectName,
const NWDSChar* attrName,
char* buffer, int maxlen);
/* read a single valued numeric attribute */
NWDSCCODE NWCXGetIntAttributeValue (NWDSContextHandle ctx,
const NWDSChar* objectName,
const NWDSChar* attrName,
int * value);
/* read & convert to string a single valued attribute */
NWDSCCODE NWCXGetAttributeValueAsString (NWDSContextHandle ctx,
const NWDSChar* objectName,
const NWDSChar* attrName,
char* buffer, size_t maxlen);
/* read a multi valued string attribute */
/* caller MUST free the buffer created here */
NWDSCCODE NWCXGetMultiStringAttributeValue (NWDSContextHandle ctx,
const NWDSChar* objectName,
const NWDSChar* attrName,
char** buffer) ;
/* misc utilities */
NWDSCCODE NWCXSplitNameAndContext (NWDSContextHandle ctx,const NWDSChar * dn,
char * name, char* context);
#ifdef __cplusplus
}
#endif
#endif /* __NWCLIENT_H__ */

122
include/ncp/nwfse.h Normal file
View File

@@ -0,0 +1,122 @@
/*
nwfse.h
Copyright (C) 2002 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
1.00 2002, July 21 Petr Vandrovec <vandrove@vc.cvut.cz>
Initial revision.
*/
#ifndef __NWFSE_H__
#define __NWFSE_H__
#include <ncp/nwcalls.h>
typedef struct {
u_int32_t currentServerTime;
u_int8_t vconsoleVersion;
u_int8_t vconsoleRevision;
} NWSERVER_AND_VCONSOLE_INFO;
#define FSE_LOGGED_IN 0x00000001
#define FSE_BEING_ABORTED 0x00000002
#define FSE_AUDITED 0x00000004
#define FSE_NEEDS_SECURITY_CHANGE 0x00000008
#define FSE_MAC_STATION 0x00000010
#define FSE_AUTHENTICATED_TEMPORARY 0x00000020
#define FSE_AUDIT_CONNECTION_RECORDED 0x00000040
#define FSE_DSAUDIT_CONNECTION_RECORDED 0x00000080
#define FSE_WRITE 1
#define FSE_WRITE_ABORTED 2
#define FSE_NOT_WRITING 0
#define FSE_WRITE_IN_PROGRESS 1
#define FSE_WRITE_BEING_STOPPED 2
#define FSE_NCP_CONNECTION_TYPE 2
#define FSE_NLM_CONNECTION_TYPE 3
#define FSE_AFP_CONNECTION_TYPE 4
#define FSE_FTAM_CONNECTION_TYPE 5
#define FSE_ANCP_CONNECTION_TYPE 6
#define FSE_ACP_CONNECTION_TYPE 7
#define FSE_SMB_CONNECTION_TYPE 8
#define FSE_WINSOCK_CONNECTION_TYPE 9
#define FSE_HTTP_CONNECTION_TYPE 10
#define FSE_UDP_CONNECTION_TYPE 11
typedef struct {
u_int32_t connNum;
u_int32_t useCount;
u_int8_t connServiceType;
u_int8_t loginTime[7];
u_int32_t status;
u_int32_t expirationTime;
u_int32_t objType;
u_int8_t transactionFlag;
u_int8_t logicalLockThreshold;
u_int8_t recordLockThreshold;
u_int8_t fileWriteFlags;
u_int8_t fileWriteState;
u_int8_t filler;
u_int16_t fileLockCount;
u_int16_t recordLockCount;
u_int64_t totalBytesRead;
u_int64_t totalBytesWritten;
u_int32_t totalRequests;
u_int32_t heldRequests;
u_int64_t heldBytesRead;
u_int64_t heldBytesWritten;
} NWUSER_INFO;
typedef struct {
NWSERVER_AND_VCONSOLE_INFO serverTimeAndVConsoleInfo;
u_int16_t reserved;
NWUSER_INFO userInfo;
} NWFSE_USER_INFO;
#define NWFSE_NLM_NUMS_MAX 130
typedef struct {
NWSERVER_AND_VCONSOLE_INFO serverTimeAndVConsoleInfo;
u_int16_t reserved;
u_int32_t numberNLMsLoaded;
u_int32_t NLMsInList;
u_int32_t NLMNums[NWFSE_NLM_NUMS_MAX];
} NWFSE_NLM_LOADED_LIST;
#ifdef __NWCOMPAT__
typedef NWSERVER_AND_VCONSOLE_INFO SERVER_AND_VCONSOLE_INFO;
typedef NWUSER_INFO USER_INFO;
#define FSE_NLM_NUMS_MAX NWFSE_NLM_NUMS_MAX
#endif
#ifdef __cplusplus
extern "C" {
#endif
NWCCODE NWGetUserInfo(NWCONN_HANDLE conn, NWCONN_NUM connNum, char *userName, NWFSE_USER_INFO *userInfo);
NWCCODE NWGetNLMLoadedList(NWCONN_HANDLE conn, u_int32_t startNum, NWFSE_NLM_LOADED_LIST *fseNLMLoadedList);
#ifdef __cplusplus
}
#endif
#endif /* __NWFSE_H__ */

954
include/ncp/nwnet.h.in Normal file
View File

@@ -0,0 +1,954 @@
/*
nwnet.h
Copyright (C) 1999 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision history:
0.00 1999 Petr Vandrovec <vandrove@vc.cvut.cz>
Initial revision.
1.00 1999, November 20 Petr Vandrovec <vandrove@vc.cvut.cz>
Added license.
1.01 2000, February 7 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSSearch* function group.
1.02 2000, April Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSGenerateObjectKeyPair, NWDSVerifyObjectPassword,
NWDSChangeObjectPassword functions group.
1.03 2000, April 26 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSGetNDSStatistics, NWDSAbortPartitionOperation,
NWDSGetCountByClassAndName.
1.04 2000, April 27 Petr Vandrovec <vandrove@vc.cvut.cz>
Added DSPING* definitions.
Added NWDSGetDSVerInfo, NWDSJoinPartitions,
NWDSListPartitions, NWDSGetServerName.
1.05 2000, April 28 Petr Vandrovec <vandrove@vc.cvut.cz>
Added DSP_* definitions.
Added NWDSListPartitionsExtInfo, NWDSGetPartitionInfo,
NWDSGetPartitionExtInfoPtr, NWDSGetPartitionExtInfo,
NWDSSplitPartition, NWDSRemovePartition.
1.06 2000, April 29 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSAddReplica, NWDSRemoveReplica, NWDSChangeReplicaType.
1.07 2000, April 30 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSPartitionReceiveAllUpdates,
NWDSPartitionSendAllUpdates, NWDSSyncPartition,
NWDSGetPartitionRoot.
Added NWDSGetEffectiveRights, NWDSListAttrsEffectiveRights.
Added NWDSExtSyncList, NWDSExtSyncRead.
1.08 2000, May 1 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSGetBinderyContext, NWDSReloadDS,
NWDSResetNDSStatistics.
Added NWDSRepairTimeStamps.
Added NWGetFileServerUTCTime.
1.09 2000, May 4 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSReadClassDef, NWDSGetClassDefCount, NWDSGetClassDef.
1.10 2000, May 6 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSGetClassItemCount, NWDSGetClassItem.
1.11 2000, May 7 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSPutClassItem, NWDSPutClassName, NWDSBeginClassItem,
NWDSDefineClass, NWDSRemoveClassDef,
NWDSListContainableClasses, NWDSModifyClassDef,
NWDSReadAttrDef, NWDSGetAttrDef, NWDSDefineAttr,
NWDSRemoveAttrDef.
1.12 2000, May 8 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSSyncSchema.
1.13 2001, January 15 Patrick Pollet <patrick.pollet@insa-lyon.fr>
Added NWDSReadSyntaxes, NWDSPutSyntaxName,NWDSGetSyntaxDef,
NWDSGetSyntaxCount,NWDSReadSyntaxDef, NWDSGetSyntaxID,
NWDSScanConnsForTrees, NWDSScanForAvailableTrees,
NWDSReturnBlockOfAvailableTrees, NWDSWhoAmI
1.14 2001, March 10 Petr Vandrovec <vandrove@vc.cvut.cz>
Moved several defs from nwclient here.
1.15 2001, June 2 Petr Vandrovec <vandrove@vc.cvut.cz>
Add NWDSPutFilter and NWDSFreeFilter.
1.16 2001, December 11 Hans Grobler <grobh@sun.ac.za>
Added DS_ATTR_* definitions.
1.17 2001, December 31 Petr Vandrovec <vandrove@vc.cvut.cz>
Added NWDSDuplicateContext.
1.18 2002, January 20 Petr Vandrovec <vandrove@vc.cvut.cz>
Added __NWDSOpenStream.
*/
#ifndef __NWNET_H__
#define __NWNET_H__
#include <ncp/ndslib.h>
#include <ncp/nwcalls.h>
@wchar_h@
#ifndef NWDSChar
typedef char NWDSChar;
#define NWDSChar NWDSChar
#endif
#ifdef SWIG
struct __NWDSContextHandle;
#endif
typedef struct __NWDSContextHandle *NWDSContextHandle;
typedef int NWDSCCODE;
#define DCK_FLAGS 1
#define DCK_CONFIDENCE 2
#define DCK_NAME_CONTEXT 3
#define DCK_LAST_CONNECTION 8
#define DCK_TREE_NAME 11
#define DCK_DSI_FLAGS 12
#define DCK_NAME_FORM 13
#define DCK_LOCAL_CHARSET 32
#define DCV_DEREF_ALIASES 0x00000001
#define DCV_XLATE_STRINGS 0x00000002
#define DCV_TYPELESS_NAMES 0x00000004
#define DCV_CANONICALIZE_NAMES 0x00000010
#define DCV_DEREF_BASE_CLASS 0x00000040
#define DCV_DISALLOW_REFERRALS 0x00000080
#define DCV_LOW_CONF 0
#define DCV_MED_CONF 1
#define DCV_HIGH_CONF 2
#define MAX_RDN_CHARS 128
#define MAX_DN_CHARS 256
#define MAX_SCHEMA_NAME_CHARS 32
#define MAX_TREE_NAME_CHARS 32
#define MAX_ASN1_NAME 32
#define MAX_RDN_BYTES (4*(MAX_RDN_CHARS+1))
#define MAX_DN_BYTES (4*(MAX_DN_CHARS+1))
#define MAX_SCHEMA_NAME_BYTES (4*(MAX_SCHEMA_NAME_CHARS+1))
#define MAX_TREE_NAME_BYTES (4*(MAX_TREE_NAME_CHARS+1))
#define DS_NCP_VERB 104
#define DS_NCP_PING 1
#define DS_NCP_FRAGMENT 2
#define DS_NCP_BINDERY_CONTEXT 4
#define DS_NCP_GET_DS_STATISTICS 6
#define DS_NCP_RESET_DS_COUNTERS 7
#define DS_NCP_RELOAD 8
#define DSPING_SUPPORTED_FIELDS 0x00000001
#define DSPING_DEPTH 0x00000002
#define DSPING_BUILD_NUMBER 0x00000004
#define DSPING_FLAGS 0x00000008
/* also 0x3F0 flags are defined, but as they are not exposed through any NW API...
BTW, you must use ping v1 for them */
#define DSPING_SAP_NAME 0x00010000
#define DSPING_TREE_NAME 0x00020000
/* also 0x001C0000 flags are defined, but as they are not exposed through any NW API...
BTW, you must use ping v1 for them */
#define DSV_RESOLVE_NAME 1
#define DSV_READ_ENTRY_INFO 2
#define DSV_READ 3
#define DSV_COMPARE 4
#define DSV_LIST 5
#define DSV_SEARCH 6
#define DSV_ADD_ENTRY 7
#define DSV_REMOVE_ENTRY 8
#define DSV_MODIFY_ENTRY 9
#define DSV_MODIFY_RDN 10
#define DSV_DEFINE_ATTR 11
#define DSV_READ_ATTR_DEF 12
#define DSV_REMOVE_ATTR_DEF 13
#define DSV_DEFINE_CLASS 14
#define DSV_READ_CLASS_DEF 15
#define DSV_MODIFY_CLASS_DEF 16
#define DSV_REMOVE_CLASS_DEF 17
#define DSV_LIST_CONTAINABLE_CLASSES 18
#define DSV_GET_EFFECTIVE_RIGHTS 19
#define DSV_REMOVE_PARTITION 21
#define DSV_LIST_PARTITIONS 22
#define DSV_SPLIT_PARTITION 23
#define DSV_JOIN_PARTITIONS 24
#define DSV_ADD_REPLICA 25
#define DSV_REMOVE_REPLICA 26
#define DSV_OPEN_STREAM 27
#define DSV_SEARCH_FILTER 28
#define DSV_CHANGE_REPLICA_TYPE 31
#define DSV_SYNC_PARTITION 38
#define DSV_SYNC_SCHEMA 39
#define DSV_READ_SYNTAXES 40
#define DSV_BEGIN_MOVE_ENTRY 42
#define DSV_FINISH_MOVE_ENTRY 43
#define DSV_CLOSE_ITERATION 50
#define DSV_GET_SERVER_ADDRESS 53
#define DSV_SET_KEYS 54
#define DSV_CHANGE_PASSWORD 55
#define DSV_VERIFY_PASSWORD 56
#define DSV_BEGIN_LOGIN 57
#define DSV_FINISH_LOGIN 58
#define DSV_BEGIN_AUTHENTICATION 59
#define DSV_FINISH_AUTHENTICATION 60
#define DSV_REPAIR_TIMESTAMPS 63
#define DSV_ABORT_PARTITION_OPERATION 76
#define DSV_PARTITION_FUNCTIONS 78
#define DSV_GET_BINDERY_CONTEXTS 95
#define DSI_OUTPUT_FIELDS 0x00000001
#define DSI_ENTRY_ID 0x00000002
#define DSI_ENTRY_FLAGS 0x00000004
#define DSI_SUBORDINATE_COUNT 0x00000008
#define DSI_MODIFICATION_TIME 0x00000010
#define DSI_MODIFICATION_TIMESTAMP 0x00000020
#define DSI_CREATION_TIMESTAMP 0x00000040
#define DSI_PARTITION_ROOT_ID 0x00000080
#define DSI_PARENT_ID 0x00000100
#define DSI_REVISION_COUNT 0x00000200
#define DSI_REPLICA_TYPE 0x00000400
#define DSI_BASE_CLASS 0x00000800
#define DSI_ENTRY_RDN 0x00001000
#define DSI_ENTRY_DN 0x00002000
#define DSI_PARTITION_ROOT_DN 0x00004000
#define DSI_PARENT_DN 0x00008000
#define DSI_PURGE_TIME 0x00010000
#define DSI_DEREFERENCE_BASE_CLASS 0x00020000
#define DSI_REPLICA_NUMBER 0x00040000
#define DSI_REPLICA_STATE 0x00080000
#define DCV_NF_PARTIAL_DOT 1
#define DCV_NF_FULL_DOT 2
#define DCV_NF_SLASH 3
#define DEFAULT_MESSAGE_LEN 4096
#ifdef SWIG
#define NO_MORE_ITERATIONS (0xFFFFFFFFUL)
#else
#define NO_MORE_ITERATIONS ((nuint32)-1)
#endif
/* DSV_READ */
#define DS_ATTRIBUTE_NAMES 0x00
#define DS_ATTRIBUTE_VALUES 0x01
#define DS_EFFECTIVE_PRIVILEGES 0x02 /* only for NWDSListAttrsEffectiveRights */
#define DS_VALUE_INFO 0x03
#define DS_ABBREVIATED_VALUE 0x04
/* DSV_MODIFY_ENTRY */
#define DS_ADD_ATTRIBUTE 0x00
#define DS_REMOVE_ATTRIBUTE 0x01 /* does not have value... */
#define DS_ADD_VALUE 0x02
#define DS_REMOVE_VALUE 0x03
#define DS_ADDITIONAL_VALUE 0x04
#define DS_OVERWRITE_VALUE 0x05
#define DS_CLEAR_ATTRIBUTE 0x06 /* does not have value... */
#define DS_CLEAR_VALUE 0x07
/* DSV_SEARCH */
#define DS_SEARCH_ENTRY 0x00
#define DS_SEARCH_SUBORDINATES 0x01
#define DS_SEARCH_SUBTREE 0x02
#define DS_SEARCH_PARTITION 0x03
/* DSV_READ_CLASS_DEF */
#define DS_CLASS_DEF_NAMES 0
#define DS_CLASS_DEFS 1
#define DS_EXPANDED_CLASSS_DEFS 2
#define DS_INFO_CLASS_DEFS 3
#define DS_FULL_CLASS_DEFS 4
/* #define DS_FULL_CLASS_DEFS_AND_TIMESTAMPS 5 */
/* NWDSGenerateObjectKeyPair* */
#define NDS_PASSWORD 1
/* DSV_LIST_PARTITIONS */
#define DSP_OUTPUT_FIELDS 0x00000001
#define DSP_PARTITION_ID 0x00000002
#define DSP_REPLICA_STATE 0x00000004
#define DSP_MODIFICATION_TIMESTAMP 0x00000008
#define DSP_PURGE_TIME 0x00000010
#define DSP_LOCAL_PARTITION_ID 0x00000020
#define DSP_PARTITION_DN 0x00000040
#define DSP_REPLICA_TYPE 0x00000080
#define DSP_PARTITION_BUSY 0x00000100
/* #define DSP_UNKNOWN_00000200 0x00000200 NDS 8.17 does not have it, beta of DirXML NDS 8400 has it */
/* NDS Attribute Rights */
#define DS_ENTRY_BROWSE 0x00000001
#define DS_ENTRY_ADD 0x00000002
#define DS_ENTRY_DELETE 0x00000004
#define DS_ENTRY_RENAME 0x00000008
#define DS_ENTRY_SUPERVISOR 0x00000010
#define DS_ENTRY_INHERIT_CTL 0x00000040
#define DS_ENTRY_MASK (DS_ENTRY_BROWSE | DS_ENTRY_ADD | DS_ENTRY_DELETE | \
DS_ENTRY_RENAME | DS_ENTRY_SUPERVISOR | \
DS_ENTRY_INHERIT_CTL)
#define DS_ATTR_COMPARE 0x00000001
#define DS_ATTR_READ 0x00000002
#define DS_ATTR_WRITE 0x00000004
#define DS_ATTR_SELF 0x00000008
#define DS_ATTR_SUPERVISOR 0x00000020
#define DS_ATTR_INHERIT_CTL 0x00000040
#define DS_ATTR_MASK (DS_ATTR_COMPARE | DS_ATTR_READ | DS_ATTR_WRITE | \
DS_ATTR_SELF | DS_ATTR_SUPERVISOR | \
DS_ATTR_INHERIT_CTL)
typedef enum SYNTAX {
SYN_UNKNOWN = 0, /* 0 */
SYN_DIST_NAME, /* 1 */
SYN_CE_STRING, /* 2 */
SYN_CI_STRING, /* 3 */
SYN_PR_STRING, /* 4 */
SYN_NU_STRING, /* 5 */
SYN_CI_LIST, /* 6 */
SYN_BOOLEAN, /* 7 */
SYN_INTEGER, /* 8 */
SYN_OCTET_STRING, /* 9 */
SYN_TEL_NUMBER, /* 10 */
SYN_FAX_NUMBER, /* 11 */
SYN_NET_ADDRESS, /* 12 */
SYN_OCTET_LIST, /* 13 */
SYN_EMAIL_ADDRESS, /* 14 */
SYN_PATH, /* 15 */
SYN_REPLICA_POINTER, /* 16 */
SYN_OBJECT_ACL, /* 17 */
SYN_PO_ADDRESS, /* 18 */
SYN_TIMESTAMP, /* 19 */
SYN_CLASS_NAME, /* 20 */
SYN_STREAM, /* 21 */
SYN_COUNTER, /* 22 */
SYN_BACK_LINK, /* 23 */
SYN_TIME, /* 24 */
SYN_TYPED_NAME, /* 25 */
SYN_HOLD, /* 26 */
SYN_INTERVAL, /* 27 */
SYNTAX_COUNT
} SYNTAX;
#ifndef SWIG
typedef struct {
size_t numOfBits;
u_int8_t* data;
} Bit_String_T;
typedef NWDSChar * DN_T; /* 1, SYN_DIST_NAME */
typedef NWDSChar * CE_String_T; /* 2, SYN_CE_STRING */
typedef NWDSChar * CI_String_T; /* 3, SYN_CI_STRING */
typedef NWDSChar * PR_String_T; /* 4, SYN_PR_STRING */
typedef NWDSChar * NU_String_T; /* 5, SYN_NU_STRING */
typedef struct _ci_list {
struct _ci_list* next;
NWDSChar* s;
} CI_List_T; /* 6, SYN_CI_LIST */
typedef nuint8 Boolean_T; /* 7, SYN_BOOLEAN */
typedef nint32a Integer_T; /* 8, SYN_INTEGER */
typedef struct {
size_t length;
u_int8_t* data;
} Octet_String_T; /* 9, SYN_OCTET_STRING */
typedef NWDSChar * TN_String_T; /* 10, SYN_TEL_NUMBER */
typedef struct {
NWDSChar* telephoneNumber;
Bit_String_T parameters;
} Fax_Number_T; /* 11, SYN_FAX_NUMBER */
typedef struct {
enum NET_ADDRESS_TYPE addressType;
size_t addressLength;
u_int8_t* address;
} Net_Address_T; /* 12, SYN_NET_ADDRESS */
typedef struct _octet_list {
struct _octet_list* next;
size_t length;
u_int8_t* data;
} Octet_List_T; /* 13, SYN_OCTET_LIST */
typedef struct {
nuint32a type;
NWDSChar* address;
} EMail_Address_T; /* 14, SYN_EMAIL_ADDRESS */
typedef struct {
nuint32a nameSpaceType;
NWDSChar* volumeName;
NWDSChar* path;
} Path_T; /* 15, SYN_PATH */
typedef struct {
NWDSChar* serverName;
nint32a replicaType;
nint32a replicaNumber;
size_t count;
Net_Address_T replicaAddressHint[1];
} Replica_Pointer_T; /* 16, SYN_REPLICA_POINTER */
typedef struct {
NWDSChar* protectedAttrName;
NWDSChar* subjectName;
nuint32a privileges;
} Object_ACL_T; /* 17, SYN_OBJECT_ACL */
typedef NWDSChar *
Postal_Address_T[6]; /* 18, SYN_PO_ADDRESS */
#endif /* not SWIG */
typedef struct {
nuint32a wholeSeconds;
nuint16a replicaNum;
nuint16a eventID;
} TimeStamp_T; /* 19, SYN_TIMESTAMP */
#ifndef SWIG
typedef NWDSChar * Class_Name_T; /* 20, SYN_CLASS_NAME */
typedef Octet_String_T Stream_T; /* 21, SYN_STREAM */
typedef nuint32a Counter_T; /* 22, SYN_COUNTER */
typedef struct {
NWObjectID remoteID;
NWDSChar* objectName;
} Back_Link_T; /* 23, SYN_BACK_LINK */
typedef time_t Time_T; /* 24, SYN_TIME */
typedef struct {
NWDSChar* objectName;
nuint32a level;
nuint32a interval;
} Typed_Name_T; /* 25, SYN_TYPED_NAME */
typedef struct {
NWDSChar* objectName;
nuint32a amount;
} Hold_T; /* 26, SYN_HOLD */
#if 0 /* SYN_INTERVAL uses SYN_INTEGER directly ?! */
typedef nuint32a Interval_T; /* 27, SYN_INTERVAL */
#endif
#endif /* not SWIG */
#ifdef SWIG
struct tagAsn1ID_T {
%pragma(swig) readonly
size_t length;
%pragma(swig) readwrite
size_tLenPrefixCharArray data[MAX_ASN1_NAME];
};
typedef struct tagAsn1ID_T Asn1ID_T;
#else
typedef struct
#ifdef SWIG_BUILD
tagAsn1ID_T
#endif
{
size_t length;
nuint8 data[MAX_ASN1_NAME];
} Asn1ID_T;
#endif
typedef struct {
nuint32a attrFlags;
enum SYNTAX attrSyntaxID;
nuint32 attrLower;
nuint32 attrUpper;
Asn1ID_T asn1ID;
} Attr_Info_T;
typedef struct {
nuint32a classFlags;
Asn1ID_T asn1ID;
} Class_Info_T;
typedef struct {
nuint32a objectFlags;
nuint32a subordinateCount;
time_t modificationTime;
/* we cannot make this type NWDSChar... */
char baseClass[MAX_SCHEMA_NAME_BYTES + 2];
} Object_Info_T;
struct tagBuf_T {
nuint operation;
nuint bufFlags;
nuint8* dataend;
nuint8* curPos;
nuint8* data;
nuint8* allocend;
nuint cmdFlags; /* NWDSRead, NWDSSearch */
nuint32 dsiFlags; /* NWDSSearch, NWDSReadObjectInfo */
nuint8* attrCountPtr; /* used by NWDSPutAttrName/NWDSPutChange */
nuint8* valCountPtr; /* used by NWDSPutAttrVal */
};
typedef struct tagBuf_T Buf_T;
typedef Buf_T *pBuf_T;
typedef pBuf_T *ppBuf_T;
typedef struct {
nuint32 statsVersion;
nuint32 noSuchEntry;
nuint32 localEntry;
nuint32 typeReferral;
nuint32 aliasReferral;
nuint32 requestCount;
nuint32 requestDataSize;
nuint32 replyDataSize;
nuint32 resetTime;
nuint32 transportReferral;
nuint32 upReferral;
nuint32 downReferral;
} NDSStatsInfo_T;
typedef nuint32a NWObjectCount;
/* we are using the same env names as the Caldera client (hope they won't mind) */
#define PREFER_TREE_ENV "NWCLIENT_PREFERRED_TREE"
#define PREFER_CTX_ENV "NWCLIENT_DEFAULT_NAME_CONTEXT"
#define PREFER_SRV_ENV "NWCLIENT_PREFERRED_SERVER"
#define PREFER_USER_ENV "NWCLIENT_DEFAULT_USER"
/*this one is an extra by PP for a possible autologon*/
#define PREFER_PWD_ENV "NWCLIENT_DEFAULT_PASSWORD"
#ifdef __cplusplus
extern "C" {
#endif
NWDSCCODE NWDSInitRequester(void); /* temporary */ /* D */
NWDSCCODE NWCFragmentRequest(NWCONN_HANDLE conn, nuint32 verb,
nuint numRq, const NW_FRAGMENT* rq,
nuint numRp, NW_FRAGMENT* rp, size_t *replyLen);
NWDSCCODE NWDSCreateContextHandle(NWDSContextHandle* ctx); /* D */
NWDSContextHandle NWDSCreateContext(void); /* obsolete */ /* D */
NWDSCCODE NWDSDuplicateContextHandle(NWDSContextHandle ctx,
NWDSContextHandle* newctx); /* D */
NWDSContextHandle NWDSDuplicateContext(NWDSContextHandle ctx); /* obsolete */ /* D */
NWDSCCODE NWDSFreeContext(NWDSContextHandle ctxToFree); /* D */
NWDSCCODE NWDSGetContext2(NWDSContextHandle ctx, int key,
void* ptr, size_t len);
NWDSCCODE NWDSGetContext(NWDSContextHandle ctx, int key, void* ptr);
NWDSCCODE NWDSSetContext(NWDSContextHandle ctx, int key, const void* ptr);
NWDSCCODE NWDSSetTransport(NWDSContextHandle, size_t, const NET_ADDRESS_TYPE*);
NWDSCCODE NWDSAllocBuf(size_t Buf_T_size, pBuf_T *buf); /* D */
NWDSCCODE NWDSFreeBuf(pBuf_T freebuf); /* D */
NWDSCCODE NWDSInitBuf(NWDSContextHandle ctx, nuint verb, Buf_T* initBuf); /* D */
NWDSCCODE NWDSComputeAttrValSize(NWDSContextHandle ctx, Buf_T* buf,
enum SYNTAX synt, size_t* size); /* D */
NWDSCCODE NWDSGetAttrVal(NWDSContextHandle ctx, Buf_T* buf, enum SYNTAX synt,
void* val); /* D */
NWDSCCODE NWDSGetAttrCount(NWDSContextHandle ctx, Buf_T* buf,
NWObjectCount* count); /* D */
NWDSCCODE NWDSGetAttrName(NWDSContextHandle ctx, Buf_T* buf, NWDSChar* name,
NWObjectCount* valcount, enum SYNTAX* syntaxID); /* D */
NWDSCCODE NWDSGetAttrValFlags(NWDSContextHandle ctx, Buf_T* buf,
nuint32* flags); /* D */
NWDSCCODE NWDSGetAttrValModTime(NWDSContextHandle ctx, Buf_T* buf,
TimeStamp_T* stamp); /* D */
NWDSCCODE NWDSPutAttrVal(NWDSContextHandle ctx, Buf_T* buf,
enum SYNTAX syntaxID, const void* attrVal_syn3); /* Partially */
NWDSCCODE NWDSPutAttrName(NWDSContextHandle ctx, Buf_T* buf,
const NWDSChar* name); /* D */
NWDSCCODE NWDSPutAttrNameAndVal(NWDSContextHandle ctx, Buf_T* buf,
const NWDSChar* name, enum SYNTAX syntaxID,
const void* attrVal_syn4); /* Partially */
NWDSCCODE NWDSPutChange(NWDSContextHandle ctx, Buf_T* buf,
nuint changeType, const NWDSChar* name); /* D */
NWDSCCODE NWDSPutChangeAndVal(NWDSContextHandle ctx, Buf_T* buf,
nuint changeType, const NWDSChar* name,
enum SYNTAX syntaxID, const void* attrVal_syn5); /* Partially */
NWDSCCODE NWDSGetObjectCount(NWDSContextHandle ctx, Buf_T* buf,
NWObjectCount* count); /* D */
NWDSCCODE NWDSGetObjectName(NWDSContextHandle ctx, Buf_T* buf, NWDSChar* name,
NWObjectCount* attrs, Object_Info_T* oit); /* D */
NWDSCCODE NWDSGetObjectNameAndInfo(NWDSContextHandle ctx, Buf_T* buf,
NWDSChar* name, NWObjectCount* attrs, char** info);
NWDSCCODE NWDSGetPartitionInfo(NWDSContextHandle ctx, Buf_T* buf,
NWDSChar* partitionRoot, nuint32* replicaType);
NWDSCCODE NWDSGetPartitionExtInfoPtr(NWDSContextHandle ctx, Buf_T* buf,
char** infoPtr, char** infoPtrEnd);
NWDSCCODE NWDSGetPartitionExtInfo(NWDSContextHandle ctx, char* infoPtr,
char* infoPtrEnd, nflag32 infoFlag,
size_t* length, void* data);
NWDSCCODE NWDSGetServerName(NWDSContextHandle ctx, Buf_T* buf,
NWDSChar* serverDN, NWObjectCount* partCount);
NWDSCCODE NWDSGetDSIInfo(NWDSContextHandle ctx, void* buffer, size_t blen,
nuint32 dsiflag, void* dst);
NWDSCCODE NWDSRemoveAllTypesW(NWDSContextHandle ctx, const wchar_t* src,
wchar_t* dst);
NWDSCCODE NWDSRemoveAllTypes(NWDSContextHandle ctx, const NWDSChar* src,
NWDSChar* dst); /* D */
NWDSCCODE NWDSCanonicalizeNameW(NWDSContextHandle ctx, const wchar_t* src,
wchar_t* dst);
NWDSCCODE NWDSCanonicalizeName(NWDSContextHandle ctx, const NWDSChar* src,
NWDSChar* dst); /* D */
NWDSCCODE NWDSAbbreviateNameW(NWDSContextHandle ctx, const wchar_t* src,
wchar_t* dst);
NWDSCCODE NWDSAbbreviateName(NWDSContextHandle ctx, const NWDSChar* src,
NWDSChar* dst); /* D */
NWDSCCODE NWDSGetBinderyContext(NWDSContextHandle ctx,
NWCONN_HANDLE conn, NWDSChar* binderyEmulationContext); /* D */
NWDSCCODE __NWGetFileServerUTCTime(NWCONN_HANDLE conn,
nuint32* timev, nuint32* OUTPUT, nuint32* flags,
nuint32* OUTPUT2, nuint32* OUTPUT3, nuint32* OUTPUT4,
nuint32* OUTPUT5); /* D */
NWDSCCODE NWGetFileServerUTCTime(NWCONN_HANDLE conn, nuint32* timev); /* D */
NWDSCCODE NWDSGetObjectHostServerAddress(NWDSContextHandle ctx,
const NWDSChar* objectName, NWDSChar* serverDN,
Buf_T* serverAddresses); /* D */
NWDSCCODE NWDSGetServerDN(NWDSContextHandle ctx, NWCONN_HANDLE conn,
NWDSChar* name); /* D */
NWDSCCODE NWDSGetServerAddress(NWDSContextHandle ctx, NWCONN_HANDLE conn,
NWObjectCount* addrcnt, Buf_T* addrBuf); /* D */
NWDSCCODE NWDSGetServerAddress2(NWDSContextHandle ctx, NWCONN_HANDLE conn,
NWObjectCount* addrcnt, Buf_T* addrBuf); /* D */
NWDSCCODE NWDSMapIDToName(NWDSContextHandle ctx, NWCONN_HANDLE conn,
NWObjectID ID, NWDSChar* name); /* D */
NWDSCCODE NWDSMapNameToID(NWDSContextHandle ctx, NWCONN_HANDLE conn,
const NWDSChar* name, NWObjectID* ID); /* D */
NWDSCCODE NWDSGetDSVerInfo(NWCONN_HANDLE conn, nuint32* dsVersion,
nuint32* rootMostEntryDepth, char* sapName, nuint32* flags,
wchar_t* treeName); /* D */
NWDSCCODE NWDSGetNDSStatistics(NWDSContextHandle ctx,
const NWDSChar* serverDN, size_t statsInfoLen,
NDSStatsInfo_T* statsInfo); /* D */
NWDSCCODE NWDSReloadDS(NWDSContextHandle ctx, const NWDSChar* serverDN); /* D */
NWDSCCODE NWDSResetNDSStatistics(NWDSContextHandle ctx,
const NWDSChar* serverDN);
NWDSCCODE __NWDSCompare(NWDSContextHandle ctx, NWCONN_HANDLE conn,
NWObjectID objectID, Buf_T* buf, nbool8* matched);
NWDSCCODE __NWDSOpenStream(NWDSContextHandle ctx, const NWDSChar* objectName,
const NWDSChar* attrName, nflag32 flags, NWCONN_HANDLE* rconn,
char fileHandle[6], ncp_off64_t* fileSize);
NWDSCCODE NWDSAddObject(NWDSContextHandle ctx, const NWDSChar* name,
nuint32* iterHandle, nbool8 more, Buf_T* buf); /* D */
NWDSCCODE NWDSAuthenticateConn(NWDSContextHandle ctx, NWCONN_HANDLE conn);
NWDSCCODE NWDSChangeObjectPassword(NWDSContextHandle ctx, nflag32 flags,
const NWDSChar* objectName, const char* oldPassword,
const char* newPassword);
NWDSCCODE NWDSCloseIteration(NWDSContextHandle ctx, nuint32 iterHandle,
nuint32 verb);
NWDSCCODE NWDSCompare(NWDSContextHandle ctx, const NWDSChar* name,
Buf_T* buf, nbool8* matched);
NWDSCCODE NWDSExtSyncList(NWDSContextHandle ctx, const NWDSChar* objectName,
const NWDSChar* className, const NWDSChar* subordinateName,
nuint32* iterHandle, const TimeStamp_T* timeStamp,
nuint onlyContainers, Buf_T* objectList);
NWDSCCODE NWDSExtSyncRead(NWDSContextHandle ctx, const NWDSChar* objectName,
nuint infoType, nuint allAttrs, Buf_T* in_attrNames,
nuint32* iterHandle, const TimeStamp_T* timeStamp,
Buf_T* objectInfo);
NWDSCCODE NWDSExtSyncSearch(NWDSContextHandle ctx, const NWDSChar* objectName,
nint scope, nuint searchAliases, Buf_T* in_filter,
const TimeStamp_T* timeStamp, nuint infoType,
nuint allAttrs, Buf_T* in_attrNames, nuint32* iterHandle,
NWObjectCount countObjectsToSearch,
NWObjectCount* countObjectsSearched,
Buf_T* objectInfo);
NWDSCCODE NWDSGenerateObjectKeyPair2(NWDSContextHandle ctx,
const NWDSChar* objectName, NWObjectID pseudoID, size_t pwdLen,
const nuint8* pwdHash, nflag32 optionsFlag);
NWDSCCODE NWDSGenerateObjectKeyPair(NWDSContextHandle ctx,
const NWDSChar* objectName, const char* objectPassword,
nflag32 optionsFlag);
NWDSCCODE NWDSGetCountByClassAndName(NWDSContextHandle ctx,
const NWDSChar* objectName, const NWDSChar* className,
const NWDSChar* subordinateName, NWObjectCount* count);
NWDSCCODE NWDSGetEffectiveRights(NWDSContextHandle ctx,
const NWDSChar* subjectName, const NWDSChar* objectName,
const NWDSChar* attrName, nuint32* privileges);
NWDSCCODE NWDSList(NWDSContextHandle ctx, const NWDSChar* name,
nuint32* iterHandle, Buf_T* objectList); /* D */
NWDSCCODE NWDSListAttrsEffectiveRights(NWDSContextHandle ctx,
const NWDSChar* objectName, const NWDSChar* subjectName,
nuint allAttrs, Buf_T* in_attrNames, nuint32* iterHandle,
Buf_T* privilegeInfo);
NWDSCCODE NWDSListByClassAndName(NWDSContextHandle ctx, const NWDSChar* name,
const NWDSChar* className, const NWDSChar* subordinateName,
nuint32* iterHandle, Buf_T* objectList);
NWDSCCODE NWDSListContainers(NWDSContextHandle ctx, const NWDSChar* name,
nuint32* iterHandle, Buf_T* objectList);
NWDSCCODE NWDSModifyDN(NWDSContextHandle ctx, const NWDSChar* oldName,
const NWDSChar* newName, nuint deleteOldRDN); /* D */
NWDSCCODE NWDSModifyObject(NWDSContextHandle ctx, const NWDSChar* name,
nuint32* iterHandle, nbool8 more, Buf_T* buf); /* D */
NWDSCCODE NWDSModifyRDN(NWDSContextHandle ctx, const NWDSChar* oldName,
const NWDSChar* newRDN, nuint deleteOldRDN); /* D */
NWDSCCODE NWDSMoveObject(NWDSContextHandle ctx, const NWDSChar* oldName,
const NWDSChar* newParent, const NWDSChar* newRDN); /* D */
NWDSCCODE NWDSOpenConnToNDSServer(NWDSContextHandle ctx,
const NWDSChar* serverDN, NWCONN_HANDLE* pconn); /* D */
NWDSCCODE NWDSRead(NWDSContextHandle ctx, const NWDSChar* name,
nuint infoType, nuint allAttrs, Buf_T* in_attrNames,
nuint32* iterHandle, Buf_T* objectInfo); /* D */
NWDSCCODE NWDSReadObjectDSIInfo(NWDSContextHandle ctx, const NWDSChar* name,
size_t bufflen, void* buffer);
NWDSCCODE NWDSReadObjectInfo(NWDSContextHandle ctx, const NWDSChar* name,
NWDSChar* distName, Object_Info_T* oit); /* D */
NWDSCCODE NWDSRemoveObject(NWDSContextHandle ctx, const NWDSChar* name); /* D */
NWDSCCODE NWDSResolveName(NWDSContextHandle ctx, const NWDSChar* name,
NWCONN_HANDLE* conn, NWObjectID* ID); /* D */
NWDSCCODE NWDSSearch(NWDSContextHandle ctx, const NWDSChar* objectName,
nint scope, nuint searchAliases, Buf_T* in_filter,
nuint infoType, nuint allAttrs, Buf_T* in_attrNames,
nuint32* iterHandle, NWObjectCount countObjectsToSearch,
NWObjectCount* countObjectsSearched, Buf_T* objectInfo);
NWDSCCODE NWDSVerifyObjectPassword(NWDSContextHandle ctx, nflag32 flags,
const NWDSChar* objectName, const char* objectPassword);
/* NWIsDSServer returns true/false instead of error code! */
NWDSCCODE NWIsDSServer(NWCONN_HANDLE conn, char* treename); /* D */
NWDSCCODE NWIsDSServerW(NWCONN_HANDLE conn, wchar_t* treename);
NWDSCCODE NWDSAbortPartitionOperation(NWDSContextHandle ctx,
const NWDSChar* partitionRoot);
NWDSCCODE NWDSAddReplica(NWDSContextHandle ctx, const NWDSChar* serverDN,
const NWDSChar* partitionRoot, nuint32 replicaType);
NWDSCCODE NWDSChangeReplicaType(NWDSContextHandle ctx,
const NWDSChar* partitionRoot, const NWDSChar* serverDN,
nuint32 newReplicaType);
NWDSCCODE NWDSGetPartitionRoot(NWDSContextHandle ctx,
const NWDSChar* objectName, NWDSChar* partitionRoot); /* D */
NWDSCCODE NWDSJoinPartitions(NWDSContextHandle ctx,
const NWDSChar* subordinatePartition, nflag32 flags); /* D */
NWDSCCODE NWDSListPartitions(NWDSContextHandle ctx, nuint32* iterHandle,
const NWDSChar* serverDN, Buf_T* partitions);
NWDSCCODE NWDSListPartitionsExtInfo(NWDSContextHandle ctx, nuint32* iterHandle,
const NWDSChar* serverDN, nflag32 dspFlags,
Buf_T* partitions);
NWDSCCODE NWDSPartitionReceiveAllUpdates(NWDSContextHandle ctx,
const NWDSChar* partitionRoot, const NWDSChar* serverDN);
NWDSCCODE NWDSPartitionSendAllUpdates(NWDSContextHandle ctx,
const NWDSChar* partitionRoot, const NWDSChar* serverDN);
NWDSCCODE NWDSRemovePartition(NWDSContextHandle ctx,
const NWDSChar* partitionRoot);
NWDSCCODE NWDSRemoveReplica(NWDSContextHandle ctx, const NWDSChar* serverDN,
const NWDSChar* partitionRoot);
NWDSCCODE NWDSRepairTimeStamps(NWDSContextHandle ctx,
const NWDSChar* partitionRoot);
NWDSCCODE NWDSSplitPartition(NWDSContextHandle ctx,
const NWDSChar* subordinatePartition, nflag32 flags); /* D */
NWDSCCODE NWDSSyncPartition(NWDSContextHandle ctx, const NWDSChar* serverDN,
const NWDSChar* partitionRoot, nuint32 seconds);
NWDSCCODE NWDSBeginClassItem(NWDSContextHandle ctx, Buf_T* in_classItems);
NWDSCCODE NWDSDefineAttr(NWDSContextHandle ctx, const NWDSChar* attrName,
const Attr_Info_T* attrInfo);
NWDSCCODE NWDSDefineClass(NWDSContextHandle ctx, const NWDSChar* className,
const Class_Info_T* classInfo, Buf_T* in_classItems);
NWDSCCODE NWDSGetAttrDef(NWDSContextHandle ctx, Buf_T* in_attrDefs,
NWDSChar* attrName, Attr_Info_T* attrInfo); /* D */
NWDSCCODE NWDSGetClassDef(NWDSContextHandle ctx, Buf_T* in_classDefs,
NWDSChar* className, Class_Info_T* classInfo);
NWDSCCODE NWDSGetClassDefCount(NWDSContextHandle ctx, Buf_T* in_classDefs,
NWObjectCount* classDefCount);
NWDSCCODE NWDSGetClassItem(NWDSContextHandle ctx, Buf_T* in_classDefs,
NWDSChar* item);
NWDSCCODE NWDSGetClassItemCount(NWDSContextHandle ctx, Buf_T* in_classDefs,
NWObjectCount* itemCount);
NWDSCCODE NWDSListContainableClasses(NWDSContextHandle ctx,
const NWDSChar* parentName, nuint32* iterHandle,
Buf_T* containableClasses);
NWDSCCODE NWDSModifyClassDef(NWDSContextHandle ctx, const NWDSChar* className,
Buf_T* in_optionalAttrs);
NWDSCCODE NWDSPutClassItem(NWDSContextHandle ctx, Buf_T* in_classDefs,
const NWDSChar* itemName);
#ifdef SWIG
NWDSCCODE NWDSPutClassName(NWDSContextHandle ctx, Buf_T* in_classDefs,
const NWDSChar* itemName); /* D */
#else
#define NWDSPutClassName(ctx, classDefs, itemName) \
NWDSPutClassItem(ctx, classDefs, itemName)
#endif
NWDSCCODE NWDSReadAttrDef(NWDSContextHandle ctx, nuint infoType,
nuint allAttrs, Buf_T* in_attrNames, nuint32* iterHandle,
Buf_T* attrDefs); /* D */
NWDSCCODE NWDSReadClassDef(NWDSContextHandle ctx, nuint infoType,
nuint allClasses, Buf_T* in_classNames, nuint32* iterHandle,
Buf_T* classDefs);
NWDSCCODE NWDSRemoveAttrDef(NWDSContextHandle ctx, const NWDSChar* attrName);
NWDSCCODE NWDSRemoveClassDef(NWDSContextHandle ctx, const NWDSChar* className);
NWDSCCODE NWDSSyncSchema(NWDSContextHandle ctx, const NWDSChar* serverDN,
nuint32a delaySeconds);
struct _filter_node {
struct _filter_node* parent;
struct _filter_node* left;
struct _filter_node* right;
void* value;
enum SYNTAX syntax;
nuint token;
};
typedef struct {
struct _filter_node* fn;
nuint level;
nuint32 expect;
} Filter_Cursor_T;
#define FTOK_END 0
#define FTOK_OR 1
#define FTOK_AND 2
#define FTOK_NOT 3
#define FTOK_LPAREN 4
#define FTOK_RPAREN 5
#define FTOK_AVAL 6
#define FTOK_EQ 7
#define FTOK_GE 8
#define FTOK_LE 9
#define FTOK_APPROX 10
#define FTOK_ANAME 14
#define FTOK_PRESENT 15
#define FTOK_RDN 16
#define FTOK_BASECLS 17
#define FTOK_MODTIME 18
#define FTOK_VALTIME 19
#define FBIT_END (1 << FTOK_END)
#define FBIT_OR (1 << FTOK_OR)
#define FBIT_AND (1 << FTOK_AND)
#define FBIT_NOT (1 << FTOK_NOT)
#define FBIT_LPAREN (1 << FTOK_LPAREN)
#define FBIT_RPAREN (1 << FTOK_RPAREN)
#define FBIT_AVAL (1 << FTOK_AVAL)
#define FBIT_EQ (1 << FTOK_EQ)
#define FBIT_GE (1 << FTOK_GE)
#define FBIT_LE (1 << FTOK_LE)
#define FBIT_APPROX (1 << FTOK_APPROX)
#define FBIT_ANAME (1 << FTOK_ANAME)
#define FBIT_PRESENT (1 << FTOK_PRESENT)
#define FBIT_RDN (1 << FTOK_RDN)
#define FBIT_BASECLS (1 << FTOK_BASECLS)
#define FBIT_MODTIME (1 << FTOK_MODTIME)
#define FBIT_VALTIME (1 << FTOK_VALTIME)
#define FBIT_OPERAND (FBIT_NOT | FBIT_LPAREN | FBIT_ANAME | FBIT_PRESENT | FBIT_RDN | FBIT_BASECLS | FBIT_MODTIME | FBIT_VALTIME)
#define FBIT_RELOP (FBIT_EQ | FBIT_GE | FBIT_LE | FBIT_APPROX)
#define FBIT_BOOLOP (FBIT_OR | FBIT_AND)
NWDSCCODE NWDSAddFilterToken(Filter_Cursor_T* cur, nuint token, const void* value,
enum SYNTAX syntax);
NWDSCCODE NWDSAllocFilter(Filter_Cursor_T** cur);
NWDSCCODE NWDSDelFilterToken(Filter_Cursor_T* cur,
void (*freeVal)(enum SYNTAX, void*));
NWDSCCODE NWDSPutFilter(NWDSContextHandle ctx, Buf_T* buf,
Filter_Cursor_T* cur, void (*freeVal)(enum SYNTAX, void*));
NWDSCCODE NWDSFreeFilter(Filter_Cursor_T* cur,
void (*freeVal)(enum SYNTAX, void*));
NWDSCCODE NWDSAddConnection(NWDSContextHandle __ctx, NWCONN_HANDLE __conn);
/***************************PP */
#define DS_SYNTAX_NAMES 0
#define DS_SYNTAX_DEFS 1
#define DS_STRING 0x0001
#define DS_SINGLE_VALUED 0x0002
#define DS_SUPPORT_ORDER 0x0004
#define DS_SUPPORT_EQUALS 0x0008
#define DS_IGNORE_CASE 0x0010
#define DS_IGNORE_SPACE 0x0020
#define DS_IGNORE_DASH 0x0040
#define DS_ONLY_DIGITS 0x0080
#define DS_ONLY_PRINTABLE 0x0100
#define DS_SIZEABLE 0x0200
#define DS_BITWISE_EQUALS 0x0400
typedef struct {
enum SYNTAX ID;
char defStr[MAX_SCHEMA_NAME_BYTES + 2];
nuint16 flags;
} Syntax_Info_T;
NWDSCCODE NWDSReadSyntaxes(NWDSContextHandle ctx, nuint infoType,
nuint allSyntaxes, Buf_T* in_syntaxNames,
nuint32* iterHandle, Buf_T* syntaxDefs);
NWDSCCODE NWDSPutSyntaxName(NWDSContextHandle ctx, Buf_T* buf,
const NWDSChar* syntaxName);
NWDSCCODE NWDSGetSyntaxDef(NWDSContextHandle ctx, Buf_T* buf,
NWDSChar* syntaxName, Syntax_Info_T* syntaxDef);
NWDSCCODE NWDSGetSyntaxCount(NWDSContextHandle ctx, Buf_T* buf,
NWObjectCount* syntaxCount);
NWDSCCODE NWDSReadSyntaxDef(NWDSContextHandle context, enum SYNTAX syntaxID,
Syntax_Info_T* syntaxDef);
NWDSCCODE NWDSGetSyntaxID(NWDSContextHandle ctx, const NWDSChar* attrName,
enum SYNTAX* syntaxID);
/************* end syntaxes**************/
NWDSCCODE NWDSScanConnsForTrees(NWDSContextHandle context, nuint numOfPtrs,
nuint* numOfTrees, NWDSChar** treeBufPtrs);
NWDSCCODE NWDSScanForAvailableTrees(NWDSContextHandle context,
NWCONN_HANDLE connHandle, const char* scanFilter,
nint32* scanIndex, NWDSChar* treeName);
NWDSCCODE NWDSReturnBlockOfAvailableTrees(NWDSContextHandle context,
NWCONN_HANDLE connHandle, const char* scanFilter,
const void* lastBlocksString, const NWDSChar* endBoundString,
nuint32 maxTreeNames, NWDSChar** arrayOfNames,
nuint32* numberOfTrees, nuint32* totalUniqueTrees);
NWDSCCODE NWDSWhoAmI(NWDSContextHandle context, NWDSChar* myDN);
#ifdef __cplusplus
}
#endif
#endif /* __NWNET_H__ */

View File

@@ -0,0 +1,40 @@
/*
ncplib.h
Copyright (C) 1995, 1996 by Volker Lendecke
Copyright (C) 1997-2001 Petr Vandrovec
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _OBSOLETE_NCPLIB_H
#define _OBSOLETE_NCPLIB_H
#ifndef _NCPLIB_H
#error "Do not include this file directly, compile your project with -DNCP_OBSOLETE instead"
#endif
#ifdef __cplusplus
extern "C" {
#endif
long
ncp_renegotiate_connparam(NWCONN_HANDLE conn, int buffsize, int options);
#ifdef __cplusplus
}
#endif
#endif /* _NCPLIB_H */

View File

@@ -17,19 +17,32 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _NDSLIB_H_
#define _NDSLIB_H_
#ifndef _O_NDSLIB_H_
#define _O_NDSLIB_H_
#include "ncplib.h"
typedef unsigned short uni_char;
#define NDS_GRACE_PERIOD -223
/* old compat code */
#define NDS_GRACE_PERIOD 0x89DF
#ifdef __cplusplus
extern "C" {
#endif
int strlen_u(const uni_char *s);
uni_char getchr_u(const uni_char *s);
void strcpy_uc(char *d, const uni_char *s);
void strcpy_cu(uni_char *d, const char *s);
long nds_get_server_name(struct ncp_conn *conn, uni_char **server_name);
long nds_get_tree_name(struct ncp_conn *conn, char *name, int name_buf_len);
long nds_login_auth(struct ncp_conn *conn, const char *user, const char *pwd);
long nds_get_server_name(NWCONN_HANDLE conn, uni_char **server_name);
long nds_get_tree_name(NWCONN_HANDLE conn, char *name, int name_buf_len);
long nds_login_auth(NWCONN_HANDLE conn, const char *user, const char *pwd);
long nds_resolve_name(struct ncp_conn *conn, int flags, uni_char *entry_name,
int *entry_id, int *remote, struct sockaddr *serv_addr, size_t *addr_len);
long nds_read(NWCONN_HANDLE conn, u_int32_t object_id, uni_char *prop_name,
u_int32_t *syntax_id, void **outbuf, size_t *outlen);
#endif /* ifndef _NDSLIB_H_ */
#ifdef __cplusplus
}
#endif
#endif /* ifndef _O_NDSLIB_H_ */

View File

@@ -1,823 +0,0 @@
/*
* ncplib.h
*
* Copyright (C) 1995, 1996 by Volker Lendecke
*
*/
#ifndef _NCPLIB_H
#define _NCPLIB_H
#include "ncp.h"
#include <sys/param.h>
#include <stdio.h>
#include <time.h>
#ifdef SIGNATURES
#ifndef NCP_IOC_SIGN_INIT
#undef SIGNATURES
#endif /* NCP_IOC_SIGN_INIT */
#endif /* SIGNATURES */
#include "ipxlib.h"
#include "com_err.h"
typedef __u8 byte;
typedef __u16 word;
typedef __u32 dword;
typedef int NWCCODE;
#ifndef memzero
#include <string.h>
#define memzero(object) memset(&(object), 0, sizeof(object))
#endif
#define BVAL(buf,pos) (((const __u8 *)(buf))[pos])
#define BWVAL(buf,pos) (((__u8*)(buf))[pos])
#define PVAL(buf,pos) ((unsigned)BVAL(buf,pos))
#define BSET(buf,pos,val) (BWVAL(buf,pos) = (val))
static inline word
WVAL_HL(const __u8 * buf, int pos)
{
return PVAL(buf, pos) << 8 | PVAL(buf, pos + 1);
}
static inline dword
DVAL_HL(const __u8 * buf, int pos)
{
return WVAL_HL(buf, pos) << 16 | WVAL_HL(buf, pos + 2);
}
static inline void
WSET_HL(__u8 * buf, int pos, word val)
{
BSET(buf, pos, val >> 8);
BSET(buf, pos + 1, val & 0xff);
}
static inline void
DSET_HL(__u8 * buf, int pos, dword val)
{
WSET_HL(buf, pos, val >> 16);
WSET_HL(buf, pos + 2, val & 0xffff);
}
/* we know that the 386 can handle misalignment and has the "right"
byteorder */
#if defined(__i386__)
static inline word
WVAL_LH(const __u8 * buf, int pos)
{
return *((const word *) (buf + pos));
}
static inline dword
DVAL_LH(const __u8 * buf, int pos)
{
return *((const dword *) (buf + pos));
}
static inline void
WSET_LH(__u8 * buf, int pos, word val)
{
*((word *) (buf + pos)) = val;
}
static inline void
DSET_LH(__u8 * buf, int pos, dword val)
{
*((dword *) (buf + pos)) = val;
}
#else
static inline word
WVAL_LH(const __u8 * buf, int pos)
{
return PVAL(buf, pos) | PVAL(buf, pos + 1) << 8;
}
static inline dword
DVAL_LH(const __u8 * buf, int pos)
{
return WVAL_LH(buf, pos) | WVAL_LH(buf, pos + 2) << 16;
}
static inline void
WSET_LH(__u8 * buf, int pos, word val)
{
BSET(buf, pos, val & 0xff);
BSET(buf, pos + 1, val >> 8);
}
static inline void
DSET_LH(__u8 * buf, int pos, dword val)
{
WSET_LH(buf, pos, val & 0xffff);
WSET_LH(buf, pos + 2, val >> 16);
}
#endif
void
str_upper(char *name);
enum connect_state
{
NOT_CONNECTED = 0,
CONN_PERMANENT,
CONN_TEMPORARY
};
struct ncp_conn
{
enum connect_state is_connected;
char server[NCP_BINDERY_NAME_LEN];
char user[NCP_BINDERY_NAME_LEN];
struct ncp_fs_info i;
/* Fields for use with permanent connections */
int mount_fid;
char mount_point[MAXPATHLEN];
/* Fields for use with temporary connections */
int ncp_sock;
int wdog_sock;
int wdog_pid;
__u8 sequence;
int completion;
int conn_status;
int reply_size;
/* Fields used to setup ncp requests */
int current_size;
int has_subfunction;
int verbose;
size_t ncp_reply_size;
int lock;
char packet[NCP_PACKET_SIZE];
#ifdef SIGNATURES
/* Field used to make packet signatures */
int sign_wanted;
int sign_active;
char sign_root[8];
char sign_last[16];
#endif
};
struct ncp_conn_spec
{
char server[NCP_BINDERY_NAME_LEN];
char user[NCP_BINDERY_NAME_LEN];
uid_t uid;
int login_type; /* NCP_BINDERY_USER / NCP_BINDERY_PSERVER */
char password[NCP_BINDERY_NAME_LEN];
};
#ifndef __MAKE_SULIB__
struct ncp_search_seq
{
struct nw_search_sequence s;
int namespace;
};
#endif /* not __MAKE_SULIB__ */
struct ncp_property_info
{
__u8 property_name[16];
__u8 property_flags;
__u8 property_security;
__u32 search_instance;
__u8 value_available_flag;
__u8 more_properties_flag;
};
/* ncp_initialize is the main entry point for user programs which want
to connect to a NetWare Server. It looks for -S, -U, -P and -n in
the argument list, opens the connection and removes the arguments
from the list. It was designed after the X Windows init
functions. */
struct ncp_conn *
ncp_initialize(int *argc, char **argv,
int login_necessary, long *err);
/* You can login as another object by this procedure. As a first use
pserver comes to mind. */
struct ncp_conn *
ncp_initialize_as(int *argc, char **argv,
int login_necessary, int login_type, long *err);
/* Open a connection */
struct ncp_conn *
ncp_open(const struct ncp_conn_spec *spec, long *err);
/* Open a connection on an existing mount point */
int
ncp_open_mount(const char *mount_point, struct ncp_conn** conn);
/* Find a permanent connection that fits the spec, return NULL if
* there is none. */
char *
ncp_find_permanent(const struct ncp_conn_spec *spec);
/* Find the address of a file server */
long
ncp_find_fileserver(const char *server_name, struct sockaddr* addr, size_t addrlen);
/* Find the address of a server */
long
ncp_find_server(const char **server_name, int type, struct sockaddr* addr, size_t addrlen);
/* Detach from a permanent connection or destroy a temporary
connection */
long
ncp_close(struct ncp_conn *conn);
/* like getmntent, get_ncp_conn_ent scans /etc/mtab for usable
connections */
struct ncp_conn_ent
{
char server[NCP_BINDERY_NAME_LEN];
char user[NCP_BINDERY_NAME_LEN];
uid_t uid;
char mount_point[MAXPATHLEN];
};
struct ncp_conn_ent *
ncp_get_conn_ent(FILE * filep);
#define NWCLIENT (".nwclient")
#define NWC_NOPASSWORD ("-")
/* find an appropriate connection */
struct ncp_conn_spec *
ncp_find_conn_spec(const char *server, const char *user, const char *password,
int login_necessary, uid_t uid, long *err);
#ifdef __MAKE_SULIB__
struct ncp_conn_spec *
ncp_find_conn_spec2(const char *server, const char *user, const char *password,
int login_necessary, uid_t uid, int allow_multiple_conns,
long *err);
#else /* __MAKE_SULIB__ */
long
ncp_get_file_server_description_strings(struct ncp_conn *conn,
char target[512]);
long
ncp_get_file_server_time(struct ncp_conn *conn, time_t * target);
long
ncp_set_file_server_time(struct ncp_conn *conn, time_t * source);
struct ncp_file_server_info
{
__u8 ServerName[48] __attribute__((packed));
__u8 FileServiceVersion __attribute__((packed));
__u8 FileServiceSubVersion __attribute__((packed));
__u16 MaximumServiceConnections __attribute__((packed));
__u16 ConnectionsInUse __attribute__((packed));
__u16 NumberMountedVolumes __attribute__((packed));
__u8 Revision __attribute__((packed));
__u8 SFTLevel __attribute__((packed));
__u8 TTSLevel __attribute__((packed));
__u16 MaxConnectionsEverUsed __attribute__((packed));
__u8 AccountVersion __attribute__((packed));
__u8 VAPVersion __attribute__((packed));
__u8 QueueVersion __attribute__((packed));
__u8 PrintVersion __attribute__((packed));
__u8 VirtualConsoleVersion __attribute__((packed));
__u8 RestrictionLevel __attribute__((packed));
__u8 InternetBridge __attribute__((packed));
__u8 Reserved[60] __attribute__((packed));
};
long
ncp_get_file_server_information(struct ncp_conn *conn,
struct ncp_file_server_info *target);
long
ncp_get_connlist(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
int *returned_no, __u8 conn_numbers[256]);
long
ncp_get_stations_logged_info(struct ncp_conn *conn,
__u32 connection,
struct ncp_bindery_object *target,
time_t * login_time);
long
ncp_get_internet_address(struct ncp_conn *conn,
__u32 connection,
struct sockaddr_ipx *target,
__u8 * conn_type);
long
ncp_send_broadcast(struct ncp_conn *conn,
__u8 no_conn, const __u8 * connections,
const char *message);
long
ncp_send_broadcast2(struct ncp_conn *conn,
unsigned int conns, const unsigned int* connlist,
const char* message);
#endif /* not __MAKE_SULIB__ */
long
ncp_get_encryption_key(struct ncp_conn *conn,
char *target);
#ifndef __MAKE_SULIB__
long
ncp_get_bindery_object_id(struct ncp_conn *conn,
__u16 object_type,
const char *object_name,
struct ncp_bindery_object *target);
long
ncp_get_bindery_object_name(struct ncp_conn *conn,
__u32 object_id,
struct ncp_bindery_object *target);
long
ncp_scan_bindery_object(struct ncp_conn *conn,
__u32 last_id, __u16 object_type, char *search_string,
struct ncp_bindery_object *target);
long
ncp_create_bindery_object(struct ncp_conn *conn,
__u16 object_type,
const char *object_name,
__u8 object_security,
__u8 object_status);
long
ncp_delete_bindery_object(struct ncp_conn *conn,
__u16 object_type,
const char *object_name);
long
ncp_change_object_security(struct ncp_conn *conn,
__u16 object_type,
const char *object_name,
__u8 security);
#endif /* not __MAKE_SULIB__ */
struct ncp_station_addr
{
__u32 NetWork __attribute__((packed));
__u8 Node[6] __attribute__((packed));
__u16 Socket __attribute__((packed));
};
struct ncp_prop_login_control
{
__u8 AccountExpireDate[3] __attribute__((packed));
__u8 Disabled __attribute__((packed));
__u8 PasswordExpireDate[3] __attribute__((packed));
__u8 GraceLogins __attribute__((packed));
__u16 PasswordExpireInterval __attribute__((packed));
__u8 MaxGraceLogins __attribute__((packed));
__u8 MinPasswordLength __attribute__((packed));
__u16 MaxConnections __attribute__((packed));
__u8 ConnectionTimeMask[42] __attribute__((packed));
__u8 LastLogin[6] __attribute__((packed));
__u8 RestrictionMask __attribute__((packed));
__u8 reserved __attribute__((packed));
__u32 MaxDiskUsage __attribute__((packed));
__u16 BadLoginCount __attribute__((packed));
__u32 BadLoginCountDown __attribute__((packed));
struct ncp_station_addr LastIntruder __attribute__((packed));
};
long
ncp_read_property_value(struct ncp_conn *conn,
int object_type, const char *object_name,
int segment, const char *prop_name,
struct nw_property *target);
#ifndef __MAKE_SULIB__
long
ncp_scan_property(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
__u32 last_id, const char *search_string,
struct ncp_property_info *property_info);
long
ncp_add_object_to_set(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const char *property_name,
__u16 member_type,
const char *member_name);
long
ncp_change_property_security(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const char *property_name,
__u8 property_security);
long
ncp_create_property(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const char *property_name,
__u8 property_flags, __u8 property_security);
long
ncp_delete_object_from_set(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const char *property_name,
__u16 member_type,
const char *member_name);
long
ncp_delete_property(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const char *property_name);
long
ncp_write_property_value(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const char *property_name,
__u8 segment,
const struct nw_property *property_value);
/* Bit masks for security flag */
#define NCP_SEC_CHECKSUMMING_REQUESTED (1)
#define NCP_SEC_SIGNATURE_REQUESTED (2)
#define NCP_SEC_COMPLETE_SIGNATURES_REQUESTED (4)
#define NCP_SEC_ENCRYPTION_REQUESTED (8)
#define NCP_SEC_LIP_DISABLED (128)
long
ncp_get_big_ncp_max_packet_size(struct ncp_conn *conn,
__u16 proposed_max_size,
__u8 proposed_security_flag,
__u16 * accepted_max_size,
__u16 * echo_socket,
__u8 * accepted_security_flag);
long
ncp_login_encrypted(struct ncp_conn *conn,
const struct ncp_bindery_object *object,
const unsigned char *key,
const unsigned char *passwd);
long
ncp_login_unencrypted(struct ncp_conn *conn,
__u16 object_type, const char *object_name,
const unsigned char *passwd);
long
ncp_change_login_passwd(struct ncp_conn *conn,
const struct ncp_bindery_object *object,
const unsigned char *key,
const unsigned char *oldpasswd,
const unsigned char *newpasswd);
#endif /* not __MAKE_SULIB__ */
#define NWE_SIGNATURE_LEVEL_CONFLICT (0x8861)
#define NCP_GRACE_PERIOD (0xdf)
#ifndef __MAKE_SULIB__
long
ncp_get_bindery_object_id(struct ncp_conn *conn,
__u16 object_type,
const char *object_name,
struct ncp_bindery_object *target);
#endif /* not __MAKE_SULIB__ */
long
ncp_login_user(struct ncp_conn *conn,
const unsigned char *username,
const unsigned char *password);
#ifndef __MAKE_SULIB__
long
ncp_get_volume_info_with_number(struct ncp_conn *conn, int n,
struct ncp_volume_info *target);
long
ncp_get_volume_number(struct ncp_conn *conn, const char *name,
int *target);
long
ncp_file_search_init(struct ncp_conn *conn,
int dir_handle, const char *path,
struct ncp_filesearch_info *target);
long
ncp_file_search_continue(struct ncp_conn *conn,
struct ncp_filesearch_info *fsinfo,
int attributes, const char *path,
struct ncp_file_info *target);
long
ncp_get_finfo(struct ncp_conn *conn,
int dir_handle, const char *path, const char *name,
struct ncp_file_info *target);
long
ncp_open_file(struct ncp_conn *conn,
int dir_handle, const char *path,
int attr, int access,
struct ncp_file_info *target);
long
ncp_close_file(struct ncp_conn *conn, const char *file_id);
long
ncp_create_newfile(struct ncp_conn *conn,
int dir_handle, const char *path,
int attr,
struct ncp_file_info *target);
long
ncp_create_file(struct ncp_conn *conn,
int dir_handle, const char *path,
int attr,
struct ncp_file_info *target);
long
ncp_erase_file(struct ncp_conn *conn,
int dir_handle, const char *path,
int attr);
long
ncp_rename_file(struct ncp_conn *conn,
int old_handle, const char *old_path,
int attr,
int new_handle, const char *new_path);
long
ncp_create_directory(struct ncp_conn *conn,
int dir_handle, const char *path,
int inherit_mask);
long
ncp_delete_directory(struct ncp_conn *conn,
int dir_handle, const char *path);
long
ncp_rename_directory(struct ncp_conn *conn,
int dir_handle,
const char *old_path, const char *new_path);
long
ncp_get_trustee(struct ncp_conn *conn, __u32 object_id,
__u8 vol, char *path,
__u16 * trustee, __u16 * contin);
long
ncp_add_trustee(struct ncp_conn *conn,
int dir_handle, const char *path,
__u32 object_id, __u8 rights);
long
ncp_delete_trustee(struct ncp_conn *conn,
int dir_handle, const char *path, __u32 object_id);
long
ncp_read(struct ncp_conn *conn, const char *file_id,
off_t offset, size_t count, char *target);
long
ncp_write(struct ncp_conn *conn, const char *file_id,
off_t offset, size_t count, const char *source);
long
ncp_copy_file(struct ncp_conn *conn,
const char source_file[6],
const char target_file[6],
__u32 source_offset,
__u32 target_offset,
__u32 count,
__u32 * copied_count);
#define SA_NORMAL (0x0000)
#define SA_HIDDEN (0x0002)
#define SA_SYSTEM (0x0004)
#define SA_SUBDIR_ONLY (0x0010)
#define SA_SUBDIR_FILES (0x8000)
#define SA_ALL (SA_SUBDIR_FILES | SA_SYSTEM | SA_HIDDEN)
#define SA_SUBDIR_ALL (SA_SUBDIR_ONLY | SA_SYSTEM | SA_HIDDEN)
#define SA_FILES_ALL (SA_NORMAL | SA_SYSTEM | SA_HIDDEN)
long
ncp_obtain_file_or_subdir_info(struct ncp_conn *conn,
__u8 source_ns, __u8 target_ns,
__u16 search_attribs, __u32 rim,
__u8 vol, __u32 dirent, const char *path,
struct nw_info_struct *target);
#define NCP_PERM_READ (0x001)
#define NCP_PERM_WRITE (0x002)
#define NCP_PERM_OPEN (0x004)
#define NCP_PERM_CREATE (0x008)
#define NCP_PERM_DELETE (0x010)
#define NCP_PERM_OWNER (0x020)
#define NCP_PERM_SEARCH (0x040)
#define NCP_PERM_MODIFY (0x080)
#define NCP_PERM_SUPER (0x100)
long
ncp_get_eff_directory_rights(struct ncp_conn *conn,
__u8 source_ns, __u8 target_ns,
__u16 search_attribs,
__u8 vol, __u32 dirent, const char *path,
__u16 * my_effective_rights);
long
ncp_do_lookup(struct ncp_conn *conn,
struct nw_info_struct *dir,
const char *path, /* may only be one component */
struct nw_info_struct *target);
long
ncp_modify_file_or_subdir_dos_info(struct ncp_conn *conn,
struct nw_info_struct *file,
__u32 info_mask,
struct nw_modify_dos_info *info);
long
ncp_del_file_or_subdir(struct ncp_conn *conn,
struct nw_info_struct *dir, char *name);
long
ncp_open_create_file_or_subdir(struct ncp_conn *conn,
struct nw_info_struct *dir, char *name,
int open_create_mode,
__u32 create_attributes,
int desired_acc_rights,
struct nw_file_info *target);
long
ncp_initialize_search(struct ncp_conn *conn,
const struct nw_info_struct *dir,
int namespace,
struct ncp_search_seq *target);
long
ncp_search_for_file_or_subdir2(struct ncp_conn *conn,
int search_attributes,
u_int32_t RIM,
struct ncp_search_seq *seq,
struct nw_info_struct *target);
long
ncp_search_for_file_or_subdir(struct ncp_conn *conn,
struct ncp_search_seq *seq,
struct nw_info_struct *target);
long
ncp_ren_or_mov_file_or_subdir(struct ncp_conn *conn,
struct nw_info_struct *old_dir, char *old_name,
struct nw_info_struct *new_dir, char *new_name);
long
ncp_create_queue_job_and_file(struct ncp_conn *conn,
__u32 queue_id,
struct queue_job *job);
long
ncp_get_queue_length(struct ncp_conn *conn,
__u32 queue_id,
__u32 *queue_length);
long
ncp_get_queue_job_ids(struct ncp_conn *conn,
__u32 queue_id,
__u32 queue_section,
__u32 *length1,
__u32 *length2,
__u32 ids[]);
long
ncp_get_queue_job_info(struct ncp_conn *conn,
__u32 queue_id,
__u32 job_id,
struct nw_queue_job_entry *jobdata);
long
NWRemoveJobFromQueue2(struct ncp_conn* conn, __u32 queue_id, __u32 job_id);
long
ncp_close_file_and_start_job(struct ncp_conn *conn,
__u32 queue_id,
struct queue_job *job);
long
ncp_attach_to_queue(struct ncp_conn *conn,
__u32 queue_id);
long
ncp_detach_from_queue(struct ncp_conn *conn,
__u32 queue_id);
long
ncp_service_queue_job(struct ncp_conn *conn, __u32 queue_id, __u16 job_type,
struct queue_job *job);
long
ncp_finish_servicing_job(struct ncp_conn *conn, __u32 queue_id,
__u32 job_number, __u32 charge_info);
long
ncp_abort_servicing_job(struct ncp_conn *conn, __u32 queue_id,
__u32 job_number);
#endif /* not __MAKE_SULIB__ */
long
ncp_get_broadcast_message(struct ncp_conn *conn, char message[256]);
#ifndef __MAKE_SULIB__
long
ncp_dealloc_dir_handle(struct ncp_conn *conn, __u8 dir_handle);
#define NCP_ALLOC_PERMANENT (0x0000)
#define NCP_ALLOC_TEMPORARY (0x0001)
#define NCP_ALLOC_SPECIAL (0x0002)
long
ncp_alloc_short_dir_handle(struct ncp_conn *conn,
struct nw_info_struct *dir,
__u16 alloc_mode,
__u8 * target);
long
ncp_get_effective_dir_rights(struct ncp_conn *conn,
struct nw_info_struct *file,
__u16 * target);
struct ncp_trustee_struct
{
__u32 object_id;
__u16 rights;
};
long
ncp_add_trustee_set(struct ncp_conn *conn,
__u8 volume_number, __u32 dir_entry,
__u16 rights_mask,
int object_count, struct ncp_trustee_struct *rights);
struct ncp_deleted_file
{
int32_t seq;
__u32 vol;
__u32 base;
};
long
ncp_ns_scan_salvageable_file(struct ncp_conn* conn, __u8 src_ns,
int dirstyle, __u8 vol_num,
__u32 dir_base,
const unsigned char* encpath, int pathlen,
struct ncp_deleted_file* finfo,
char* name, int maxnamelen);
long
ncp_ns_purge_file(struct ncp_conn* conn, const struct ncp_deleted_file* finfo);
long
ncp_ns_get_full_name(struct ncp_conn* conn, __u8 src_ns, __u8 dst_ns,
int dirstyle, __u8 vol_num, __u32 dir_base,
const unsigned char* encpath, size_t pathlen,
char* name, size_t maxnamelen);
#endif /* not __MAKE_SULIB__ */
#ifdef SIGNATURES
long
ncp_sign_start(struct ncp_conn *conn, const char *sign_root);
#endif /* SIGNATURES */
#ifdef NDS_SUPPORT
long
ncp_send_nds_frag(struct ncp_conn *conn,
int ndsverb,
const char *inbuf, size_t inbuflen,
char *outbuf, size_t outbufsize, size_t *outbuflen);
long
ncp_send_nds(struct ncp_conn *conn, int fn,
const char *data_in, size_t data_in_len,
char *data_out, size_t data_out_max, size_t *data_out_len);
long
ncp_change_conn_state(struct ncp_conn *conn, int new_state);
#endif
struct ncp_conn *
ncp_open_addr(struct sockaddr *target, long *err);
#ifdef __MAKE_SULIB__
int
ncp_path_to_NW_format(const char* path, unsigned char* buff, int buffsize);
long
ncp_obtain_file_or_subdir_info2(struct ncp_conn* conn, __u8 source_ns,
__u8 target_ns, __u16 search_attribs, __u32 rim,
int dir_style, __u8 vol, __u32 dirent,
const unsigned char* path, int pathlen,
struct nw_info_struct* target);
#endif /* __MAKE_SULIB__ */
int
ncp_get_mount_uid(int fid, uid_t* uid);
#ifdef __MAKE_SULIB__
long
ncp_renegotiate_connparam(struct ncp_conn* conn, int buffsize, int options);
#endif /* __MAKE_SULIB__ */
#endif /* _NCPLIB_H */

View File

@@ -1,18 +0,0 @@
#ifdef SIGNATURES
/*
* ncpsign.h
*
* Arne de Bruijn (arne@knoware.nl), 1997
*
*/
#ifndef _NCPSIGN_H
#define _NCPSIGN_H
#include "ncplib.h"
void sign_init(const char *logindata, char *sign_root);
void sign_packet(struct ncp_conn *conn, int *size);
#endif
#endif

View File

@@ -0,0 +1,127 @@
#ifndef _PRIVATE_ALPHA_ATOMIC_H
#define _PRIVATE_ALPHA_ATOMIC_H
#define mb() \
__asm__ __volatile__("mb": : :"memory")
#define rmb() \
__asm__ __volatile__("mb": : :"memory")
#define wmb() \
__asm__ __volatile__("wmb": : :"memory")
#define smp_mb() mb()
#define smp_rmb() rmb()
#define smp_wmb() wmb()
/*
* Atomic operations that C can't guarantee us. Useful for
* resource counting etc...
*
* But use these as seldom as possible since they are much slower
* than regular operations.
*/
/*
* Counter is volatile to make sure gcc doesn't try to be clever
* and move things around on us. We need to use _exactly_ the address
* the user gave us, not some alias that contains the same information.
*/
typedef struct { volatile int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) ( (ncpt_atomic_t) { (i) } )
#define ncpt_atomic_read(v) ((v)->counter)
#define ncpt_atomic_set(v,i) ((v)->counter = (i))
/*
* To get proper branch prediction for the main line, we must branch
* forward to code at the end of this object's .text section, then
* branch back to restart the operation.
*/
static __inline__ void ncpt_atomic_add(int i, ncpt_atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" addl %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter)
:"Ir" (i), "m" (v->counter));
}
static __inline__ void ncpt_atomic_sub(int i, ncpt_atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" subl %0,%2,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter)
:"Ir" (i), "m" (v->counter));
}
/*
* Same as above, but return the result value
*/
static __inline__ long ncpt_atomic_add_return(int i, ncpt_atomic_t * v)
{
long temp, result;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" addl %0,%3,%2\n"
" addl %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
" mb\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter), "=&r" (result)
:"Ir" (i), "m" (v->counter) : "memory");
return result;
}
static __inline__ long ncpt_atomic_sub_return(int i, ncpt_atomic_t * v)
{
long temp, result;
__asm__ __volatile__(
"1: ldl_l %0,%1\n"
" subl %0,%3,%2\n"
" subl %0,%3,%0\n"
" stl_c %0,%1\n"
" beq %0,2f\n"
" mb\n"
".subsection 2\n"
"2: br 1b\n"
".previous"
:"=&r" (temp), "=m" (v->counter), "=&r" (result)
:"Ir" (i), "m" (v->counter) : "memory");
return result;
}
#define ncpt_atomic_dec_return(v) ncpt_atomic_sub_return(1,(v))
#define ncpt_atomic_inc_return(v) ncpt_atomic_add_return(1,(v))
#define ncpt_atomic_sub_and_test(i,v) (ncpt_atomic_sub_return((i), (v)) == 0)
#define ncpt_atomic_dec_and_test(v) (ncpt_atomic_sub_return(1, (v)) == 0)
#define ncpt_atomic_inc(v) ncpt_atomic_add(1,(v))
#define ncpt_atomic_dec(v) ncpt_atomic_sub(1,(v))
#define smp_mb__before_ncpt_atomic_dec() smp_mb()
#define smp_mb__after_ncpt_atomic_dec() smp_mb()
#define smp_mb__before_ncpt_atomic_inc() smp_mb()
#define smp_mb__after_ncpt_atomic_inc() smp_mb()
#endif /* _ALPHA_ATOMIC_H */

View File

@@ -0,0 +1,54 @@
#ifndef __PRIVATE_LIBNCP_GENERIC_ATOMIC_H__
#define __PRIVATE_LIBNCP_GENERIC_ATOMIC_H__
#include "config.h"
#include "private/libncp-lock.h"
typedef struct {
int counter;
ncpt_mutex_t mutex;
} ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i), NCPT_MUTEX_INITIALIZER }
static inline int ncpt_atomic_read(ncpt_atomic_t* v) {
int tmp;
ncpt_mutex_lock(&v->mutex);
tmp = v->counter;
ncpt_mutex_unlock(&v->mutex);
return tmp;
}
static inline int ncpt_atomic_set(ncpt_atomic_t* v, int i) {
v->counter = i;
ncpt_mutex_init(&v->mutex);
return i;
}
static inline void ncpt_atomic_add(int i, ncpt_atomic_t* v) {
ncpt_mutex_lock(&v->mutex);
v->counter += i;
ncpt_mutex_unlock(&v->mutex);
}
static inline void ncpt_atomic_sub(int i, ncpt_atomic_t* v) {
ncpt_mutex_lock(&v->mutex);
v->counter -= i;
ncpt_mutex_unlock(&v->mutex);
}
#define ncpt_atomic_inc(v) ncpt_atomic_add(1,v)
#define ncpt_atomic_dec(v) ncpt_atomic_sub(1,v)
static inline int ncpt_atomic_dec_and_test(ncpt_atomic_t* v) {
int tmp;
ncpt_mutex_lock(&v->mutex);
tmp = !(--v->counter);
ncpt_mutex_unlock(&v->mutex);
return tmp;
}
#endif /* __PRIVATE_LIBNCP_GENERIC_ATOMIC_H__ */

View File

@@ -0,0 +1,202 @@
#ifndef __PRIVATE_ASM_I386_ATOMIC__
#define __PRIVATE_ASM_I386_ATOMIC__
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
/*
* Atomic operations that C can't guarantee us. Useful for
* resource counting etc..
*/
#define LOCK "lock ; "
/*
* Make sure gcc doesn't try to be clever and move things around
* on us. We need to use _exactly_ the address the user gave us,
* not some alias that contains the same information.
*/
typedef struct { volatile int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i) }
/**
* ncpt_atomic_read - read atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically reads the value of @v. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_read(v) ((v)->counter)
/**
* ncpt_atomic_set - set atomic variable
* @v: pointer of type ncpt_atomic_t
* @i: required value
*
* Atomically sets the value of @v to @i. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_set(v,i) (((v)->counter) = (i))
/**
* ncpt_atomic_add - add integer to atomic variable
* @i: integer value to add
* @v: pointer of type ncpt_atomic_t
*
* Atomically adds @i to @v. Note that the guaranteed useful range
* of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ void ncpt_atomic_add(int i, ncpt_atomic_t *v)
{
__asm__ __volatile__(
LOCK "addl %1,%0"
:"=m" (v->counter)
:"ir" (i), "m" (v->counter));
}
/**
* ncpt_atomic_sub - subtract the atomic variable
* @i: integer value to subtract
* @v: pointer of type ncpt_atomic_t
*
* Atomically subtracts @i from @v. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ void ncpt_atomic_sub(int i, ncpt_atomic_t *v)
{
__asm__ __volatile__(
LOCK "subl %1,%0"
:"=m" (v->counter)
:"ir" (i), "m" (v->counter));
}
/**
* ncpt_atomic_sub_and_test - subtract value from variable and test result
* @i: integer value to subtract
* @v: pointer of type ncpt_atomic_t
*
* Atomically subtracts @i from @v and returns
* true if the result is zero, or false for all
* other cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ int ncpt_atomic_sub_and_test(int i, ncpt_atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
LOCK "subl %2,%0; sete %1"
:"=m" (v->counter), "=qm" (c)
:"ir" (i), "m" (v->counter) : "memory");
return c;
}
/**
* ncpt_atomic_inc - increment atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically increments @v by 1. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ void ncpt_atomic_inc(ncpt_atomic_t *v)
{
__asm__ __volatile__(
LOCK "incl %0"
:"=m" (v->counter)
:"m" (v->counter));
}
/**
* ncpt_atomic_dec - decrement atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically decrements @v by 1. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ void ncpt_atomic_dec(ncpt_atomic_t *v)
{
__asm__ __volatile__(
LOCK "decl %0"
:"=m" (v->counter)
:"m" (v->counter));
}
/**
* ncpt_atomic_dec_and_test - decrement and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically decrements @v by 1 and
* returns true if the result is 0, or false for all other
* cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ int ncpt_atomic_dec_and_test(ncpt_atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
LOCK "decl %0; sete %1"
:"=m" (v->counter), "=qm" (c)
:"m" (v->counter) : "memory");
return c != 0;
}
/**
* ncpt_atomic_inc_and_test - increment and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ int ncpt_atomic_inc_and_test(ncpt_atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
LOCK "incl %0; sete %1"
:"=m" (v->counter), "=qm" (c)
:"m" (v->counter) : "memory");
return c != 0;
}
/**
* ncpt_atomic_add_negative - add and test if negative
* @v: pointer of type ncpt_atomic_t
* @i: integer value to add
*
* Atomically adds @i to @v and returns true
* if the result is negative, or false when
* result is greater than or equal to zero. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
static __inline__ int ncpt_atomic_add_negative(int i, ncpt_atomic_t *v)
{
unsigned char c;
__asm__ __volatile__(
LOCK "addl %2,%0; sets %1"
:"=m" (v->counter), "=qm" (c)
:"ir" (i), "m" (v->counter) : "memory");
return c;
}
/* These are x86-specific, used by some header files */
#define ncpt_atomic_clear_mask(mask, addr) \
__asm__ __volatile__(LOCK "andl %0,%1" \
: : "r" (~(mask)),"m" (*addr) : "memory")
#define ncpt_atomic_set_mask(mask, addr) \
__asm__ __volatile__(LOCK "orl %0,%1" \
: : "r" (mask),"m" (*addr) : "memory")
/* Atomic operations are already serializing on x86 */
#define smp_mb__before_ncpt_atomic_dec() barrier()
#define smp_mb__after_ncpt_atomic_dec() barrier()
#define smp_mb__before_ncpt_atomic_inc() barrier()
#define smp_mb__after_ncpt_atomic_inc() barrier()
#endif

View File

@@ -0,0 +1,62 @@
#ifndef __PRIVATE_ARCH_M68K_ATOMIC__
#define __PRIVATE_ARCH_M68K_ATOMIC__
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
/*
* Atomic operations that C can't guarantee us. Useful for
* resource counting etc..
*/
/*
* We do not have SMP m68k systems, so we don't have to deal with that.
*/
typedef struct { int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i) }
#define ncpt_atomic_read(v) ((v)->counter)
#define ncpt_atomic_set(v, i) (((v)->counter) = i)
static __inline__ void ncpt_atomic_add(int i, ncpt_atomic_t *v)
{
__asm__ __volatile__("addl %1,%0" : "=m" (*v) : "id" (i), "0" (*v));
}
static __inline__ void ncpt_atomic_sub(int i, ncpt_atomic_t *v)
{
__asm__ __volatile__("subl %1,%0" : "=m" (*v) : "id" (i), "0" (*v));
}
static __inline__ void ncpt_atomic_inc(volatile ncpt_atomic_t *v)
{
__asm__ __volatile__("addql #1,%0" : "=m" (*v): "0" (*v));
}
static __inline__ void ncpt_atomic_dec(volatile ncpt_atomic_t *v)
{
__asm__ __volatile__("subql #1,%0" : "=m" (*v): "0" (*v));
}
static __inline__ int ncpt_atomic_dec_and_test(volatile ncpt_atomic_t *v)
{
char c;
__asm__ __volatile__("subql #1,%1; seq %0" : "=d" (c), "=m" (*v): "1" (*v));
return c != 0;
}
#define ncpt_atomic_clear_mask(mask, v) \
__asm__ __volatile__("andl %1,%0" : "=m" (*v) : "id" (~(mask)),"0"(*v))
#define ncpt_atomic_set_mask(mask, v) \
__asm__ __volatile__("orl %1,%0" : "=m" (*v) : "id" (mask),"0"(*v))
/* Atomic operations are already serializing */
#define smp_mb__before_ncpt_atomic_dec() barrier()
#define smp_mb__after_ncpt_atomic_dec() barrier()
#define smp_mb__before_ncpt_atomic_inc() barrier()
#define smp_mb__after_ncpt_atomic_inc() barrier()
#endif /* __ARCH_M68K_ATOMIC __ */

View File

@@ -0,0 +1,212 @@
/*
* Atomic operations that C can't guarantee us. Useful for
* resource counting etc..
*
* But use these as seldom as possible since they are much more slower
* than regular operations.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996, 1997, 2000 by Ralf Baechle
*/
#ifndef __PRIVATE_ASM_ATOMIC_H
#define __PRIVATE_ASM_ATOMIC_H
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
typedef struct { volatile int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i) }
/*
* ncpt_atomic_read - read atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically reads the value of @v. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_read(v) ((v)->counter)
/*
* ncpt_atomic_set - set atomic variable
* @v: pointer of type ncpt_atomic_t
* @i: required value
*
* Atomically sets the value of @v to @i. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_set(v,i) ((v)->counter = (i))
/*
* ... while for MIPS II and better we can use ll/sc instruction. This
* implementation is SMP safe ...
*/
/*
* ncpt_atomic_add - add integer to atomic variable
* @i: integer value to add
* @v: pointer of type ncpt_atomic_t
*
* Atomically adds @i to @v. Note that the guaranteed useful range
* of an ncpt_atomic_t is only 24 bits.
*/
/* Hope that compiler will complain at ll/sc when CPU we are compiling
* (MIPS I) for does not have them...
*/
extern __inline__ void ncpt_atomic_add(int i, ncpt_atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ll %0, %1 # ncpt_atomic_add\n"
" addu %0, %2 \n"
" sc %0, %1 \n"
" beqz %0, 1b \n"
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
}
/*
* ncpt_atomic_sub - subtract the atomic variable
* @i: integer value to subtract
* @v: pointer of type ncpt_atomic_t
*
* Atomically subtracts @i from @v. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
extern __inline__ void ncpt_atomic_sub(int i, ncpt_atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1: ll %0, %1 # ncpt_atomic_sub\n"
" subu %0, %2 \n"
" sc %0, %1 \n"
" beqz %0, 1b \n"
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
}
/*
* Same as above, but return the result value
*/
extern __inline__ int ncpt_atomic_add_return(int i, ncpt_atomic_t * v)
{
unsigned long temp, result;
__asm__ __volatile__(
".set push # ncpt_atomic_add_return\n"
".set noreorder \n"
"1: ll %1, %2 \n"
" addu %0, %1, %3 \n"
" sc %0, %2 \n"
" beqz %0, 1b \n"
" addu %0, %1, %3 \n"
".set pop \n"
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter)
: "memory");
return result;
}
extern __inline__ int ncpt_atomic_sub_return(int i, ncpt_atomic_t * v)
{
unsigned long temp, result;
__asm__ __volatile__(
".set push \n"
".set noreorder # ncpt_atomic_sub_return\n"
"1: ll %1, %2 \n"
" subu %0, %1, %3 \n"
" sc %0, %2 \n"
" beqz %0, 1b \n"
" subu %0, %1, %3 \n"
".set pop \n"
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter)
: "memory");
return result;
}
#endif
#define ncpt_atomic_dec_return(v) ncpt_atomic_sub_return(1,(v))
#define ncpt_atomic_inc_return(v) ncpt_atomic_add_return(1,(v))
/*
* ncpt_atomic_sub_and_test - subtract value from variable and test result
* @i: integer value to subtract
* @v: pointer of type ncpt_atomic_t
*
* Atomically subtracts @i from @v and returns
* true if the result is zero, or false for all
* other cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_sub_and_test(i,v) (ncpt_atomic_sub_return((i), (v)) == 0)
/*
* ncpt_atomic_inc_and_test - increment and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_inc_and_test(v) (ncpt_atomic_inc_return(1, (v)) == 0)
/*
* ncpt_atomic_dec_and_test - decrement by 1 and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically decrements @v by 1 and
* returns true if the result is 0, or false for all other
* cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_dec_and_test(v) (ncpt_atomic_sub_return(1, (v)) == 0)
/*
* ncpt_atomic_inc - increment atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically increments @v by 1. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_inc(v) ncpt_atomic_add(1,(v))
/*
* ncpt_atomic_dec - decrement and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically decrements @v by 1. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_dec(v) ncpt_atomic_sub(1,(v))
/*
* ncpt_atomic_add_negative - add and test if negative
* @v: pointer of type ncpt_atomic_t
* @i: integer value to add
*
* Atomically adds @i to @v and returns true
* if the result is negative, or false when
* result is greater than or equal to zero. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*
* Currently not implemented for MIPS.
*/
/* Atomic operations are already serializing */
#define smp_mb__before_ncpt_atomic_dec() barrier()
#define smp_mb__after_ncpt_atomic_dec() barrier()
#define smp_mb__before_ncpt_atomic_inc() barrier()
#define smp_mb__after_ncpt_atomic_inc() barrier()
#endif /* __ASM_ATOMIC_H */

View File

@@ -0,0 +1,193 @@
/*
* Atomic operations that C can't guarantee us. Useful for
* resource counting etc..
*
* But use these as seldom as possible since they are much more slower
* than regular operations.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996, 1997, 1999, 2000 by Ralf Baechle
*/
#ifndef _PRIVATE_ASM_ATOMIC_H
#define _PRIVATE_ASM_ATOMIC_H
/* Optimization barrier */
/* The "volatile" is due to gcc bugs */
#define barrier() __asm__ __volatile__("": : :"memory")
typedef struct { volatile int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i) }
/*
* ncpt_atomic_read - read atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically reads the value of @v. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_read(v) ((v)->counter)
/*
* ncpt_atomic_set - set atomic variable
* @v: pointer of type ncpt_atomic_t
* @i: required value
*
* Atomically sets the value of @v to @i. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_set(v,i) ((v)->counter = (i))
extern __inline__ void ncpt_atomic_add(int i, volatile ncpt_atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1:\tll\t%0,%1\t\t\t# ncpt_atomic_add\n\t"
"addu\t%0,%2\n\t"
"sc\t%0,%1\n\t"
"beqz\t%0,1b"
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
}
/*
* ncpt_atomic_sub - subtract the atomic variable
* @i: integer value to subtract
* @v: pointer of type ncpt_atomic_t
*
* Atomically subtracts @i from @v. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
extern __inline__ void ncpt_atomic_sub(int i, volatile ncpt_atomic_t * v)
{
unsigned long temp;
__asm__ __volatile__(
"1:\tll\t%0,%1\t\t\t# ncpt_atomic_sub\n\t"
"subu\t%0,%2\n\t"
"sc\t%0,%1\n\t"
"beqz\t%0,1b"
: "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter));
}
/*
* Same as above, but return the result value
*/
extern __inline__ int ncpt_atomic_add_return(int i, ncpt_atomic_t * v)
{
unsigned long temp, result;
__asm__ __volatile__(
".set\tnoreorder\t\t\t# ncpt_atomic_add_return\n"
"1:\tll\t%1,%2\n\t"
"addu\t%0,%1,%3\n\t"
"sc\t%0,%2\n\t"
"beqz\t%0,1b\n\t"
"addu\t%0,%1,%3\n\t"
".set\treorder"
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter)
: "memory");
return result;
}
extern __inline__ int ncpt_atomic_sub_return(int i, ncpt_atomic_t * v)
{
unsigned long temp, result;
__asm__ __volatile__(
".set\tnoreorder\t\t\t# ncpt_atomic_sub_return\n"
"1:\tll\t%1,%2\n\t"
"subu\t%0,%1,%3\n\t"
"sc\t%0,%2\n\t"
"beqz\t%0,1b\n\t"
"subu\t%0,%1,%3\n\t"
".set\treorder"
: "=&r" (result), "=&r" (temp), "=m" (v->counter)
: "Ir" (i), "m" (v->counter)
: "memory");
return result;
}
#define ncpt_atomic_dec_return(v) ncpt_atomic_sub_return(1,(v))
#define ncpt_atomic_inc_return(v) ncpt_atomic_add_return(1,(v))
/*
* ncpt_atomic_sub_and_test - subtract value from variable and test result
* @i: integer value to subtract
* @v: pointer of type ncpt_atomic_t
*
* Atomically subtracts @i from @v and returns
* true if the result is zero, or false for all
* other cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_sub_and_test(i,v) (ncpt_atomic_sub_return((i), (v)) == 0)
/*
* ncpt_atomic_inc_and_test - increment and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically increments @v by 1
* and returns true if the result is zero, or false for all
* other cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
* ncpt_atomic_inc_and_test is currently not implemented for mips64.
*/
/*
* ncpt_atomic_dec_and_test - decrement by 1 and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically decrements @v by 1 and
* returns true if the result is 0, or false for all other
* cases. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_dec_and_test(v) (ncpt_atomic_sub_return(1, (v)) == 0)
/*
* ncpt_atomic_inc - increment atomic variable
* @v: pointer of type ncpt_atomic_t
*
* Atomically increments @v by 1. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_inc(v) ncpt_atomic_add(1,(v))
/*
* ncpt_atomic_dec - decrement and test
* @v: pointer of type ncpt_atomic_t
*
* Atomically decrements @v by 1. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*/
#define ncpt_atomic_dec(v) ncpt_atomic_sub(1,(v))
/*
* ncpt_atomic_add_negative - add and test if negative
* @v: pointer of type ncpt_atomic_t
* @i: integer value to add
*
* Atomically adds @i to @v and returns true
* if the result is negative, or false when
* result is greater than or equal to zero. Note that the guaranteed
* useful range of an ncpt_atomic_t is only 24 bits.
*
* ncpt_atomic_add_negative is currently not implemented for mips64.
*/
/* Atomic operations are already serializing */
#define smp_mb__before_ncpt_atomic_dec() barrier()
#define smp_mb__after_ncpt_atomic_dec() barrier()
#define smp_mb__before_ncpt_atomic_inc() barrier()
#define smp_mb__after_ncpt_atomic_inc() barrier()
#endif /* _ASM_ATOMIC_H */

View File

@@ -0,0 +1,16 @@
#ifndef __PRIVATE_LIBNCP_NONE_ATOMIC_H__
#define __PRIVATE_LIBNCP_NONE_ATOMIC_H__
typedef struct { int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i) }
#define ncpt_atomic_read(v) ((v)->counter)
#define ncpt_atomic_set(v,i) (((v)->counter) = (i))
#define ncpt_atomic_add(i,v) (((v)->counter) += (i))
#define ncpt_atomic_sub(i,v) (((v)->counter) -= (i))
#define ncpt_atomic_inc(v) ((v)->counter++)
#define ncpt_atomic_dec(v) ((v)->counter--)
#define ncpt_atomic_dec_and_test(v) (!(--(v)->counter))
#endif /* __PRIVATE_LIBNCP_NONE_ATOMIC_H__ */

View File

@@ -0,0 +1,143 @@
/*
* BK Id: SCCS/s.atomic.h 1.8 05/17/01 18:14:24 cort
*/
/*
* PowerPC atomic operations
*/
#ifndef _ASM_PPC_ATOMIC_H_
#define _ASM_PPC_ATOMIC_H_
/*
* Memory barrier.
* The sync instruction guarantees that all memory accesses initiated
* by this processor have been performed (with respect to all other
* mechanisms that access memory). The eieio instruction is a barrier
* providing an ordering (separately) for (a) cacheable stores and (b)
* loads and stores to non-cacheable memory (e.g. I/O devices).
*
* mb() prevents loads and stores being reordered across this point.
* rmb() prevents loads being reordered across this point.
* wmb() prevents stores being reordered across this point.
*
* We can use the eieio instruction for wmb, but since it doesn't
* give any ordering guarantees about loads, we have to use the
* stronger but slower sync instruction for mb and rmb.
*/
#define mb() __asm__ __volatile__ ("sync" : : : "memory")
#define rmb() __asm__ __volatile__ ("sync" : : : "memory")
#define wmb() __asm__ __volatile__ ("eieio" : : : "memory")
#define smp_mb() mb()
#define smp_rmb() rmb()
#define smp_wmb() wmb()
typedef struct { volatile int counter; } ncpt_atomic_t;
#define NCPT_ATOMIC_INIT(i) { (i) }
#define ncpt_atomic_read(v) ((v)->counter)
#define ncpt_atomic_set(v,i) (((v)->counter) = (i))
extern void ncpt_atomic_clear_mask(unsigned long mask, unsigned long *addr);
extern void ncpt_atomic_set_mask(unsigned long mask, unsigned long *addr);
static __inline__ int ncpt_atomic_add_return(int a, ncpt_atomic_t *v)
{
int t;
__asm__ __volatile__("\n\
1: lwarx %0,0,%3\n\
add %0,%2,%0\n\
stwcx. %0,0,%3\n\
bne- 1b"
: "=&r" (t), "=m" (v->counter)
: "r" (a), "r" (v), "m" (v->counter)
: "cc");
return t;
}
static __inline__ int ncpt_atomic_sub_return(int a, ncpt_atomic_t *v)
{
int t;
__asm__ __volatile__("\n\
1: lwarx %0,0,%3\n\
subf %0,%2,%0\n\
stwcx. %0,0,%3\n\
bne- 1b"
: "=&r" (t), "=m" (v->counter)
: "r" (a), "r" (v), "m" (v->counter)
: "cc");
return t;
}
static __inline__ int ncpt_atomic_inc_return(ncpt_atomic_t *v)
{
int t;
__asm__ __volatile__("\n\
1: lwarx %0,0,%2\n\
addic %0,%0,1\n\
stwcx. %0,0,%2\n\
bne- 1b"
: "=&r" (t), "=m" (v->counter)
: "r" (v), "m" (v->counter)
: "cc");
return t;
}
static __inline__ int ncpt_atomic_dec_return(ncpt_atomic_t *v)
{
int t;
__asm__ __volatile__("\n\
1: lwarx %0,0,%2\n\
addic %0,%0,-1\n\
stwcx. %0,0,%2\n\
bne 1b"
: "=&r" (t), "=m" (v->counter)
: "r" (v), "m" (v->counter)
: "cc");
return t;
}
#define ncpt_atomic_add(a, v) ((void) ncpt_atomic_add_return((a), (v)))
#define ncpt_atomic_sub(a, v) ((void) ncpt_atomic_sub_return((a), (v)))
#define ncpt_atomic_sub_and_test(a, v) (ncpt_atomic_sub_return((a), (v)) == 0)
#define ncpt_atomic_inc(v) ((void) ncpt_atomic_inc_return((v)))
#define ncpt_atomic_dec(v) ((void) ncpt_atomic_dec_return((v)))
#define ncpt_atomic_dec_and_test(v) (ncpt_atomic_dec_return((v)) == 0)
/*
* Atomically test *v and decrement if it is greater than 0.
* The function returns the old value of *v minus 1.
*/
static __inline__ int ncpt_atomic_dec_if_positive(ncpt_atomic_t *v)
{
int t;
__asm__ __volatile__("\n"
"1: lwarx %0,0,%2\n"
" addic. %0,%0,-1\n"
" blt 2f\n"
" stwcx. %0,0,%2\n"
" bne 1b\n"
"2:"
: "=&r" (t), "=m" (v->counter)
: "r" (&v->counter), "m" (v->counter)
: "cc");
return t;
}
#define smp_mb__before_ncpt_atomic_dec() smp_mb()
#define smp_mb__after_ncpt_atomic_dec() smp_mb()
#define smp_mb__before_ncpt_atomic_inc() smp_mb()
#define smp_mb__after_ncpt_atomic_inc() smp_mb()
#endif /* _ASM_PPC_ATOMIC_H_ */

83
include/private/libintl.h Normal file
View File

@@ -0,0 +1,83 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published
by the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
USA. */
#ifndef __PRIVATE_LIBINTL_H__
#define __PRIVATE_LIBINTL_H__
#include "config.h"
/* NLS can be disabled through the configure --disable-nls option. */
#if ENABLE_NLS
/* Get declarations of GNU message catalog functions. */
# include <libintl.h>
#else
/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which
chokes if dcgettext is defined as a macro. So include it now, to make
later inclusions of <locale.h> a NOP. We don't include <libintl.h>
as well because people using "gettext.h" will not include <libintl.h>,
and also including <libintl.h> would fail on SunOS 4, whereas <locale.h>
is OK. */
#if defined(__sun)
# include <locale.h>
#endif
/* Disabled NLS.
The casts to 'const char *' serve the purpose of producing warnings
for invalid uses of the value returned from these functions.
On pre-ANSI systems without 'const', the config.h file is supposed to
contain "#define const". */
# define gettext(Msgid) ((const char *) (Msgid))
# define dgettext(Domainname, Msgid) ((const char *) (Msgid))
# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid))
# define ngettext(Msgid1, Msgid2, N) \
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# define dngettext(Domainname, Msgid1, Msgid2, N) \
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \
((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2))
# define textdomain(Domainname) ((const char *) (Domainname))
# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname))
# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset))
#endif
/* A pseudo function call that serves as a marker for the automated
extraction of messages, but does not call gettext(). The run-time
translation is done at a different place in the code.
The argument, String, should be a literal string. Concatenated strings
and other string expressions won't work.
The macro's expansion is not parenthesized, so that it is suitable as
initializer for static 'char[]' or 'const char[]' variables. */
#define gettext_noop(String) String
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
#ifndef HAVE_SETLOCALE
#define setlocale(X,Y) (Y)
#endif
#ifndef LC_ALL
#define LC_ALL 6 /* It is used when you have setlocale, but not locale.h header... */
#endif
#endif /* __PRIVATE_LIBINTL_H__ */

View File

@@ -0,0 +1,6 @@
#ifndef __PRIVATE_LIBNCP_ATOMIC_H__
#define __PRIVATE_LIBNCP_ATOMIC_H__
#include "private/asm-i386/atomic.h"
#endif /* __PRIVATE_LIBNCP_ATOMIC_H__ */

View File

@@ -0,0 +1,6 @@
#ifndef __PRIVATE_LIBNCP_ATOMIC_H__
#define __PRIVATE_LIBNCP_ATOMIC_H__
#include "private/asm-@ncphost@/atomic.h"
#endif /* __PRIVATE_LIBNCP_ATOMIC_H__ */

View File

@@ -0,0 +1,314 @@
/* original came from bits/libc-lock.h in libc-2.1.1 */
/* libc-internal interface for mutex locks. LinuxThreads version.
Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _PRIVATE_LIBNCP_LOCK_H
#define _PRIVATE_LIBNCP_LOCK_H 1
#ifdef _REENTRANT
#include <pthread.h>
typedef pthread_mutex_t ncpt_mutex_t;
typedef pthread_once_t ncpt_once_t;
typedef pthread_key_t ncpt_key_t;
#define NCPT_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER
/* Initialize the named lock variable, leaving it in a consistent, unlocked
state. */
#define ncpt_mutex_init(NAME) \
(pthread_mutex_init ? pthread_mutex_init (NAME, NULL) : 0);
/* Same as last but this time we initialize a recursive mutex. */
#define ncpt_mutex_init_recursive(NAME) \
do { \
if (pthread_mutex_init && pthread_mutexattr_init && \
pthread_mutexattr_settype && pthread_mutexattr_destroy) \
{ \
pthread_mutexattr_t __attr; \
pthread_mutexattr_init (&__attr); \
pthread_mutexattr_settype (&__attr, PTHREAD_MUTEX_RECURSIVE_NP); \
pthread_mutex_init (NAME, &__attr); \
pthread_mutexattr_destroy (&__attr); \
} \
} while (0);
/* Finalize the named lock variable, which must be locked. It cannot be
used again until __libc_lock_init is called again on it. This must be
called on a lock variable before the containing storage is reused. */
#define ncpt_mutex_destroy(NAME) \
(pthread_mutex_destroy ? pthread_mutex_destroy (NAME) : 0);
/* Lock the named lock variable. */
#define ncpt_mutex_lock(NAME) \
(pthread_mutex_lock ? pthread_mutex_lock (NAME) : 0);
/* Lock the recursive named lock variable. */
#define ncpt_mutex_lock_recursive(NAME) ncpt_mutex_lock (NAME)
/* Try to lock the named lock variable. */
#define ncpt_mutex_trylock(NAME) \
(pthread_mutex_trylock ? pthread_mutex_trylock (NAME) : 0)
/* Try to lock the recursive named lock variable. */
#define ncpt_mutex_trylock_recursive(NAME) ncpt_mutex_trylock (NAME)
/* Unlock the named lock variable. */
#define ncpt_mutex_unlock(NAME) \
(pthread_mutex_unlock ? pthread_mutex_unlock (NAME) : 0);
/* Unlock the recursive named lock variable. */
#define ncpt_mutex_unlock_recursive(NAME) ncpt_mutex_unlock (NAME)
#define NCPT_ONCE_INIT PTHREAD_ONCE_INIT
/* Call handler iff the first call. */
#define ncpt_once(ONCE_CONTROL, INIT_FUNCTION) \
do { \
if (pthread_once) \
pthread_once ((ONCE_CONTROL), (INIT_FUNCTION)); \
else if (*(ONCE_CONTROL) == NCPT_ONCE_INIT) { \
INIT_FUNCTION (); \
*(ONCE_CONTROL) = 1; \
} \
} while (0)
/* Start critical region with cleanup. */
#define __libc_cleanup_region_start(FCT, ARG) \
{ struct _pthread_cleanup_buffer _buffer; \
int _avail = _pthread_cleanup_push_defer != NULL; \
if (_avail) { \
_pthread_cleanup_push_defer (&_buffer, (FCT), (ARG)); \
}
/* End critical region with cleanup. */
#define __libc_cleanup_region_end(DOIT) \
if (_avail) { \
_pthread_cleanup_pop_restore (&_buffer, (DOIT)); \
} \
}
/* Sometimes we have to exit the block in the middle. */
#define __libc_cleanup_end(DOIT) \
if (_avail) { \
_pthread_cleanup_pop_restore (&_buffer, (DOIT)); \
}
#if 0
/* Create thread-specific key. */
static inline int ncpt_key_create(ncpt_key_t* KEY, void (*DESTRUCTOR)(void*)) {
ncpt_key_t k;
if (pthread_key_create)
return pthread_key_create(KEY, DESTRUCTOR);
k = (ncpt_key_t)malloc(sizeof(void*));
if (!k)
return ENOMEM;
*(void**)k = NULL;
*KEY = k;
return 0;
}
/* Get thread-specific data. */
static inline void* ncpt_getspecific(ncpt_key_t KEY) {
if (pthread_getspecific)
return pthread_getspecific(KEY);
if (KEY)
return *(void**)KEY;
return NULL;
}
/* Set thread-specific data. */
static inline int ncpt_setspecific(ncpt_key_t KEY, const void* VALUE) {
if (pthread_setspecific)
return pthread_setspecific(KEY, VALUE);
if (!KEY)
return EINVAL;
*(void**)KEY = VALUE;
return 0;
}
#endif
/* Register handlers to execute before and after `fork'. */
#define ncpt_atfork(PREPARE, PARENT, CHILD) \
(pthread_atfork ? pthread_atfork (PREPARE, PARENT, CHILD) : 0)
/* Make the pthread functions weak so that we can elide them from
single-threaded processes. */
#ifndef __NO_WEAK_PTHREAD_ALIASES
# ifdef weak_extern
weak_extern (pthread_mutex_init)
weak_extern (pthread_mutex_destroy)
weak_extern (pthread_mutex_lock)
weak_extern (pthread_mutex_trylock)
weak_extern (pthread_mutex_unlock)
weak_extern (pthread_mutexattr_init)
weak_extern (pthread_mutexattr_destroy)
weak_extern (pthread_mutexattr_settype)
weak_extern (pthread_key_create)
weak_extern (pthread_setspecific)
weak_extern (pthread_getspecific)
weak_extern (pthread_once)
weak_extern (pthread_initialize)
weak_extern (pthread_atfork)
weak_extern (_pthread_cleanup_push_defer)
weak_extern (_pthread_cleanup_pop_restore)
# else
# pragma weak pthread_mutex_init
# pragma weak pthread_mutex_destroy
# pragma weak pthread_mutex_lock
# pragma weak pthread_mutex_trylock
# pragma weak pthread_mutex_unlock
# pragma weak pthread_mutexattr_init
# pragma weak pthread_mutexattr_destroy
# pragma weak pthread_mutexattr_settype
# pragma weak pthread_key_create
# pragma weak pthread_setspecific
# pragma weak pthread_getspecific
# pragma weak pthread_once
# pragma weak pthread_initialize
# pragma weak pthread_atfork
# pragma weak _pthread_cleanup_push_defer
# pragma weak _pthread_cleanup_pop_restore
# endif
#endif
#else /* _REENTRANT */
typedef unsigned int ncpt_mutex_t;
typedef unsigned int ncpt_once_t;
typedef void** ncpt_key_t;
#define NCPT_MUTEX_INITIALIZER (0)
/* Initialize the named lock variable, leaving it in a consistent, unlocked
state. */
static inline int ncpt_mutex_init(ncpt_mutex_t* mutex) {
return 0;
(void)mutex;
}
/* Same as last but this time we initialize a recursive mutex. */
static inline int ncpt_mutex_init_recursive(ncpt_mutex_t* mutex) {
return 0;
(void)mutex;
}
/* Finalize the named lock variable, which must be locked. It cannot be
used again until __libc_lock_init is called again on it. This must be
called on a lock variable before the containing storage is reused. */
static inline int ncpt_mutex_destroy(ncpt_mutex_t* mutex) {
return 0;
(void)mutex;
}
/* Lock the named lock variable. */
static inline int ncpt_mutex_lock(ncpt_mutex_t* mutex) {
return 0;
(void)mutex;
}
/* Lock the recursive named lock variable. */
#define ncpt_mutex_lock_recursive(NAME) ncpt_mutex_lock(NAME)
/* Try to lock the named lock variable. */
static inline int ncpt_mutex_trylock(ncpt_mutex_t* mutex) {
return 0;
(void)mutex;
}
/* Try to lock the recursive named lock variable. */
#define ncpt_mutex_trylock_recursive(NAME) ncpt_mutex_trylock(NAME)
/* Unlock the named lock variable. */
static inline int ncpt_mutex_unlock(ncpt_mutex_t* mutex) {
return 0;
(void)mutex;
}
/* Unlock the recursive named lock variable. */
#define ncpt_mutex_unlock_recursive(NAME) ncpt_mutex_unlock(NAME)
#define NCPT_ONCE_INIT (0)
/* Call handler iff the first call. */
#define ncpt_once(ONCE_CONTROL, INIT_FUNCTION) \
do { \
if (*(ONCE_CONTROL) == NCPT_ONCE_INIT) { \
INIT_FUNCTION (); \
*(ONCE_CONTROL) = 1; \
} \
} while (0)
/* Start critical region with cleanup. */
#define __libc_cleanup_region_start(FCT, ARG) \
{ struct _pthread_cleanup_buffer _buffer; \
int _avail = _pthread_cleanup_push_defer != NULL; \
if (_avail) { \
_pthread_cleanup_push_defer (&_buffer, (FCT), (ARG)); \
}
/* End critical region with cleanup. */
#define __libc_cleanup_region_end(DOIT) \
if (_avail) { \
_pthread_cleanup_pop_restore (&_buffer, (DOIT)); \
} \
}
/* Sometimes we have to exit the block in the middle. */
#define __libc_cleanup_end(DOIT) \
if (_avail) { \
_pthread_cleanup_pop_restore (&_buffer, (DOIT)); \
}
#if 0
/* Create thread-specific key. */
static inline int ncpt_key_create(ncpt_key_t* KEY, void (*DESTRUCTOR)(void*)) {
ncpt_key_t k = (ncpt_key_t)malloc(sizeof(void*));
if (!k)
return ENOMEM;
*k = NULL;
*KEY = k;
return 0;
}
/* Get thread-specific data. */
static inline void* ncpt_getspecific(ncpt_key_t KEY) {
return KEY ? *KEY : NULL;
}
/* Set thread-specific data. */
static inline int ncpt_setspecific(ncpt_key_t KEY, const void* VALUE) {
if (!KEY)
return EINVAL;
*KEY = VALUE;
return 0;
}
#endif
/* Register handlers to execute before and after `fork'. */
#define ncpt_atfork(PREPARE, PARENT, CHILD) (0)
#endif /* _REENTRANT */
#endif /* private/libncp-lock.h */

97
include/private/list.h Normal file
View File

@@ -0,0 +1,97 @@
/* this code was borrowed from Linux-kernel 2.3.6 */
#ifndef NCP_LINUX_LIST_H
#define NCP_LINUX_LIST_H
/*
* Simple doubly linked list implementation.
*
* Some of the internal functions ("__xxx") are useful when
* manipulating whole lists rather than single entries, as
* sometimes we already know the next/prev entries and we can
* generate better code by using them directly rather than
* using the generic single-entry routines.
*/
struct list_head {
struct list_head *next, *prev;
};
#define LIST_HEAD(name) \
struct list_head name = { &name, &name }
#define INIT_LIST_HEAD(ptr) do { \
(ptr)->next = (ptr); (ptr)->prev = (ptr); \
} while (0)
/*
* Insert a new entry between two known consecutive entries.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static __inline__ void __list_add(struct list_head * new,
struct list_head * prev,
struct list_head * next)
{
next->prev = new;
new->next = next;
new->prev = prev;
prev->next = new;
}
/*
* Insert a new entry after the specified head..
*/
static __inline__ void list_add(struct list_head *new, struct list_head *head)
{
__list_add(new, head, head->next);
}
/*
* Delete a list entry by making the prev/next entries
* point to each other.
*
* This is only for internal list manipulation where we know
* the prev/next entries already!
*/
static __inline__ void __list_del(struct list_head * prev,
struct list_head * next)
{
next->prev = prev;
prev->next = next;
}
static __inline__ void list_del(struct list_head *entry)
{
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
static __inline__ int list_empty(struct list_head *head)
{
return head->next == head;
}
/*
* Splice in "list" into "head"
*/
static __inline__ void list_splice(struct list_head *list, struct list_head *head)
{
struct list_head *first = list->next;
if (first != list) {
struct list_head *last = list->prev;
struct list_head *at = head->next;
first->prev = head;
head->next = first;
last->next = at;
at->prev = last;
}
}
#define list_entry(ptr, type, member) \
((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
#endif /*ndef NCP_LINUX_LIST_H */

39
include/private/ncp-new.h Normal file
View File

@@ -0,0 +1,39 @@
#ifndef _LINUX_NCP_NEW_H
#define _LINUX_NCP_NEW_H
#include <ncp/kernel/types.h>
#define NCP_MINOR 222
#define NCP_IOC_NEWCONN 0xDDDD0001 /* ncp_ioc_newconn */
#define NCP_IOC_DELCONN 0xDDDD0002 /* none */
#define NCP_IOC_REQUEST_REPLY 0xDDDD0003 /* ncp_ioc_request_reply */
#define NCP_MAX_RPC_TIMEOUT 100
#define DDPRINTK(X...)
#define DPRINTK(X...)
struct ncp_ioc_newconn {
int fd;
#define NCP_FLAGS_SIGN_NEGOTIATED 0x0001
#define NCP_FLAGS_SIGN_ACTIVE 0x0002
int flags;
int sequence;
int connection;
struct ncp_sign_init sign;
};
struct ncp_ioc_request_reply {
unsigned int function;
struct {
unsigned int size;
u_int8_t* addr;
} request;
struct {
unsigned int size;
u_int8_t* addr;
} reply;
};
#endif

23
include/private/ncp_fs.h Normal file
View File

@@ -0,0 +1,23 @@
#ifndef _PRIVATE_NCP_FS_H
#define _PRIVATE_NCP_FS_H
#include <ncp/kernel/types.h>
struct ncp_fs_info_v2 {
int version;
unsigned long mounted_uid;
unsigned int connection;
unsigned int buffer_size;
unsigned int volume_number;
u_int32_t directory_id;
u_int32_t dummy1;
u_int32_t dummy2;
u_int32_t dummy3;
};
#define NCP_GET_FS_INFO_VERSION_V2 (2)
#define NCP_IOC_GET_FS_INFO_V2 _IOWR('n', 4, struct ncp_fs_info_v2)
#endif