Import ncpfs 2.2.0

This commit is contained in:
ncpfs archive import
2026-04-28 20:39:59 +02:00
parent c6c6fbe4ca
commit 0979ae6a41
119 changed files with 12194 additions and 10043 deletions

22
include/glibstub.h Normal file
View File

@@ -0,0 +1,22 @@
#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

@@ -8,15 +8,14 @@
#ifndef _IPXLIB_H
#define _IPXLIB_H
#include <linux/types.h>
#include "kernel/types.h"
#include "ncp.h"
#include <linux/ipx.h>
#include <stdio.h>
#include "kernel/ipx.h"
typedef unsigned long IPXNet;
typedef unsigned short IPXPort;
typedef unsigned char IPXNode[IPX_NODE_LEN];
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)
@@ -32,30 +31,35 @@ typedef unsigned char IPXNode[IPX_NODE_LEN];
#define IPX_SAP_FILE_SERVER (0x0004)
struct sap_query {
unsigned short query_type; /* net order */
unsigned short server_type; /* net order */
struct sap_query
{
u_int16_t query_type; /* net order */
u_int16_t server_type; /* net order */
};
struct sap_server_ident {
unsigned short 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));
unsigned short intermediate_network __attribute__((packed));
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 {
__u16 operation __attribute__((packed));
struct ipx_rt_def {
__u32 network __attribute__((packed));
__u16 hops __attribute__((packed));
__u16 ticks __attribute__((packed));
} rt[1] __attribute__((packed));
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")
@@ -85,8 +89,10 @@ void
int
ipx_sscanf_node(char *buf, unsigned char node[IPX_NODE_LEN]);
void
ipx_assign_node(IPXNode dest, IPXNode src);
ipx_assign_node(IPXNode dest, CIPXNode src);
int
ipx_node_equal(IPXNode n1, IPXNode n2);
ipx_node_equal(CIPXNode n1, CIPXNode n2);
int
ipx_sscanf_saddr(char* buf, struct sockaddr_ipx* sipx);
#endif /* _IPXLIB_H */

11
include/kernel/fs.h Normal file
View File

@@ -0,0 +1,11 @@
#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

11
include/kernel/if.h Normal file
View File

@@ -0,0 +1,11 @@
#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

15
include/kernel/ipx.h Normal file
View File

@@ -0,0 +1,15 @@
#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

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

@@ -0,0 +1,213 @@
/*
* 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 */

110
include/kernel/ncp_fs.h Normal file
View File

@@ -0,0 +1,110 @@
/*
* 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 */

12
include/kernel/route.h Normal file
View File

@@ -0,0 +1,12 @@
#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__ */

40
include/kernel/types.h Normal file
View File

@@ -0,0 +1,40 @@
#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

@@ -9,10 +9,10 @@
#ifndef _NCP_H
#define _NCP_H
#include <linux/types.h>
#include <linux/ipx.h>
#include <linux/ncp.h>
#include <linux/ncp_fs.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)
@@ -119,5 +119,4 @@ struct print_job_record {
char Path[80] __attribute__((packed));
};
#endif /* _NCP_H */

View File

@@ -8,13 +8,17 @@
#ifndef _NCPLIB_H
#define _NCPLIB_H
#include <linux/types.h>
#include "ncp.h"
#include <linux/ipx.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"
@@ -22,31 +26,36 @@ 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) (((__u8 *)(buf))[pos])
#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) (BVAL(buf,pos) = (val))
#define BSET(buf,pos,val) (BWVAL(buf,pos) = (val))
static inline word
WVAL_HL(__u8 * buf, int pos)
WVAL_HL(const __u8 * buf, int pos)
{
return PVAL(buf, pos) << 8 | PVAL(buf, pos + 1);
}
static inline dword
DVAL_HL(__u8 * buf, int pos)
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)
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)
static inline void
DSET_HL(__u8 * buf, int pos, dword val)
{
WSET_HL(buf, pos, val >> 16);
WSET_HL(buf, pos + 2, val & 0xffff);
@@ -58,20 +67,22 @@ static inline void DSET_HL(__u8 * buf, int pos, dword val)
#if defined(__i386__)
static inline word
WVAL_LH(__u8 * buf, int pos)
WVAL_LH(const __u8 * buf, int pos)
{
return *((word *) (buf + pos));
return *((const word *) (buf + pos));
}
static inline dword
DVAL_LH(__u8 * buf, int pos)
DVAL_LH(const __u8 * buf, int pos)
{
return *((dword *) (buf + pos));
return *((const dword *) (buf + pos));
}
static inline void WSET_LH(__u8 * buf, int pos, word val)
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)
static inline void
DSET_LH(__u8 * buf, int pos, dword val)
{
*((dword *) (buf + pos)) = val;
}
@@ -79,21 +90,23 @@ static inline void DSET_LH(__u8 * buf, int pos, dword val)
#else
static inline word
WVAL_LH(__u8 * buf, int pos)
WVAL_LH(const __u8 * buf, int pos)
{
return PVAL(buf, pos) | PVAL(buf, pos + 1) << 8;
}
static inline dword
DVAL_LH(__u8 * buf, int pos)
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)
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)
static inline void
DSET_LH(__u8 * buf, int pos, dword val)
{
WSET_LH(buf, pos, val & 0xffff);
WSET_LH(buf, pos + 2, val >> 16);
@@ -101,19 +114,18 @@ static inline void DSET_LH(__u8 * buf, int pos, dword val)
#endif
void
str_upper(char *name);
enum connect_state {
enum connect_state
{
NOT_CONNECTED = 0,
CONN_PERMANENT,
CONN_TEMPORARY
};
struct ncp_conn {
struct ncp_conn
{
enum connect_state is_connected;
@@ -139,14 +151,22 @@ struct ncp_conn {
int current_size;
int has_subfunction;
int verbose;
int ncp_reply_size;
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 {
struct ncp_conn_spec
{
char server[NCP_BINDERY_NAME_LEN];
char user[NCP_BINDERY_NAME_LEN];
uid_t uid;
@@ -154,12 +174,16 @@ struct ncp_conn_spec {
char password[NCP_BINDERY_NAME_LEN];
};
struct ncp_search_seq {
#ifndef __MAKE_SULIB__
struct ncp_search_seq
{
struct nw_search_sequence s;
int namespace;
};
#endif /* not __MAKE_SULIB__ */
struct ncp_property_info {
struct ncp_property_info
{
__u8 property_name[16];
__u8 property_flags;
__u8 property_security;
@@ -186,34 +210,35 @@ struct ncp_conn *
/* Open a connection */
struct ncp_conn *
ncp_open(const struct ncp_conn_spec *spec, long *err);
ncp_open(const struct ncp_conn_spec *spec, long *err);
/* Open a connection on an existing mount point */
struct ncp_conn *
ncp_open_mount(const char *mount_point, long *err);
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);
ncp_find_permanent(const struct ncp_conn_spec *spec);
/* Find the address of a file server */
struct sockaddr_ipx *
ncp_find_fileserver(const char *server_name, long *err);
long
ncp_find_fileserver(const char *server_name, struct sockaddr* addr, size_t addrlen);
/* Find the address of a server */
struct sockaddr_ipx *
ncp_find_server(const char **server_name, int type, long *err);
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);
ncp_close(struct ncp_conn *conn);
/* like getmntent, get_ncp_conn_ent scans /etc/mtab for usable
connections */
struct ncp_conn_ent {
struct ncp_conn_ent
{
char server[NCP_BINDERY_NAME_LEN];
char user[NCP_BINDERY_NAME_LEN];
uid_t uid;
@@ -221,7 +246,7 @@ struct ncp_conn_ent {
};
struct ncp_conn_ent *
ncp_get_conn_ent(FILE * filep);
ncp_get_conn_ent(FILE * filep);
#define NWCLIENT (".nwclient")
#define NWC_NOPASSWORD ("-")
@@ -232,6 +257,12 @@ 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]);
@@ -241,7 +272,8 @@ long
long
ncp_set_file_server_time(struct ncp_conn *conn, time_t * source);
struct ncp_file_server_info {
struct ncp_file_server_info
{
__u8 ServerName[48] __attribute__((packed));
__u8 FileServiceVersion __attribute__((packed));
__u8 FileServiceSubVersion __attribute__((packed));
@@ -288,9 +320,16 @@ long
__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,
@@ -302,7 +341,7 @@ long
struct ncp_bindery_object *target);
long
ncp_scan_bindery_object(struct ncp_conn *conn,
__u32 last_id, __u16 object_type, char *search_string,
__u32 last_id, __u16 object_type, char *search_string,
struct ncp_bindery_object *target);
long
ncp_create_bindery_object(struct ncp_conn *conn,
@@ -320,14 +359,17 @@ long
__u16 object_type,
const char *object_name,
__u8 security);
#endif /* not __MAKE_SULIB__ */
struct ncp_station_addr {
struct ncp_station_addr
{
__u32 NetWork __attribute__((packed));
__u8 Node[6] __attribute__((packed));
__u16 Socket __attribute__((packed));
};
struct ncp_prop_login_control {
struct ncp_prop_login_control
{
__u8 AccountExpireDate[3] __attribute__((packed));
__u8 Disabled __attribute__((packed));
__u8 PasswordExpireDate[3] __attribute__((packed));
@@ -351,10 +393,11 @@ long
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, char *search_string,
__u32 last_id, const char *search_string,
struct ncp_property_info *property_info);
long
ncp_add_object_to_set(struct ncp_conn *conn,
@@ -387,7 +430,7 @@ long
__u16 object_type, const char *object_name,
const char *property_name,
__u8 segment,
struct nw_property *property_value);
const struct nw_property *property_value);
/* Bit masks for security flag */
#define NCP_SEC_CHECKSUMMING_REQUESTED (1)
@@ -421,13 +464,24 @@ long
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);
@@ -528,6 +582,15 @@ long
__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,
@@ -555,7 +618,7 @@ long
long
ncp_do_lookup(struct ncp_conn *conn,
struct nw_info_struct *dir,
char *path, /* may only be one component */
const char *path, /* may only be one component */
struct nw_info_struct *target);
long
@@ -583,6 +646,13 @@ long
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,
@@ -590,14 +660,35 @@ long
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);
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,
@@ -622,10 +713,12 @@ long
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);
@@ -644,7 +737,8 @@ long
struct nw_info_struct *file,
__u16 * target);
struct ncp_trustee_struct {
struct ncp_trustee_struct
{
__u32 object_id;
__u16 rights;
};
@@ -655,5 +749,75 @@ long
__u16 rights_mask,
int object_count, struct ncp_trustee_struct *rights);
struct ncp_deleted_file
{
int32_t seq;
__u32 vol;
__u32 base;
};
#endif /* _NCPLIB_H */
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 */

18
include/ncpsign.h Normal file
View File

@@ -0,0 +1,18 @@
#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

35
include/ndslib.h Normal file
View File

@@ -0,0 +1,35 @@
/*
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 "ncplib.h"
typedef unsigned short uni_char;
#define NDS_GRACE_PERIOD -223
int strlen_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);
#endif /* ifndef _NDSLIB_H_ */