1 |
|
|
2 |
/* |
/* |
3 |
Unix SMB/Netbios implementation. |
Unix SMB/Netbios implementation. |
4 |
Version 1.9. |
Version 1.9. |
41 |
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) |
#define PVAL(buf,pos) ((unsigned)CVAL(buf,pos)) |
42 |
#define SCVAL(buf,pos,val) (CVAL(buf,pos) = (val)) |
#define SCVAL(buf,pos,val) (CVAL(buf,pos) = (val)) |
43 |
|
|
|
|
|
44 |
#if CAREFUL_ALIGNMENT |
#if CAREFUL_ALIGNMENT |
45 |
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) |
#define SVAL(buf,pos) (PVAL(buf,pos)|PVAL(buf,(pos)+1)<<8) |
46 |
#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) |
#define IVAL(buf,pos) (SVAL(buf,pos)|SVAL(buf,(pos)+2)<<16) |
53 |
#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val))) |
#define SSVALS(buf,pos,val) SSVALX((buf),(pos),((int16)(val))) |
54 |
#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val))) |
#define SIVALS(buf,pos,val) SIVALX((buf),(pos),((int32)(val))) |
55 |
#else |
#else |
56 |
|
|
57 |
/* this handles things for architectures like the 386 that can handle |
/* this handles things for architectures like the 386 that can handle |
58 |
alignment errors */ |
alignment errors */ |
59 |
|
|
60 |
/* |
/* |
61 |
WARNING: This section is dependent on the length of int16 and int32 |
WARNING: This section is dependent on the length of int16 and int32 |
62 |
being correct |
being correct |
71 |
#define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val)) |
#define SIVALS(buf,pos,val) IVALS(buf,pos)=((int32)(val)) |
72 |
#endif |
#endif |
73 |
|
|
|
|
|
74 |
/* now the reverse routines - these are used in nmb packets (mostly) */ |
/* now the reverse routines - these are used in nmb packets (mostly) */ |
75 |
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) |
#define SREV(x) ((((x)&0xFF)<<8) | (((x)>>8)&0xFF)) |
76 |
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) |
#define IREV(x) ((SREV(x)<<16) | (SREV((x)>>16))) |