64 bit platforms support

This commit is contained in:
Stas Degteff
2005-10-07 12:41:11 +00:00
parent 7345cbfdf2
commit 0885946b30
69 changed files with 683 additions and 737 deletions

View File

@@ -39,6 +39,7 @@
#define _SMBDEFS_H
#include <stdio.h>
#include <gdefs.h>
/**********/
/* Macros */
@@ -48,19 +49,6 @@
#define SHD_HEADER_ID "SHD\x1a" /* <S> <H> <D> <^Z> */
#define LEN_HEADER_ID 4
#ifndef uchar
typedef unsigned char uchar;
#endif
#ifdef __GLIBC__
#include <sys/types.h>
#else
#ifndef ushort
typedef unsigned short ushort;
typedef unsigned long ulong;
typedef unsigned int uint;
#endif
#endif
/****************************************************************************/
/* Memory allocation macros for various compilers and environments */
/* MALLOC is used for allocations of 64k or less */
@@ -397,7 +385,7 @@ enum {
typedef struct _PACK { // Time with time-zone
ulong time; // Local time (unix format)
uint32_t time; // Local time (unix format)
short zone; // Time zone
} when_t;
@@ -408,9 +396,9 @@ typedef struct _PACK { // Index record
ushort from; // 16-bit CRC of sender name (lower case)
ushort subj; // 16-bit CRC of subject (lower case, w/o RE:)
ushort attr; // attributes (read, permanent, etc.)
ulong offset; // offset into header file
ulong number; // number of message (1 based)
ulong time; // time/date message was imported/posted
uint32_t offset; // offset into header file
uint32_t number; // number of message (1 based)
uint32_t time; // time/date message was imported/posted
} idxrec_t;
@@ -424,11 +412,11 @@ typedef struct _PACK { // Message base header (fixed portion)
typedef struct _PACK { // Message base status header
ulong last_msg; // last message number
ulong total_msgs; // total messages
ulong header_offset; // byte offset to first header record
ulong max_crcs; // Maximum number of CRCs to keep in history
ulong max_msgs; // Maximum number of message to keep in sub
uint32_t last_msg; // last message number
uint32_t total_msgs; // total messages
uint32_t header_offset; // byte offset to first header record
uint32_t max_crcs; // Maximum number of CRCs to keep in history
uint32_t max_msgs; // Maximum number of message to keep in sub
ushort max_age; // Maximum age of message to keep in sub (in days)
ushort attr; // Attributes for this message base (SMB_HYPER,etc)
@@ -441,17 +429,17 @@ typedef struct _PACK { // Message header
ushort version; // Version of type (initially 100h for 1.00)
ushort length; // Total length of fixed record + all fields
ushort attr; // Attributes (bit field) (duped in SID)
ulong auxattr; // Auxillary attributes (bit field)
ulong netattr; // Network attributes
uint32_t auxattr; // Auxillary attributes (bit field)
uint32_t netattr; // Network attributes
when_t when_written; // Time message was written (unix format)
when_t when_imported; // Time message was imported
ulong number; // Message number
ulong thread_orig; // Original message number in thread
ulong thread_next; // Next message in thread
ulong thread_first; // First reply to this message
uint32_t number; // Message number
uint32_t thread_orig; // Original message number in thread
uint32_t thread_next; // Next message in thread
uint32_t thread_first; // First reply to this message
ushort delivery_attempts; // Delivery attempt counter
uchar reserved[14]; // Reserved for future use
ulong offset; // Offset for buffer into data file (0 or mod 256)
uint32_t offset; // Offset for buffer into data file (0 or mod 256)
ushort total_dfields; // Total number of data fields
} msghdr_t;
@@ -459,8 +447,8 @@ typedef struct _PACK { // Message header
typedef struct _PACK { // Data field
ushort type; // Type of data field
ulong offset; // Offset into buffer
ulong length; // Length of data field
uint32_t offset; // Offset into buffer
uint32_t length; // Length of data field
} dfield_t;
@@ -525,7 +513,7 @@ typedef struct { // Message
hfield_t *hfield; // Header fields (fixed length portion)
void **hfield_dat; // Header fields (variable length portion)
dfield_t *dfield; // Data fields (fixed length portion)
ulong offset; // Offset (number of records) into index
uint32_t offset; // Offset (number of records) into index
int forwarded; // Forwarded from agent to another
when_t expiration; // Message will exipre on this day (if >0)
@@ -539,8 +527,8 @@ typedef struct { // Message base
FILE *sid_fp; // File pointer for index (.sid) file
FILE *sda_fp; // File pointer for data allocation (.sda) file
FILE *sha_fp; // File pointer for header allocation (.sha) file
ulong retry_time; // Maximum number of seconds to retry opens/locks
ulong retry_delay; // Time-slice yield (milliseconds) while retrying
uint32_t retry_time; // Maximum number of seconds to retry opens/locks
uint32_t retry_delay; // Time-slice yield (milliseconds) while retrying
smbstatus_t status; // Status header record
int locked; // SMB header is locked
char shd_buf[SHD_BLOCK_LEN]; // File I/O buffer for header file

View File

@@ -221,7 +221,7 @@ int SMBCALL smb_open_da(smb_t* smb)
start=time(NULL);
else
if(time(NULL)-start>=(time_t)smb->retry_time) {
sprintf(smb->last_error,"timeout opening %s (retry_time=%ld)"
sprintf(smb->last_error,"timeout opening %s (retry_time=%d)"
,str,smb->retry_time);
return(-2);
}
@@ -266,7 +266,7 @@ int SMBCALL smb_open_ha(smb_t* smb)
start=time(NULL);
else
if(time(NULL)-start>=(time_t)smb->retry_time) {
sprintf(smb->last_error,"timeout opening %s (retry_time=%ld)"
sprintf(smb->last_error,"timeout opening %s (retry_time=%d)"
,str,smb->retry_time);
return(-2);
}
@@ -364,7 +364,7 @@ int SMBCALL smb_trunchdr(smb_t* smb)
start=time(NULL);
else
if(time(NULL)-start>=(time_t)smb->retry_time) { /* Time-out */
sprintf(smb->last_error,"timeout changing header file size (retry_time=%ld)"
sprintf(smb->last_error,"timeout changing header file size (retry_time=%d)"
,smb->retry_time);
return(-2);
}
@@ -509,7 +509,7 @@ int SMBCALL smb_lockmsghdr(smb_t* smb, smbmsg_t* msg)
int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg)
{
idxrec_t idx;
ulong l,length,total,bot,top;
uint32_t l,length,total,bot,top;
if(smb->sid_fp==NULL) {
sprintf(smb->last_error,"index not open");
@@ -527,12 +527,12 @@ int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg)
length=filelength(fileno(smb->sid_fp));
if(!length) {
sprintf(smb->last_error,"invalid index file length: %ld",length);
sprintf(smb->last_error,"invalid index file length: %d",length);
return(1);
}
total=length/sizeof(idxrec_t);
if(!total) {
sprintf(smb->last_error,"invalid index file length: %ld",length);
sprintf(smb->last_error,"invalid index file length: %d",length);
return(1);
}
@@ -546,7 +546,7 @@ int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg)
return(1);
}
if(bot==top-1 && idx.number!=msg->hdr.number) {
sprintf(smb->last_error,"msg %ld not found",msg->hdr.number);
sprintf(smb->last_error,"msg %d not found",msg->hdr.number);
return(1);
}
if(idx.number>msg->hdr.number) {
@@ -589,7 +589,7 @@ int SMBCALL smb_getfirstidx(smb_t* smb, idxrec_t *idx)
/****************************************************************************/
int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx)
{
long length;
int32_t length;
if(smb->sid_fp==NULL) {
sprintf(smb->last_error,"index not open");
@@ -598,7 +598,7 @@ int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx)
clearerr(smb->sid_fp);
length=filelength(fileno(smb->sid_fp));
if(length<sizeof(idxrec_t)) {
sprintf(smb->last_error,"invalid index file length: %ld",length);
sprintf(smb->last_error,"invalid index file length: %d",length);
return(-1);
}
fseek(smb->sid_fp,length-sizeof(idxrec_t),SEEK_SET);
@@ -633,10 +633,10 @@ uint SMBCALL smb_getmsghdrlen(smbmsg_t* msg)
/* Figures out the total length of the data buffer for 'msg' */
/* Returns length */
/****************************************************************************/
ulong SMBCALL smb_getmsgdatlen(smbmsg_t* msg)
uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg)
{
int i;
ulong length=0L;
uint32_t length=0L;
for(i=0;i<msg->hdr.total_dfields;i++)
length+=msg->dfield[i].length;
@@ -654,7 +654,7 @@ int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg)
hfield_t *vp;
void **vpp;
ushort i;
ulong l,offset;
uint32_t l,offset;
idxrec_t idx;
if(smb->shd_fp==NULL) {
@@ -967,7 +967,7 @@ void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield)
/* Automatically figures out the offset into the data buffer from existing */
/* dfield lengths */
/****************************************************************************/
int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, ulong length)
int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, uint32_t length)
{
dfield_t* vp;
int i,j;
@@ -989,12 +989,12 @@ int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, ulong length)
/* Checks CRC history file for duplicate crc. If found, returns 1. */
/* If no dupe, adds to CRC history and returns 0, or negative if error. */
/****************************************************************************/
int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc)
{
char str[128];
int file;
long length;
ulong l,*buf;
int32_t length;
uint32_t l,*buf;
time_t start=0;
if(!smb->status.max_crcs)
@@ -1012,7 +1012,7 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
start=time(NULL);
else
if(time(NULL)-start>=(time_t)smb->retry_time) {
sprintf(smb->last_error,"timeout opening %s (retry_time=%ld)"
sprintf(smb->last_error,"timeout opening %s (retry_time=%d)"
,str,smb->retry_time);
return(-2);
}
@@ -1022,17 +1022,17 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
length=filelength(file);
if(length<0L) {
close(file);
sprintf(smb->last_error,"invalid file length: %ld", length);
sprintf(smb->last_error,"invalid file length: %d", length);
return(-4);
}
if((buf=(ulong*)MALLOC(smb->status.max_crcs*4))==NULL) {
if((buf=(uint32_t*)MALLOC(smb->status.max_crcs*4))==NULL) {
close(file);
sprintf(smb->last_error
,"malloc failure of %ld bytes"
,"malloc failure of %d bytes"
,smb->status.max_crcs*4);
return(-3);
}
if((ulong)length>=smb->status.max_crcs*4L) { /* Reached or exceeds max crcs */
if((uint32_t)length>=smb->status.max_crcs*4L) { /* Reached or exceeds max crcs */
read(file,buf,smb->status.max_crcs*4);
for(l=0;l<smb->status.max_crcs;l++)
if(crc==buf[l])
@@ -1051,10 +1051,10 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
else if(length/4) { /* Less than max crcs */
read(file,buf,length);
for(l=0;l<(ulong)(length/4);l++)
for(l=0;l<(uint32_t)(length/4);l++)
if(crc==buf[l])
break;
if(l<(ulong)(length/4L)) { /* Dupe CRC found */
if(l<(uint32_t)(length/4L)) { /* Dupe CRC found */
close(file);
FREE(buf);
sprintf(smb->last_error
@@ -1080,7 +1080,7 @@ int SMBCALL smb_addcrc(smb_t* smb, ulong crc)
int SMBCALL smb_addmsghdr(smb_t* smb, smbmsg_t* msg, int storage)
{
int i;
long l;
int32_t l;
if(!smb->locked && smb_locksmbhdr(smb))
return(1);
@@ -1168,7 +1168,7 @@ int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg)
int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg)
{
ushort i;
ulong l;
uint32_t l;
if(smb->shd_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1176,12 +1176,12 @@ int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg)
}
if(msg->idx.offset<sizeof(smbhdr_t)+sizeof(smbstatus_t)
|| msg->idx.offset<smb->status.header_offset) {
sprintf(smb->last_error,"invalid header offset: %ld",msg->idx.offset);
sprintf(smb->last_error,"invalid header offset: %d",msg->idx.offset);
return(-7);
}
clearerr(smb->shd_fp);
if(fseek(smb->shd_fp,msg->idx.offset,SEEK_SET)) {
sprintf(smb->last_error,"seeking to %ld in index",msg->idx.offset);
sprintf(smb->last_error,"seeking to %d in index",msg->idx.offset);
return(-1);
}
@@ -1215,7 +1215,7 @@ int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg)
sprintf(smb->last_error,"writing header field");
return(-4);
}
if(msg->hfield[i].length /* more then 0 bytes long */
if(msg->hfield[i].length /* more then 0 bytes int32_t */
&& !fwrite(msg->hfield_dat[i],msg->hfield[i].length,1,smb->shd_fp)) {
sprintf(smb->last_error,"writing header field data");
return(-5);
@@ -1281,9 +1281,9 @@ int SMBCALL smb_create(smb_t* smb)
/****************************************************************************/
/* Returns number of data blocks required to store "length" amount of data */
/****************************************************************************/
ulong SMBCALL smb_datblocks(ulong length)
uint32_t SMBCALL smb_datblocks(uint32_t length)
{
ulong blocks;
uint32_t blocks;
blocks=length/SDT_BLOCK_LEN;
if(length%SDT_BLOCK_LEN)
@@ -1294,9 +1294,9 @@ ulong SMBCALL smb_datblocks(ulong length)
/****************************************************************************/
/* Returns number of header blocks required to store "length" size header */
/****************************************************************************/
ulong SMBCALL smb_hdrblocks(ulong length)
uint32_t SMBCALL smb_hdrblocks(uint32_t length)
{
ulong blocks;
uint32_t blocks;
blocks=length/SHD_BLOCK_LEN;
if(length%SHD_BLOCK_LEN)
@@ -1313,10 +1313,10 @@ ulong SMBCALL smb_hdrblocks(ulong length)
/* smb_close_da() should be called after */
/* Returns negative on error */
/****************************************************************************/
long SMBCALL smb_allocdat(smb_t* smb, ulong length, ushort headers)
int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers)
{
ushort i,j;
ulong l,blocks,offset=0L;
uint32_t l,blocks,offset=0L;
if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1352,9 +1352,9 @@ long SMBCALL smb_allocdat(smb_t* smb, ulong length, ushort headers)
/* Allocates space for data, but doesn't search for unused blocks */
/* Returns negative on error */
/****************************************************************************/
long SMBCALL smb_fallocdat(smb_t* smb, ulong length, ushort headers)
int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers)
{
ulong l,blocks,offset;
uint32_t l,blocks,offset;
if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1380,13 +1380,13 @@ long SMBCALL smb_fallocdat(smb_t* smb, ulong length, ushort headers)
/* De-allocates space for data */
/* Returns non-zero on error */
/****************************************************************************/
int SMBCALL smb_freemsgdat(smb_t* smb, ulong offset, ulong length
int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length
, ushort headers)
{
int da_opened=0;
int retval=0;
ushort i;
ulong l,blocks;
uint32_t l,blocks;
if(smb->status.attr&SMB_HYPERALLOC) /* do nothing */
return(0);
@@ -1438,10 +1438,10 @@ int SMBCALL smb_freemsgdat(smb_t* smb, ulong offset, ulong length
/* Adds to data allocation records for blocks starting at 'offset' */
/* Returns non-zero on error */
/****************************************************************************/
int SMBCALL smb_incdat(smb_t* smb, ulong offset, ulong length, ushort headers)
int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers)
{
ushort i;
ulong l,blocks;
uint32_t l,blocks;
if(smb->sda_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1470,10 +1470,10 @@ int SMBCALL smb_incdat(smb_t* smb, ulong offset, ulong length, ushort headers)
/* De-allocates blocks for header record */
/* Returns non-zero on error */
/****************************************************************************/
int SMBCALL smb_freemsghdr(smb_t* smb, ulong offset, ulong length)
int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length)
{
uchar c=0;
ulong l,blocks;
uint32_t l,blocks;
if(smb->sha_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1520,11 +1520,11 @@ int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg)
/* smb_close_ha() should be called after */
/* Returns -1L on error */
/****************************************************************************/
long SMBCALL smb_allochdr(smb_t* smb, ulong length)
int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length)
{
uchar c;
ushort i;
ulong l,blocks,offset=0;
uint32_t l,blocks,offset=0;
if(smb->sha_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1561,10 +1561,10 @@ long SMBCALL smb_allochdr(smb_t* smb, ulong length)
/* Allocates space for index, but doesn't search for unused blocks */
/* Returns -1L on error */
/****************************************************************************/
long SMBCALL smb_fallochdr(smb_t* smb, ulong length)
int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length)
{
uchar c=1;
ulong l,blocks,offset;
uint32_t l,blocks,offset;
if(smb->sha_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1589,9 +1589,9 @@ long SMBCALL smb_fallochdr(smb_t* smb, ulong length)
/* this function should be most likely not be called from anywhere but */
/* smb_addmsghdr() */
/************************************************************************/
long SMBCALL smb_hallochdr(smb_t* smb)
int32_t SMBCALL smb_hallochdr(smb_t* smb)
{
ulong l;
uint32_t l;
if(smb->shd_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1613,9 +1613,9 @@ long SMBCALL smb_hallochdr(smb_t* smb)
/* unlocked until all data fields for this message have been written */
/* to the SDT file */
/************************************************************************/
long SMBCALL smb_hallocdat(smb_t* smb)
int32_t SMBCALL smb_hallocdat(smb_t* smb)
{
long l;
int32_t l;
if(smb->sdt_fp==NULL) {
sprintf(smb->last_error,"msgbase not open");
@@ -1657,22 +1657,22 @@ int SMBCALL smb_fputc(int ch, FILE* fp)
return(fputc(ch,fp));
}
int SMBCALL smb_fseek(FILE* fp, long offset, int whence)
int SMBCALL smb_fseek(FILE* fp, int32_t offset, int whence)
{
return(fseek(fp,offset,whence));
}
long SMBCALL smb_ftell(FILE* fp)
int32_t SMBCALL smb_ftell(FILE* fp)
{
return(ftell(fp));
}
long SMBCALL smb_fgetlength(FILE* fp)
int32_t SMBCALL smb_fgetlength(FILE* fp)
{
return(filelength(fileno(fp)));
}
int SMBCALL smb_fsetlength(FILE* fp, long length)
int SMBCALL smb_fsetlength(FILE* fp, int32_t length)
{
return(chsize(fileno(fp),length));
}
@@ -1687,12 +1687,12 @@ void SMBCALL smb_clearerr(FILE* fp)
clearerr(fp);
}
long SMBCALL smb_fread(void HUGE16* buf, long bytes, FILE* fp)
int32_t SMBCALL smb_fread(void HUGE16* buf, int32_t bytes, FILE* fp)
{
#ifdef __FLAT__
return(fread(buf,1,bytes,fp));
#else
long count;
int32_t count;
for(count=bytes;count>0x7fff;count-=0x7fff,(char*)buf+=0x7fff)
if(fread((char*)buf,1,0x7fff,fp)!=0x7fff)
@@ -1703,12 +1703,12 @@ long SMBCALL smb_fread(void HUGE16* buf, long bytes, FILE* fp)
#endif
}
long SMBCALL smb_fwrite(void HUGE16* buf, long bytes, FILE* fp)
int32_t SMBCALL smb_fwrite(void HUGE16* buf, int32_t bytes, FILE* fp)
{
#ifdef __FLAT__
return(fwrite(buf,1,bytes,fp));
#else
long count;
int32_t count;
for(count=bytes;count>0x7fff;count-=0x7fff,(char*)buf+=0x7fff)
if(fwrite((char*)buf,1,0x7fff,fp)!=0x7fff)

View File

@@ -106,34 +106,34 @@ SMBEXPORT int SMBCALL smb_getmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getfirstidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT int SMBCALL smb_getlastidx(smb_t* smb, idxrec_t *idx);
SMBEXPORT uint SMBCALL smb_getmsghdrlen(smbmsg_t* msg);
SMBEXPORT ulong SMBCALL smb_getmsgdatlen(smbmsg_t* msg);
SMBEXPORT uint32_t SMBCALL smb_getmsgdatlen(smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_lockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_getmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_unlockmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_addcrc(smb_t* smb, ulong crc);
SMBEXPORT int SMBCALL smb_addcrc(smb_t* smb, uint32_t crc);
SMBEXPORT int SMBCALL smb_hfield(smbmsg_t* msg, ushort type, size_t length, void* data);
SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, ulong length);
SMBEXPORT int SMBCALL smb_dfield(smbmsg_t* msg, ushort type, uint32_t length);
SMBEXPORT void* SMBCALL smb_get_hfield(smbmsg_t* msg, ushort type, hfield_t* hfield);
SMBEXPORT int SMBCALL smb_addmsghdr(smb_t* smb, smbmsg_t* msg,int storage);
SMBEXPORT int SMBCALL smb_putmsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsgidx(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_putmsghdr(smb_t* smb, smbmsg_t* msg);
SMBEXPORT void SMBCALL smb_freemsgmem(smbmsg_t* msg);
SMBEXPORT ulong SMBCALL smb_hdrblocks(ulong length);
SMBEXPORT ulong SMBCALL smb_datblocks(ulong length);
SMBEXPORT long SMBCALL smb_allochdr(smb_t* smb, ulong length);
SMBEXPORT long SMBCALL smb_fallochdr(smb_t* smb, ulong length);
SMBEXPORT long SMBCALL smb_hallochdr(smb_t* smb);
SMBEXPORT long SMBCALL smb_allocdat(smb_t* smb, ulong length, ushort headers);
SMBEXPORT long SMBCALL smb_fallocdat(smb_t* smb, ulong length, ushort headers);
SMBEXPORT long SMBCALL smb_hallocdat(smb_t* smb);
SMBEXPORT int SMBCALL smb_incdat(smb_t* smb, ulong offset, ulong length, ushort headers);
SMBEXPORT uint32_t SMBCALL smb_hdrblocks(uint32_t length);
SMBEXPORT uint32_t SMBCALL smb_datblocks(uint32_t length);
SMBEXPORT int32_t SMBCALL smb_allochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_fallochdr(smb_t* smb, uint32_t length);
SMBEXPORT int32_t SMBCALL smb_hallochdr(smb_t* smb);
SMBEXPORT int32_t SMBCALL smb_allocdat(smb_t* smb, uint32_t length, ushort headers);
SMBEXPORT int32_t SMBCALL smb_fallocdat(smb_t* smb, uint32_t length, ushort headers);
SMBEXPORT int32_t SMBCALL smb_hallocdat(smb_t* smb);
SMBEXPORT int SMBCALL smb_incdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers);
SMBEXPORT int SMBCALL smb_freemsg(smb_t* smb, smbmsg_t* msg);
SMBEXPORT int SMBCALL smb_freemsgdat(smb_t* smb, ulong offset, ulong length, ushort headers);
SMBEXPORT int SMBCALL smb_freemsghdr(smb_t* smb, ulong offset, ulong length);
SMBEXPORT int SMBCALL smb_freemsgdat(smb_t* smb, uint32_t offset, uint32_t length, ushort headers);
SMBEXPORT int SMBCALL smb_freemsghdr(smb_t* smb, uint32_t offset, uint32_t length);
SMBEXPORT void SMBCALL smb_freemsgtxt(char* buf);
SMBEXPORT int SMBCALL smb_copymsgmem(smbmsg_t* destmsg, smbmsg_t* srcmsg);
SMBEXPORT char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, ulong mode);
SMBEXPORT char* SMBCALL smb_getmsgtxt(smb_t* smb, smbmsg_t* msg, uint32_t mode);
SMBEXPORT int SMBCALL smb_tzutc(short timezone);
/* FILE pointer I/O functions */
@@ -143,12 +143,12 @@ SMBEXPORT int SMBCALL smb_ferror(FILE* fp);
SMBEXPORT int SMBCALL smb_fflush(FILE* fp);
SMBEXPORT int SMBCALL smb_fgetc(FILE* fp);
SMBEXPORT int SMBCALL smb_fputc(int ch, FILE* fp);
SMBEXPORT int SMBCALL smb_fseek(FILE* fp, long offset, int whence);
SMBEXPORT long SMBCALL smb_ftell(FILE* fp);
SMBEXPORT long SMBCALL smb_fread(void HUGE16* buf, long bytes, FILE* fp);
SMBEXPORT long SMBCALL smb_fwrite(void HUGE16* buf, long bytes, FILE* fp);
SMBEXPORT long SMBCALL smb_fgetlength(FILE* fp);
SMBEXPORT int SMBCALL smb_fsetlength(FILE* fp, long length);
SMBEXPORT int SMBCALL smb_fseek(FILE* fp, int32_t offset, int whence);
SMBEXPORT int32_t SMBCALL smb_ftell(FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fread(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fwrite(void HUGE16* buf, int32_t bytes, FILE* fp);
SMBEXPORT int32_t SMBCALL smb_fgetlength(FILE* fp);
SMBEXPORT int SMBCALL smb_fsetlength(FILE* fp, int32_t length);
SMBEXPORT void SMBCALL smb_rewind(FILE* fp);
SMBEXPORT void SMBCALL smb_clearerr(FILE* fp);