Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
This commit is contained in:
parent
226d80b821
commit
cbeb0b26e4
492 changed files with 3218 additions and 3167 deletions
|
|
@ -40,7 +40,7 @@ enum
|
|||
ARrpcfailure,
|
||||
ARphase,
|
||||
|
||||
AuthRpcMax = 4096,
|
||||
AuthRpcMax = 4096
|
||||
};
|
||||
|
||||
struct AuthRpc
|
||||
|
|
@ -108,7 +108,7 @@ typedef struct Attr Attr;
|
|||
enum {
|
||||
AttrNameval, /* name=val -- when matching, must have name=val */
|
||||
AttrQuery, /* name? -- when matching, must be present */
|
||||
AttrDefault, /* name:=val -- when matching, if present must match INTERNAL */
|
||||
AttrDefault /* name:=val -- when matching, if present must match INTERNAL */
|
||||
};
|
||||
struct Attr
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ enum
|
|||
KEYDBOFF= 8, /* length of random data at the start of key file */
|
||||
OKEYDBLEN= ANAMELEN+DESKEYLEN+4+2, /* length of an entry in old key file */
|
||||
KEYDBLEN= OKEYDBLEN+SECRETLEN, /* length of an entry in key file */
|
||||
OMD5LEN= 16,
|
||||
OMD5LEN= 16
|
||||
};
|
||||
|
||||
/* encryption numberings (anti-replay) */
|
||||
|
|
@ -60,7 +60,7 @@ enum
|
|||
AuthAs, /* server generated authenticator */
|
||||
AuthAc, /* client generated authenticator */
|
||||
AuthTp, /* ticket encrypted with client's key for password change */
|
||||
AuthHr, /* http reply */
|
||||
AuthHr /* http reply */
|
||||
};
|
||||
|
||||
struct Ticketreq
|
||||
|
|
@ -140,7 +140,7 @@ extern int passtokey(char*, char*);
|
|||
*/
|
||||
enum {
|
||||
NVwrite = 1<<0, /* always prompt and rewrite nvram */
|
||||
NVwriteonerr = 1<<1, /* prompt and rewrite nvram when corrupt */
|
||||
NVwriteonerr = 1<<1 /* prompt and rewrite nvram when corrupt */
|
||||
};
|
||||
|
||||
struct Nvrsafe
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ enum {
|
|||
|
||||
Gpart = 0, /* partition info source */
|
||||
Gdisk,
|
||||
Gguess,
|
||||
Gguess
|
||||
};
|
||||
|
||||
/* proto file parsing */
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ enum
|
|||
{
|
||||
Displaybufsize = 8000,
|
||||
ICOSSCALE = 1024,
|
||||
Borderwidth = 4,
|
||||
Borderwidth = 4
|
||||
};
|
||||
|
||||
enum
|
||||
|
|
@ -103,7 +103,7 @@ typedef enum
|
|||
DatopS = DinS|SoutD,
|
||||
DxorS = DoutS|SoutD, /* == SxorD */
|
||||
|
||||
Ncomp = 12,
|
||||
Ncomp = 12
|
||||
} Drawop;
|
||||
|
||||
/*
|
||||
|
|
@ -117,7 +117,7 @@ enum {
|
|||
CAlpha,
|
||||
CMap,
|
||||
CIgnore,
|
||||
NChan,
|
||||
NChan
|
||||
};
|
||||
|
||||
#define __DC(type, nbits) ((((type)&15)<<4)|((nbits)&15))
|
||||
|
|
@ -143,7 +143,7 @@ enum {
|
|||
ARGB32 = CHAN4(CAlpha, 8, CRed, 8, CGreen, 8, CBlue, 8), /* stupid VGAs */
|
||||
ABGR32 = CHAN4(CAlpha, 8, CBlue, 8, CGreen, 8, CRed, 8),
|
||||
XRGB32 = CHAN4(CIgnore, 8, CRed, 8, CGreen, 8, CBlue, 8),
|
||||
XBGR32 = CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8),
|
||||
XBGR32 = CHAN4(CIgnore, 8, CBlue, 8, CGreen, 8, CRed, 8)
|
||||
};
|
||||
|
||||
extern char* chantostr(char*, u32int);
|
||||
|
|
@ -526,7 +526,7 @@ extern void drawsetdebug(int);
|
|||
*/
|
||||
enum
|
||||
{
|
||||
SnarfSize = 64*1024,
|
||||
SnarfSize = 64*1024
|
||||
};
|
||||
char *getsnarf(void);
|
||||
void putsnarf(char*);
|
||||
|
|
|
|||
|
|
@ -10,13 +10,13 @@ typedef struct Menu Menu;
|
|||
enum
|
||||
{
|
||||
Emouse = 1,
|
||||
Ekeyboard = 2,
|
||||
Ekeyboard = 2
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
MAXSLAVE = 32,
|
||||
EMAXMSG = 128+8192, /* size of 9p header+data */
|
||||
EMAXMSG = 128+8192 /* size of 9p header+data */
|
||||
};
|
||||
|
||||
struct Mouse
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ enum
|
|||
Tmax,
|
||||
|
||||
Topenfd = 98,
|
||||
Ropenfd,
|
||||
Ropenfd
|
||||
};
|
||||
|
||||
uint convM2S(uchar*, uint, Fcall*);
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ enum
|
|||
FlateInputFail = -2,
|
||||
FlateOutputFail = -3,
|
||||
FlateCorrupted = -4,
|
||||
FlateInternal = -5,
|
||||
FlateInternal = -5
|
||||
};
|
||||
|
||||
int deflateinit(void);
|
||||
|
|
|
|||
490
include/html.h
490
include/html.h
|
|
@ -10,13 +10,13 @@ AUTOLIB(html)
|
|||
#pragma src "/sys/src/libhtml"
|
||||
*/
|
||||
|
||||
// UTILS
|
||||
/* UTILS */
|
||||
extern uchar* fromStr(Rune* buf, int n, int chset);
|
||||
extern Rune* toStr(uchar* buf, int n, int chset);
|
||||
|
||||
// Common LEX and BUILD enums
|
||||
/* Common LEX and BUILD enums */
|
||||
|
||||
// Media types
|
||||
/* Media types */
|
||||
enum
|
||||
{
|
||||
ApplMsword,
|
||||
|
|
@ -58,14 +58,14 @@ enum
|
|||
NMEDIATYPES
|
||||
};
|
||||
|
||||
// HTTP methods
|
||||
/* HTTP methods */
|
||||
enum
|
||||
{
|
||||
HGet,
|
||||
HPost
|
||||
};
|
||||
|
||||
// Charsets
|
||||
/* Charsets */
|
||||
enum
|
||||
{
|
||||
UnknownCharset,
|
||||
|
|
@ -76,7 +76,7 @@ enum
|
|||
NCHARSETS
|
||||
};
|
||||
|
||||
// Frame Target IDs
|
||||
/* Frame Target IDs */
|
||||
enum {
|
||||
FTtop,
|
||||
FTself,
|
||||
|
|
@ -84,11 +84,11 @@ enum {
|
|||
FTblank
|
||||
};
|
||||
|
||||
// LEX
|
||||
/* LEX */
|
||||
typedef struct Token Token;
|
||||
typedef struct Attr Attr;
|
||||
|
||||
// BUILD
|
||||
/* BUILD */
|
||||
|
||||
typedef struct Item Item;
|
||||
typedef struct Itext Itext;
|
||||
|
|
@ -119,9 +119,9 @@ typedef struct Docinfo Docinfo;
|
|||
typedef struct Stack Stack;
|
||||
typedef struct Pstate Pstate;
|
||||
typedef struct ItemSource ItemSource;
|
||||
typedef struct Lay Lay; // defined in Layout module
|
||||
typedef struct Lay Lay; /* defined in Layout module */
|
||||
|
||||
// Alignment types
|
||||
/* Alignment types */
|
||||
enum {
|
||||
ALnone = 0, ALleft, ALcenter, ALright, ALjustify,
|
||||
ALchar, ALtop, ALmiddle, ALbottom, ALbaseline
|
||||
|
|
@ -129,16 +129,16 @@ enum {
|
|||
|
||||
struct Align
|
||||
{
|
||||
uchar halign; // one of ALnone, ALleft, etc.
|
||||
uchar valign; // one of ALnone, ALtop, etc.
|
||||
uchar halign; /* one of ALnone, ALleft, etc. */
|
||||
uchar valign; /* one of ALnone, ALtop, etc. */
|
||||
};
|
||||
|
||||
// A Dimen holds a dimension specification, especially for those
|
||||
// cases when a number can be followed by a % or a * to indicate
|
||||
// percentage of total or relative weight.
|
||||
// Dnone means no dimension was specified
|
||||
/* A Dimen holds a dimension specification, especially for those */
|
||||
/* cases when a number can be followed by a % or a * to indicate */
|
||||
/* percentage of total or relative weight. */
|
||||
/* Dnone means no dimension was specified */
|
||||
|
||||
// To fit in a word, use top bits to identify kind, rest for value
|
||||
/* To fit in a word, use top bits to identify kind, rest for value */
|
||||
enum {
|
||||
Dnone = 0,
|
||||
Dpixels = (1<<29),
|
||||
|
|
@ -150,36 +150,36 @@ enum {
|
|||
|
||||
struct Dimen
|
||||
{
|
||||
int kindspec; // kind | spec
|
||||
int kindspec; /* kind | spec */
|
||||
};
|
||||
|
||||
// Background is either an image or a color.
|
||||
// If both are set, the image has precedence.
|
||||
/* Background is either an image or a color. */
|
||||
/* If both are set, the image has precedence. */
|
||||
struct Background
|
||||
{
|
||||
Rune* image; // url
|
||||
Rune* image; /* url */
|
||||
int color;
|
||||
};
|
||||
|
||||
|
||||
// There are about a half dozen Item variants.
|
||||
// The all look like this at the start (using Plan 9 C's
|
||||
// anonymous structure member mechanism),
|
||||
// and then the tag field dictates what extra fields there are.
|
||||
/* There are about a half dozen Item variants. */
|
||||
/* The all look like this at the start (using Plan 9 C's */
|
||||
/* anonymous structure member mechanism), */
|
||||
/* and then the tag field dictates what extra fields there are. */
|
||||
struct Item
|
||||
{
|
||||
Item* next; // successor in list of items
|
||||
int width; // width in pixels (0 for floating items)
|
||||
int height; // height in pixels
|
||||
Item* next; /* successor in list of items */
|
||||
int width; /* width in pixels (0 for floating items) */
|
||||
int height; /* height in pixels */
|
||||
Rectangle r;
|
||||
int ascent; // ascent (from top to baseline) in pixels
|
||||
int anchorid; // if nonzero, which anchor we're in
|
||||
int state; // flags and values (see below)
|
||||
Genattr* genattr; // generic attributes and events
|
||||
int tag; // variant discriminator: Itexttag, etc.
|
||||
int ascent; /* ascent (from top to baseline) in pixels */
|
||||
int anchorid; /* if nonzero, which anchor we're in */
|
||||
int state; /* flags and values (see below) */
|
||||
Genattr* genattr; /* generic attributes and events */
|
||||
int tag; /* variant discriminator: Itexttag, etc. */
|
||||
};
|
||||
|
||||
// Item variant tags
|
||||
/* Item variant tags */
|
||||
enum {
|
||||
Itexttag,
|
||||
Iruletag,
|
||||
|
|
@ -192,45 +192,45 @@ enum {
|
|||
|
||||
struct Itext
|
||||
{
|
||||
Item item; // (with tag ==Itexttag)
|
||||
Rune* s; // the characters
|
||||
int fnt; // style*NumSize+size (see font stuff, below)
|
||||
int fg; // Pixel (color) for text
|
||||
uchar voff; // Voffbias+vertical offset from baseline, in pixels (+ve == down)
|
||||
uchar ul; // ULnone, ULunder, or ULmid
|
||||
Item item; /* (with tag ==Itexttag) */
|
||||
Rune* s; /* the characters */
|
||||
int fnt; /* style*NumSize+size (see font stuff, below) */
|
||||
int fg; /* Pixel (color) for text */
|
||||
uchar voff; /* Voffbias+vertical offset from baseline, in pixels (+ve == down) */
|
||||
uchar ul; /* ULnone, ULunder, or ULmid */
|
||||
};
|
||||
|
||||
struct Irule
|
||||
{
|
||||
Item item; // (with tag ==Iruletag)
|
||||
uchar align; // alignment spec
|
||||
uchar noshade; // if true, don't shade
|
||||
int size; // size attr (rule height)
|
||||
Dimen wspec; // width spec
|
||||
Item item; /* (with tag ==Iruletag) */
|
||||
uchar align; /* alignment spec */
|
||||
uchar noshade; /* if true, don't shade */
|
||||
int size; /* size attr (rule height) */
|
||||
Dimen wspec; /* width spec */
|
||||
};
|
||||
|
||||
|
||||
struct Iimage
|
||||
{
|
||||
Item item; // (with tag ==Iimagetag)
|
||||
Rune* imsrc; // image src url
|
||||
int imwidth; // spec width (actual, if no spec)
|
||||
int imheight; // spec height (actual, if no spec)
|
||||
Rune* altrep; // alternate representation, in absence of image
|
||||
Map* map; // if non-nil, client side map
|
||||
int ctlid; // if animated
|
||||
uchar align; // vertical alignment
|
||||
uchar hspace; // in pixels; buffer space on each side
|
||||
uchar vspace; // in pixels; buffer space on top and bottom
|
||||
uchar border; // in pixels: border width to draw around image
|
||||
Iimage* nextimage; // next in list of document's images
|
||||
Item item; /* (with tag ==Iimagetag) */
|
||||
Rune* imsrc; /* image src url */
|
||||
int imwidth; /* spec width (actual, if no spec) */
|
||||
int imheight; /* spec height (actual, if no spec) */
|
||||
Rune* altrep; /* alternate representation, in absence of image */
|
||||
Map* map; /* if non-nil, client side map */
|
||||
int ctlid; /* if animated */
|
||||
uchar align; /* vertical alignment */
|
||||
uchar hspace; /* in pixels; buffer space on each side */
|
||||
uchar vspace; /* in pixels; buffer space on top and bottom */
|
||||
uchar border; /* in pixels: border width to draw around image */
|
||||
Iimage* nextimage; /* next in list of document's images */
|
||||
void *aux;
|
||||
};
|
||||
|
||||
|
||||
struct Iformfield
|
||||
{
|
||||
Item item; // (with tag ==Iformfieldtag)
|
||||
Item item; /* (with tag ==Iformfieldtag) */
|
||||
Formfield* formfield;
|
||||
void *aux;
|
||||
};
|
||||
|
|
@ -238,59 +238,59 @@ struct Iformfield
|
|||
|
||||
struct Itable
|
||||
{
|
||||
Item item; // (with tag ==Itabletag)
|
||||
Item item; /* (with tag ==Itabletag) */
|
||||
Table* table;
|
||||
};
|
||||
|
||||
|
||||
struct Ifloat
|
||||
{
|
||||
Item _item; // (with tag ==Ifloattag)
|
||||
Item* item; // table or image item that floats
|
||||
int x; // x coord of top (from right, if ALright)
|
||||
int y; // y coord of top
|
||||
uchar side; // margin it floats to: ALleft or ALright
|
||||
uchar infloats; // true if this has been added to a lay.floats
|
||||
Ifloat* nextfloat; // in list of floats
|
||||
Item _item; /* (with tag ==Ifloattag) */
|
||||
Item* item; /* table or image item that floats */
|
||||
int x; /* x coord of top (from right, if ALright) */
|
||||
int y; /* y coord of top */
|
||||
uchar side; /* margin it floats to: ALleft or ALright */
|
||||
uchar infloats; /* true if this has been added to a lay.floats */
|
||||
Ifloat* nextfloat; /* in list of floats */
|
||||
};
|
||||
|
||||
|
||||
struct Ispacer
|
||||
{
|
||||
Item item; // (with tag ==Ispacertag)
|
||||
int spkind; // ISPnull, etc.
|
||||
Item item; /* (with tag ==Ispacertag) */
|
||||
int spkind; /* ISPnull, etc. */
|
||||
};
|
||||
|
||||
// Item state flags and value fields
|
||||
/* Item state flags and value fields */
|
||||
enum {
|
||||
// IFbrk = 0x80000000, // forced break before this item
|
||||
/* IFbrk = 0x80000000, // forced break before this item */
|
||||
#define IFbrk 0x80000000 /* too big for sun */
|
||||
IFbrksp = 0x40000000, // add 1 line space to break (IFbrk set too)
|
||||
IFnobrk = 0x20000000, // break not allowed before this item
|
||||
IFcleft = 0x10000000, // clear left floats (IFbrk set too)
|
||||
IFcright = 0x08000000, // clear right floats (IFbrk set too)
|
||||
IFwrap = 0x04000000, // in a wrapping (non-pre) line
|
||||
IFhang = 0x02000000, // in a hanging (into left indent) item
|
||||
IFrjust = 0x01000000, // right justify current line
|
||||
IFcjust = 0x00800000, // center justify current line
|
||||
IFsmap = 0x00400000, // image is server-side map
|
||||
IFbrksp = 0x40000000, /* add 1 line space to break (IFbrk set too) */
|
||||
IFnobrk = 0x20000000, /* break not allowed before this item */
|
||||
IFcleft = 0x10000000, /* clear left floats (IFbrk set too) */
|
||||
IFcright = 0x08000000, /* clear right floats (IFbrk set too) */
|
||||
IFwrap = 0x04000000, /* in a wrapping (non-pre) line */
|
||||
IFhang = 0x02000000, /* in a hanging (into left indent) item */
|
||||
IFrjust = 0x01000000, /* right justify current line */
|
||||
IFcjust = 0x00800000, /* center justify current line */
|
||||
IFsmap = 0x00400000, /* image is server-side map */
|
||||
IFindentshift = 8,
|
||||
IFindentmask = (255<<IFindentshift), // current indent, in tab stops
|
||||
IFhangmask = 255 // current hang into left indent, in 1/10th tabstops
|
||||
IFindentmask = (255<<IFindentshift), /* current indent, in tab stops */
|
||||
IFhangmask = 255 /* current hang into left indent, in 1/10th tabstops */
|
||||
};
|
||||
|
||||
// Bias added to Itext's voff field
|
||||
/* Bias added to Itext's voff field */
|
||||
enum { Voffbias = 128 };
|
||||
|
||||
// Spacer kinds
|
||||
/* Spacer kinds */
|
||||
enum {
|
||||
ISPnull, // 0 height and width
|
||||
ISPvline, // height and ascent of current font
|
||||
ISPhspace, // width of space in current font
|
||||
ISPgeneral // other purposes (e.g., between markers and list)
|
||||
ISPnull, /* 0 height and width */
|
||||
ISPvline, /* height and ascent of current font */
|
||||
ISPhspace, /* width of space in current font */
|
||||
ISPgeneral /* other purposes (e.g., between markers and list) */
|
||||
};
|
||||
|
||||
// Generic attributes and events (not many elements will have any of these set)
|
||||
/* Generic attributes and events (not many elements will have any of these set) */
|
||||
struct Genattr
|
||||
{
|
||||
Rune* id;
|
||||
|
|
@ -302,8 +302,8 @@ struct Genattr
|
|||
|
||||
struct SEvent
|
||||
{
|
||||
SEvent* next; // in list of events
|
||||
int type; // SEonblur, etc.
|
||||
SEvent* next; /* in list of events */
|
||||
int type; /* SEonblur, etc. */
|
||||
Rune* script;
|
||||
};
|
||||
|
||||
|
|
@ -316,7 +316,7 @@ enum {
|
|||
Numscriptev
|
||||
};
|
||||
|
||||
// Form field types
|
||||
/* Form field types */
|
||||
enum {
|
||||
Ftext,
|
||||
Fpassword,
|
||||
|
|
@ -332,24 +332,24 @@ enum {
|
|||
Ftextarea
|
||||
};
|
||||
|
||||
// Information about a field in a form
|
||||
/* Information about a field in a form */
|
||||
struct Formfield
|
||||
{
|
||||
Formfield* next; // in list of fields for a form
|
||||
int ftype; // Ftext, Fpassword, etc.
|
||||
int fieldid; // serial no. of field within its form
|
||||
Form* form; // containing form
|
||||
Rune* name; // name attr
|
||||
Rune* value; // value attr
|
||||
int size; // size attr
|
||||
int maxlength; // maxlength attr
|
||||
int rows; // rows attr
|
||||
int cols; // cols attr
|
||||
uchar flags; // FFchecked, etc.
|
||||
Option* options; // for Fselect fields
|
||||
Item* image; // image item, for Fimage fields
|
||||
int ctlid; // identifies control for this field in layout
|
||||
SEvent* events; // same as genattr->events of containing item
|
||||
Formfield* next; /* in list of fields for a form */
|
||||
int ftype; /* Ftext, Fpassword, etc. */
|
||||
int fieldid; /* serial no. of field within its form */
|
||||
Form* form; /* containing form */
|
||||
Rune* name; /* name attr */
|
||||
Rune* value; /* value attr */
|
||||
int size; /* size attr */
|
||||
int maxlength; /* maxlength attr */
|
||||
int rows; /* rows attr */
|
||||
int cols; /* cols attr */
|
||||
uchar flags; /* FFchecked, etc. */
|
||||
Option* options; /* for Fselect fields */
|
||||
Item* image; /* image item, for Fimage fields */
|
||||
int ctlid; /* identifies control for this field in layout */
|
||||
SEvent* events; /* same as genattr->events of containing item */
|
||||
};
|
||||
|
||||
enum {
|
||||
|
|
@ -357,29 +357,29 @@ enum {
|
|||
FFmultiple = (1<<6)
|
||||
};
|
||||
|
||||
// Option holds info about an option in a "select" form field
|
||||
/* Option holds info about an option in a "select" form field */
|
||||
struct Option
|
||||
{
|
||||
Option* next; // next in list of options for a field
|
||||
int selected; // true if selected initially
|
||||
Rune* value; // value attr
|
||||
Rune* display; // display string
|
||||
Option* next; /* next in list of options for a field */
|
||||
int selected; /* true if selected initially */
|
||||
Rune* value; /* value attr */
|
||||
Rune* display; /* display string */
|
||||
};
|
||||
|
||||
// Form holds info about a form
|
||||
/* Form holds info about a form */
|
||||
struct Form
|
||||
{
|
||||
Form* next; // in list of forms for document
|
||||
int formid; // serial no. of form within its doc
|
||||
Rune* name; // name or id attr (netscape uses name, HTML 4.0 uses id)
|
||||
Rune* action; // action attr
|
||||
int target; // target attr as targetid
|
||||
int method; // HGet or HPost
|
||||
int nfields; // number of fields
|
||||
Formfield* fields; // field's forms, in input order
|
||||
Form* next; /* in list of forms for document */
|
||||
int formid; /* serial no. of form within its doc */
|
||||
Rune* name; /* name or id attr (netscape uses name, HTML 4.0 uses id) */
|
||||
Rune* action; /* action attr */
|
||||
int target; /* target attr as targetid */
|
||||
int method; /* HGet or HPost */
|
||||
int nfields; /* number of fields */
|
||||
Formfield* fields; /* field's forms, in input order */
|
||||
};
|
||||
|
||||
// Flags used in various table structures
|
||||
/* Flags used in various table structures */
|
||||
enum {
|
||||
TFparsing = (1<<7),
|
||||
TFnowrap = (1<<6),
|
||||
|
|
@ -387,33 +387,33 @@ enum {
|
|||
};
|
||||
|
||||
|
||||
// Information about a table
|
||||
/* Information about a table */
|
||||
struct Table
|
||||
{
|
||||
Table* next; // next in list of document's tables
|
||||
int tableid; // serial no. of table within its doc
|
||||
Tablerow* rows; // array of row specs (list during parsing)
|
||||
int nrow; // total number of rows
|
||||
Tablecol* cols; // array of column specs
|
||||
int ncol; // total number of columns
|
||||
Tablecell* cells; // list of unique cells
|
||||
int ncell; // total number of cells
|
||||
Tablecell*** grid; // 2-D array of cells
|
||||
Align align; // alignment spec for whole table
|
||||
Dimen width; // width spec for whole table
|
||||
int border; // border attr
|
||||
int cellspacing; // cellspacing attr
|
||||
int cellpadding; // cellpadding attr
|
||||
Background background; // table background
|
||||
Item* caption; // linked list of Items, giving caption
|
||||
uchar caption_place; // ALtop or ALbottom
|
||||
Lay* caption_lay; // layout of caption
|
||||
int totw; // total width
|
||||
int toth; // total height
|
||||
int caph; // caption height
|
||||
int availw; // used for previous 3 sizes
|
||||
Token* tabletok; // token that started the table
|
||||
uchar flags; // Lchanged, perhaps
|
||||
Table* next; /* next in list of document's tables */
|
||||
int tableid; /* serial no. of table within its doc */
|
||||
Tablerow* rows; /* array of row specs (list during parsing) */
|
||||
int nrow; /* total number of rows */
|
||||
Tablecol* cols; /* array of column specs */
|
||||
int ncol; /* total number of columns */
|
||||
Tablecell* cells; /* list of unique cells */
|
||||
int ncell; /* total number of cells */
|
||||
Tablecell*** grid; /* 2-D array of cells */
|
||||
Align align; /* alignment spec for whole table */
|
||||
Dimen width; /* width spec for whole table */
|
||||
int border; /* border attr */
|
||||
int cellspacing; /* cellspacing attr */
|
||||
int cellpadding; /* cellpadding attr */
|
||||
Background background; /* table background */
|
||||
Item* caption; /* linked list of Items, giving caption */
|
||||
uchar caption_place; /* ALtop or ALbottom */
|
||||
Lay* caption_lay; /* layout of caption */
|
||||
int totw; /* total width */
|
||||
int toth; /* total height */
|
||||
int caph; /* caption height */
|
||||
int availw; /* used for previous 3 sizes */
|
||||
Token* tabletok; /* token that started the table */
|
||||
uchar flags; /* Lchanged, perhaps */
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -427,101 +427,101 @@ struct Tablecol
|
|||
|
||||
struct Tablerow
|
||||
{
|
||||
Tablerow* next; // Next in list of rows, during parsing
|
||||
Tablecell* cells; // Cells in row, linked through nextinrow
|
||||
Tablerow* next; /* Next in list of rows, during parsing */
|
||||
Tablecell* cells; /* Cells in row, linked through nextinrow */
|
||||
int height;
|
||||
int ascent;
|
||||
Align align;
|
||||
Background background;
|
||||
Point pos;
|
||||
uchar flags; // 0 or TFparsing
|
||||
uchar flags; /* 0 or TFparsing */
|
||||
};
|
||||
|
||||
|
||||
// A Tablecell is one cell of a table.
|
||||
// It may span multiple rows and multiple columns.
|
||||
// Cells are linked on two lists: the list for all the cells of
|
||||
// a document (the next pointers), and the list of all the
|
||||
// cells that start in a given row (the nextinrow pointers)
|
||||
/* A Tablecell is one cell of a table. */
|
||||
/* It may span multiple rows and multiple columns. */
|
||||
/* Cells are linked on two lists: the list for all the cells of */
|
||||
/* a document (the next pointers), and the list of all the */
|
||||
/* cells that start in a given row (the nextinrow pointers) */
|
||||
struct Tablecell
|
||||
{
|
||||
Tablecell* next; // next in list of table's cells
|
||||
Tablecell* nextinrow; // next in list of row's cells
|
||||
int cellid; // serial no. of cell within table
|
||||
Item* content; // contents before layout
|
||||
Lay* lay; // layout of cell
|
||||
int rowspan; // number of rows spanned by this cell
|
||||
int colspan; // number of cols spanned by this cell
|
||||
Align align; // alignment spec
|
||||
uchar flags; // TFparsing, TFnowrap, TFisth
|
||||
Dimen wspec; // suggested width
|
||||
int hspec; // suggested height
|
||||
Background background; // cell background
|
||||
int minw; // minimum possible width
|
||||
int maxw; // maximum width
|
||||
int ascent; // cell's ascent
|
||||
int row; // row of upper left corner
|
||||
int col; // col of upper left corner
|
||||
Point pos; // nw corner of cell contents, in cell
|
||||
Tablecell* next; /* next in list of table's cells */
|
||||
Tablecell* nextinrow; /* next in list of row's cells */
|
||||
int cellid; /* serial no. of cell within table */
|
||||
Item* content; /* contents before layout */
|
||||
Lay* lay; /* layout of cell */
|
||||
int rowspan; /* number of rows spanned by this cell */
|
||||
int colspan; /* number of cols spanned by this cell */
|
||||
Align align; /* alignment spec */
|
||||
uchar flags; /* TFparsing, TFnowrap, TFisth */
|
||||
Dimen wspec; /* suggested width */
|
||||
int hspec; /* suggested height */
|
||||
Background background; /* cell background */
|
||||
int minw; /* minimum possible width */
|
||||
int maxw; /* maximum width */
|
||||
int ascent; /* cell's ascent */
|
||||
int row; /* row of upper left corner */
|
||||
int col; /* col of upper left corner */
|
||||
Point pos; /* nw corner of cell contents, in cell */
|
||||
};
|
||||
|
||||
// Anchor is for info about hyperlinks that go somewhere
|
||||
/* Anchor is for info about hyperlinks that go somewhere */
|
||||
struct Anchor
|
||||
{
|
||||
Anchor* next; // next in list of document's anchors
|
||||
int index; // serial no. of anchor within its doc
|
||||
Rune* name; // name attr
|
||||
Rune* href; // href attr
|
||||
int target; // target attr as targetid
|
||||
Anchor* next; /* next in list of document's anchors */
|
||||
int index; /* serial no. of anchor within its doc */
|
||||
Rune* name; /* name attr */
|
||||
Rune* href; /* href attr */
|
||||
int target; /* target attr as targetid */
|
||||
};
|
||||
|
||||
|
||||
// DestAnchor is for info about hyperlinks that are destinations
|
||||
/* DestAnchor is for info about hyperlinks that are destinations */
|
||||
struct DestAnchor
|
||||
{
|
||||
DestAnchor* next; // next in list of document's destanchors
|
||||
int index; // serial no. of anchor within its doc
|
||||
Rune* name; // name attr
|
||||
Item* item; // the destination
|
||||
DestAnchor* next; /* next in list of document's destanchors */
|
||||
int index; /* serial no. of anchor within its doc */
|
||||
Rune* name; /* name attr */
|
||||
Item* item; /* the destination */
|
||||
};
|
||||
|
||||
|
||||
// Maps (client side)
|
||||
/* Maps (client side) */
|
||||
struct Map
|
||||
{
|
||||
Map* next; // next in list of document's maps
|
||||
Rune* name; // map name
|
||||
Area* areas; // list of map areas
|
||||
Map* next; /* next in list of document's maps */
|
||||
Rune* name; /* map name */
|
||||
Area* areas; /* list of map areas */
|
||||
};
|
||||
|
||||
|
||||
struct Area
|
||||
{
|
||||
Area* next; // next in list of a map's areas
|
||||
int shape; // SHrect, etc.
|
||||
Rune* href; // associated hypertext link
|
||||
int target; // associated target frame
|
||||
Dimen* coords; // array of coords for shape
|
||||
int ncoords; // size of coords array
|
||||
Area* next; /* next in list of a map's areas */
|
||||
int shape; /* SHrect, etc. */
|
||||
Rune* href; /* associated hypertext link */
|
||||
int target; /* associated target frame */
|
||||
Dimen* coords; /* array of coords for shape */
|
||||
int ncoords; /* size of coords array */
|
||||
};
|
||||
|
||||
// Area shapes
|
||||
/* Area shapes */
|
||||
enum {
|
||||
SHrect, SHcircle, SHpoly
|
||||
};
|
||||
|
||||
// Fonts are represented by integers: style*NumSize + size
|
||||
/* Fonts are represented by integers: style*NumSize + size */
|
||||
|
||||
// Font styles
|
||||
/* Font styles */
|
||||
enum {
|
||||
FntR, // roman
|
||||
FntI, // italic
|
||||
FntB, // bold
|
||||
FntT, // typewriter
|
||||
FntR, /* roman */
|
||||
FntI, /* italic */
|
||||
FntB, /* bold */
|
||||
FntT, /* typewriter */
|
||||
NumStyle
|
||||
};
|
||||
|
||||
// Font sizes
|
||||
/* Font sizes */
|
||||
enum {
|
||||
Tiny,
|
||||
Small,
|
||||
|
|
@ -536,12 +536,12 @@ enum {
|
|||
DefFnt = (FntR*NumSize+Normal)
|
||||
};
|
||||
|
||||
// Lines are needed through some text items, for underlining or strikethrough
|
||||
/* Lines are needed through some text items, for underlining or strikethrough */
|
||||
enum {
|
||||
ULnone, ULunder, ULmid
|
||||
};
|
||||
|
||||
// Kidinfo flags
|
||||
/* Kidinfo flags */
|
||||
enum {
|
||||
FRnoresize = (1<<0),
|
||||
FRnoscroll = (1<<1),
|
||||
|
|
@ -551,59 +551,59 @@ enum {
|
|||
FRvscrollauto = (1<<5)
|
||||
};
|
||||
|
||||
// Information about child frame or frameset
|
||||
/* Information about child frame or frameset */
|
||||
struct Kidinfo
|
||||
{
|
||||
Kidinfo* next; // in list of kidinfos for a frameset
|
||||
Kidinfo* next; /* in list of kidinfos for a frameset */
|
||||
int isframeset;
|
||||
|
||||
// fields for "frame"
|
||||
Rune* src; // only nil if a "dummy" frame or this is frameset
|
||||
Rune* name; // always non-empty if this isn't frameset
|
||||
/* fields for "frame" */
|
||||
Rune* src; /* only nil if a "dummy" frame or this is frameset */
|
||||
Rune* name; /* always non-empty if this isn't frameset */
|
||||
int marginw;
|
||||
int marginh;
|
||||
int framebd;
|
||||
int flags;
|
||||
|
||||
// fields for "frameset"
|
||||
Dimen* rows; // array of row dimensions
|
||||
int nrows; // length of rows
|
||||
Dimen* cols; // array of col dimensions
|
||||
int ncols; // length of cols
|
||||
/* fields for "frameset" */
|
||||
Dimen* rows; /* array of row dimensions */
|
||||
int nrows; /* length of rows */
|
||||
Dimen* cols; /* array of col dimensions */
|
||||
int ncols; /* length of cols */
|
||||
Kidinfo* kidinfos;
|
||||
Kidinfo* nextframeset; // parsing stack
|
||||
Kidinfo* nextframeset; /* parsing stack */
|
||||
};
|
||||
|
||||
|
||||
// Document info (global information about HTML page)
|
||||
/* Document info (global information about HTML page) */
|
||||
struct Docinfo
|
||||
{
|
||||
// stuff from HTTP headers, doc head, and body tag
|
||||
Rune* src; // original source of doc
|
||||
Rune* base; // base URL of doc
|
||||
Rune* doctitle; // from <title> element
|
||||
Background background; // background specification
|
||||
Iimage* backgrounditem; // Image Item for doc background image, or nil
|
||||
int text; // doc foreground (text) color
|
||||
int link; // unvisited hyperlink color
|
||||
int vlink; // visited hyperlink color
|
||||
int alink; // highlighting hyperlink color
|
||||
int target; // target frame default
|
||||
int chset; // ISO_8859, etc.
|
||||
int mediatype; // TextHtml, etc.
|
||||
int scripttype; // TextJavascript, etc.
|
||||
int hasscripts; // true if scripts used
|
||||
Rune* refresh; // content of <http-equiv=Refresh ...>
|
||||
Kidinfo* kidinfo; // if a frameset
|
||||
int frameid; // id of document frame
|
||||
/* stuff from HTTP headers, doc head, and body tag */
|
||||
Rune* src; /* original source of doc */
|
||||
Rune* base; /* base URL of doc */
|
||||
Rune* doctitle; /* from <title> element */
|
||||
Background background; /* background specification */
|
||||
Iimage* backgrounditem; /* Image Item for doc background image, or nil */
|
||||
int text; /* doc foreground (text) color */
|
||||
int link; /* unvisited hyperlink color */
|
||||
int vlink; /* visited hyperlink color */
|
||||
int alink; /* highlighting hyperlink color */
|
||||
int target; /* target frame default */
|
||||
int chset; /* ISO_8859, etc. */
|
||||
int mediatype; /* TextHtml, etc. */
|
||||
int scripttype; /* TextJavascript, etc. */
|
||||
int hasscripts; /* true if scripts used */
|
||||
Rune* refresh; /* content of <http-equiv=Refresh ...> */
|
||||
Kidinfo* kidinfo; /* if a frameset */
|
||||
int frameid; /* id of document frame */
|
||||
|
||||
// info needed to respond to user actions
|
||||
Anchor* anchors; // list of href anchors
|
||||
DestAnchor* dests; // list of destination anchors
|
||||
Form* forms; // list of forms
|
||||
Table* tables; // list of tables
|
||||
Map* maps; // list of maps
|
||||
Iimage* images; // list of image items (through nextimage links)
|
||||
/* info needed to respond to user actions */
|
||||
Anchor* anchors; /* list of href anchors */
|
||||
DestAnchor* dests; /* list of destination anchors */
|
||||
Form* forms; /* list of forms */
|
||||
Table* tables; /* list of tables */
|
||||
Map* maps; /* list of maps */
|
||||
Iimage* images; /* list of image items (through nextimage links) */
|
||||
};
|
||||
|
||||
extern int dimenkind(Dimen d);
|
||||
|
|
@ -618,14 +618,14 @@ extern int validitems(Item* i);
|
|||
|
||||
/* #pragma varargck type "I" Item* */
|
||||
|
||||
// Control print output
|
||||
/* Control print output */
|
||||
extern int warn;
|
||||
extern int dbglex;
|
||||
extern int dbgbuild;
|
||||
|
||||
// To be provided by caller
|
||||
// emalloc and erealloc should not return if can't get memory.
|
||||
// emalloc should zero its memory.
|
||||
/* To be provided by caller */
|
||||
/* emalloc and erealloc should not return if can't get memory. */
|
||||
/* emalloc should zero its memory. */
|
||||
extern void* emalloc(ulong);
|
||||
extern void* erealloc(void* p, ulong size);
|
||||
#ifdef __cpluspplus
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ enum
|
|||
HExpectFail,
|
||||
HUnkVers,
|
||||
HBadCont,
|
||||
HOK,
|
||||
HOK
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum
|
|||
IPaddrlen= 16,
|
||||
IPv4addrlen= 4,
|
||||
IPv4off= 12,
|
||||
IPllen= 4,
|
||||
IPllen= 4
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -80,7 +80,7 @@ struct Ipifc
|
|||
*/
|
||||
enum
|
||||
{
|
||||
Udphdrsize= 52, /* size of a Udphdr */
|
||||
Udphdrsize= 52 /* size of a Udphdr */
|
||||
};
|
||||
|
||||
typedef struct Udphdr Udphdr;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ enum {
|
|||
|
||||
Kalt= KF|0x15,
|
||||
Kshift= KF|0x16,
|
||||
Kctl= KF|0x17,
|
||||
Kctl= KF|0x17
|
||||
};
|
||||
|
||||
#if defined(__cplusplus)
|
||||
|
|
|
|||
|
|
@ -349,7 +349,7 @@ extern vlong p9nsec(void);
|
|||
enum
|
||||
{
|
||||
PNPROC = 1,
|
||||
PNGROUP = 2,
|
||||
PNGROUP = 2
|
||||
};
|
||||
|
||||
/* extern int abs(int); <stdlib.h> */
|
||||
|
|
@ -671,7 +671,7 @@ enum
|
|||
RFNOWAIT = (1<<6),
|
||||
RFCNAMEG = (1<<10),
|
||||
RFCENVG = (1<<11),
|
||||
RFCFDG = (1<<12),
|
||||
RFCFDG = (1<<12)
|
||||
/* RFREND = (1<<13), */
|
||||
/* RFNOMNT = (1<<14) */
|
||||
};
|
||||
|
|
|
|||
142
include/libsec.h
142
include/libsec.h
|
|
@ -14,9 +14,9 @@ AUTOLIB(sec)
|
|||
typedef struct mpint mpint;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// AES definitions
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* AES definitions */
|
||||
/*******************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -41,9 +41,9 @@ void setupAESstate(AESstate *s, uchar key[], int keybytes, uchar *ivec);
|
|||
void aesCBCencrypt(uchar *p, int len, AESstate *s);
|
||||
void aesCBCdecrypt(uchar *p, int len, AESstate *s);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// Blowfish Definitions
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* Blowfish Definitions */
|
||||
/*******************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -51,7 +51,7 @@ enum
|
|||
BFrounds = 16
|
||||
};
|
||||
|
||||
// 16-round Blowfish
|
||||
/* 16-round Blowfish */
|
||||
typedef struct BFstate BFstate;
|
||||
struct BFstate
|
||||
{
|
||||
|
|
@ -70,16 +70,16 @@ void bfCBCdecrypt(uchar*, int, BFstate*);
|
|||
void bfECBencrypt(uchar*, int, BFstate*);
|
||||
void bfECBdecrypt(uchar*, int, BFstate*);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// DES definitions
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* DES definitions */
|
||||
/*******************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
DESbsize= 8
|
||||
};
|
||||
|
||||
// single des
|
||||
/* single des */
|
||||
typedef struct DESstate DESstate;
|
||||
struct DESstate
|
||||
{
|
||||
|
|
@ -97,12 +97,12 @@ void desCBCdecrypt(uchar*, int, DESstate*);
|
|||
void desECBencrypt(uchar*, int, DESstate*);
|
||||
void desECBdecrypt(uchar*, int, DESstate*);
|
||||
|
||||
// for backward compatibility with 7 byte DES key format
|
||||
/* for backward compatibility with 7 byte DES key format */
|
||||
void des56to64(uchar *k56, uchar *k64);
|
||||
void des64to56(uchar *k64, uchar *k56);
|
||||
void key_setup(uchar[7], ulong[32]);
|
||||
|
||||
// triple des encrypt/decrypt orderings
|
||||
/* triple des encrypt/decrypt orderings */
|
||||
enum {
|
||||
DES3E= 0,
|
||||
DES3D= 1,
|
||||
|
|
@ -128,9 +128,9 @@ void des3CBCdecrypt(uchar*, int, DES3state*);
|
|||
void des3ECBencrypt(uchar*, int, DES3state*);
|
||||
void des3ECBdecrypt(uchar*, int, DES3state*);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// digests
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* digests */
|
||||
/*******************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
|
|
@ -162,27 +162,27 @@ DigestState* hmac_sha1(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
|
|||
char* sha1pickle(SHA1state*);
|
||||
SHA1state* sha1unpickle(char*);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// random number generation
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* random number generation */
|
||||
/*******************************************************/
|
||||
void genrandom(uchar *buf, int nbytes);
|
||||
void prng(uchar *buf, int nbytes);
|
||||
ulong fastrand(void);
|
||||
ulong nfastrand(ulong);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// primes
|
||||
/////////////////////////////////////////////////////////
|
||||
void genprime(mpint *p, int n, int accuracy); // generate an n bit probable prime
|
||||
void gensafeprime(mpint *p, mpint *alpha, int n, int accuracy); // prime and generator
|
||||
void genstrongprime(mpint *p, int n, int accuracy); // generate an n bit strong prime
|
||||
/*******************************************************/
|
||||
/* primes */
|
||||
/*******************************************************/
|
||||
void genprime(mpint *p, int n, int accuracy); /* generate an n bit probable prime */
|
||||
void gensafeprime(mpint *p, mpint *alpha, int n, int accuracy); /* prime and generator */
|
||||
void genstrongprime(mpint *p, int n, int accuracy); /* generate an n bit strong prime */
|
||||
void DSAprimes(mpint *q, mpint *p, uchar seed[SHA1dlen]);
|
||||
int probably_prime(mpint *n, int nrep); // miller-rabin test
|
||||
int smallprimetest(mpint *p); // returns -1 if not prime, 0 otherwise
|
||||
int probably_prime(mpint *n, int nrep); /* miller-rabin test */
|
||||
int smallprimetest(mpint *p); /* returns -1 if not prime, 0 otherwise */
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// rc4
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* rc4 */
|
||||
/*******************************************************/
|
||||
typedef struct RC4state RC4state;
|
||||
struct RC4state
|
||||
{
|
||||
|
|
@ -196,33 +196,33 @@ void rc4(RC4state*, uchar*, int);
|
|||
void rc4skip(RC4state*, int);
|
||||
void rc4back(RC4state*, int);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// rsa
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* rsa */
|
||||
/*******************************************************/
|
||||
typedef struct RSApub RSApub;
|
||||
typedef struct RSApriv RSApriv;
|
||||
typedef struct PEMChain PEMChain;
|
||||
|
||||
// public/encryption key
|
||||
/* public/encryption key */
|
||||
struct RSApub
|
||||
{
|
||||
mpint *n; // modulus
|
||||
mpint *ek; // exp (encryption key)
|
||||
mpint *n; /* modulus */
|
||||
mpint *ek; /* exp (encryption key) */
|
||||
};
|
||||
|
||||
// private/decryption key
|
||||
/* private/decryption key */
|
||||
struct RSApriv
|
||||
{
|
||||
RSApub pub;
|
||||
|
||||
mpint *dk; // exp (decryption key)
|
||||
mpint *dk; /* exp (decryption key) */
|
||||
|
||||
// precomputed values to help with chinese remainder theorem calc
|
||||
/* precomputed values to help with chinese remainder theorem calc */
|
||||
mpint *p;
|
||||
mpint *q;
|
||||
mpint *kp; // dk mod p-1
|
||||
mpint *kq; // dk mod q-1
|
||||
mpint *c2; // (inv p) mod q
|
||||
mpint *kp; /* dk mod p-1 */
|
||||
mpint *kq; /* dk mod q-1 */
|
||||
mpint *c2; /* (inv p) mod q */
|
||||
};
|
||||
|
||||
struct PEMChain
|
||||
|
|
@ -248,29 +248,29 @@ uchar* X509gen(RSApriv *priv, char *subj, ulong valid[2], int *certlen);
|
|||
RSApriv* rsafill(mpint *n, mpint *ek, mpint *dk, mpint *p, mpint *q);
|
||||
uchar* X509req(RSApriv *priv, char *subj, int *certlen);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// elgamal
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* elgamal */
|
||||
/*******************************************************/
|
||||
typedef struct EGpub EGpub;
|
||||
typedef struct EGpriv EGpriv;
|
||||
typedef struct EGsig EGsig;
|
||||
|
||||
// public/encryption key
|
||||
/* public/encryption key */
|
||||
struct EGpub
|
||||
{
|
||||
mpint *p; // modulus
|
||||
mpint *alpha; // generator
|
||||
mpint *key; // (encryption key) alpha**secret mod p
|
||||
mpint *p; /* modulus */
|
||||
mpint *alpha; /* generator */
|
||||
mpint *key; /* (encryption key) alpha**secret mod p */
|
||||
};
|
||||
|
||||
// private/decryption key
|
||||
/* private/decryption key */
|
||||
struct EGpriv
|
||||
{
|
||||
EGpub pub;
|
||||
mpint *secret; // (decryption key)
|
||||
mpint *secret; /* (decryption key) */
|
||||
};
|
||||
|
||||
// signature
|
||||
/* signature */
|
||||
struct EGsig
|
||||
{
|
||||
mpint *r, *s;
|
||||
|
|
@ -289,30 +289,30 @@ EGsig* egsigalloc(void);
|
|||
void egsigfree(EGsig*);
|
||||
EGpub* egprivtopub(EGpriv*);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// dsa
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* dsa */
|
||||
/*******************************************************/
|
||||
typedef struct DSApub DSApub;
|
||||
typedef struct DSApriv DSApriv;
|
||||
typedef struct DSAsig DSAsig;
|
||||
|
||||
// public/encryption key
|
||||
/* public/encryption key */
|
||||
struct DSApub
|
||||
{
|
||||
mpint *p; // modulus
|
||||
mpint *q; // group order, q divides p-1
|
||||
mpint *alpha; // group generator
|
||||
mpint *key; // (encryption key) alpha**secret mod p
|
||||
mpint *p; /* modulus */
|
||||
mpint *q; /* group order, q divides p-1 */
|
||||
mpint *alpha; /* group generator */
|
||||
mpint *key; /* (encryption key) alpha**secret mod p */
|
||||
};
|
||||
|
||||
// private/decryption key
|
||||
/* private/decryption key */
|
||||
struct DSApriv
|
||||
{
|
||||
DSApub pub;
|
||||
mpint *secret; // (decryption key)
|
||||
mpint *secret; /* (decryption key) */
|
||||
};
|
||||
|
||||
// signature
|
||||
/* signature */
|
||||
struct DSAsig
|
||||
{
|
||||
mpint *r, *s;
|
||||
|
|
@ -330,33 +330,33 @@ void dsasigfree(DSAsig*);
|
|||
DSApub* dsaprivtopub(DSApriv*);
|
||||
DSApriv* asn1toDSApriv(uchar*, int);
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
// TLS
|
||||
/////////////////////////////////////////////////////////
|
||||
/*******************************************************/
|
||||
/* TLS */
|
||||
/*******************************************************/
|
||||
typedef struct Thumbprint{
|
||||
struct Thumbprint *next;
|
||||
uchar sha1[SHA1dlen];
|
||||
} Thumbprint;
|
||||
|
||||
typedef struct TLSconn{
|
||||
char dir[40]; // connection directory
|
||||
uchar *cert; // certificate (local on input, remote on output)
|
||||
char dir[40]; /* connection directory */
|
||||
uchar *cert; /* certificate (local on input, remote on output) */
|
||||
uchar *sessionID;
|
||||
int certlen, sessionIDlen;
|
||||
int (*trace)(char*fmt, ...);
|
||||
PEMChain *chain;
|
||||
} TLSconn;
|
||||
|
||||
// tlshand.c
|
||||
/* tlshand.c */
|
||||
extern int tlsClient(int fd, TLSconn *c);
|
||||
extern int tlsServer(int fd, TLSconn *c);
|
||||
|
||||
// thumb.c
|
||||
/* thumb.c */
|
||||
extern Thumbprint* initThumbprints(char *ok, char *crl);
|
||||
extern void freeThumbprints(Thumbprint *ok);
|
||||
extern int okThumbprint(uchar *sha1, Thumbprint *ok);
|
||||
|
||||
// readcert.c
|
||||
/* readcert.c */
|
||||
extern uchar *readcert(char *filename, int *pcertlen);
|
||||
PEMChain *readcertchain(char *filename);
|
||||
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ enum
|
|||
LREG, /* register */
|
||||
LADDR, /* absolute address */
|
||||
LCONST, /* constant (an anonymous readonly location) */
|
||||
LOFFSET, /* dereference offset + register ptr */
|
||||
LOFFSET /* dereference offset + register ptr */
|
||||
};
|
||||
|
||||
struct Loc
|
||||
|
|
@ -357,7 +357,7 @@ enum
|
|||
|
||||
RINT = 0<<0,
|
||||
RFLT = 1<<0,
|
||||
RRDONLY = 1<<1,
|
||||
RRDONLY = 1<<1
|
||||
};
|
||||
|
||||
struct Regdesc
|
||||
|
|
@ -456,7 +456,7 @@ enum
|
|||
CPARAM, /* function parameter */
|
||||
CTEXT, /* text segment */
|
||||
CDATA, /* data segment */
|
||||
CANY,
|
||||
CANY
|
||||
};
|
||||
|
||||
struct Symbol
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ enum {
|
|||
Fgrey = 1<<2, /* is grey */
|
||||
Falpha = 1<<3, /* has explicit alpha */
|
||||
Fcmap = 1<<4, /* has cmap channel */
|
||||
Fbytes = 1<<5, /* has only 8-bit channels */
|
||||
Fbytes = 1<<5 /* has only 8-bit channels */
|
||||
};
|
||||
|
||||
struct Memimage
|
||||
|
|
@ -94,8 +94,8 @@ enum {
|
|||
Simplemask=1<<1,
|
||||
Replsrc=1<<2,
|
||||
Replmask=1<<3,
|
||||
Fullsrc = 1<<4,
|
||||
Fullmask=1<<5,
|
||||
Fullsrc=1<<4,
|
||||
Fullmask=1<<5
|
||||
};
|
||||
struct Memdrawparam
|
||||
{
|
||||
|
|
|
|||
130
include/mp.h
130
include/mp.h
|
|
@ -15,17 +15,17 @@ AUTOLIB(mp)
|
|||
|
||||
typedef ulong mpdigit;
|
||||
|
||||
// the code assumes mpdigit to be at least an int
|
||||
// mpdigit must be an atomic type. mpdigit is defined
|
||||
// in the architecture specific u.h
|
||||
/* the code assumes mpdigit to be at least an int */
|
||||
/* mpdigit must be an atomic type. mpdigit is defined */
|
||||
/* in the architecture specific u.h */
|
||||
|
||||
typedef struct mpint mpint;
|
||||
|
||||
struct mpint
|
||||
{
|
||||
int sign; // +1 or -1
|
||||
int size; // allocated digits
|
||||
int top; // significant digits
|
||||
int sign; /* +1 or -1 */
|
||||
int size; /* allocated digits */
|
||||
int top; /* significant digits */
|
||||
mpdigit *p;
|
||||
char flags;
|
||||
};
|
||||
|
|
@ -33,117 +33,117 @@ struct mpint
|
|||
enum
|
||||
{
|
||||
MPstatic= 0x01,
|
||||
Dbytes= sizeof(mpdigit), // bytes per digit
|
||||
Dbits= Dbytes*8 // bits per digit
|
||||
Dbytes= sizeof(mpdigit), /* bytes per digit */
|
||||
Dbits= Dbytes*8 /* bits per digit */
|
||||
};
|
||||
|
||||
// allocation
|
||||
void mpsetminbits(int n); // newly created mpint's get at least n bits
|
||||
mpint* mpnew(int n); // create a new mpint with at least n bits
|
||||
/* allocation */
|
||||
void mpsetminbits(int n); /* newly created mpint's get at least n bits */
|
||||
mpint* mpnew(int n); /* create a new mpint with at least n bits */
|
||||
void mpfree(mpint *b);
|
||||
void mpbits(mpint *b, int n); // ensure that b has at least n bits
|
||||
void mpnorm(mpint *b); // dump leading zeros
|
||||
void mpbits(mpint *b, int n); /* ensure that b has at least n bits */
|
||||
void mpnorm(mpint *b); /* dump leading zeros */
|
||||
mpint* mpcopy(mpint *b);
|
||||
void mpassign(mpint *old, mpint *new);
|
||||
|
||||
// random bits
|
||||
/* random bits */
|
||||
mpint* mprand(int bits, void (*gen)(uchar*, int), mpint *b);
|
||||
|
||||
// conversion
|
||||
mpint* strtomp(char*, char**, int, mpint*); // ascii
|
||||
/* conversion */
|
||||
mpint* strtomp(char*, char**, int, mpint*); /* ascii */
|
||||
int mpfmt(Fmt*);
|
||||
char* mptoa(mpint*, int, char*, int);
|
||||
mpint* letomp(uchar*, uint, mpint*); // byte array, little-endian
|
||||
mpint* letomp(uchar*, uint, mpint*); /* byte array, little-endian */
|
||||
int mptole(mpint*, uchar*, uint, uchar**);
|
||||
mpint* betomp(uchar*, uint, mpint*); // byte array, little-endian
|
||||
mpint* betomp(uchar*, uint, mpint*); /* byte array, little-endian */
|
||||
int mptobe(mpint*, uchar*, uint, uchar**);
|
||||
uint mptoui(mpint*); // unsigned int
|
||||
uint mptoui(mpint*); /* unsigned int */
|
||||
mpint* uitomp(uint, mpint*);
|
||||
int mptoi(mpint*); // int
|
||||
int mptoi(mpint*); /* int */
|
||||
mpint* itomp(int, mpint*);
|
||||
uvlong mptouv(mpint*); // unsigned vlong
|
||||
uvlong mptouv(mpint*); /* unsigned vlong */
|
||||
mpint* uvtomp(uvlong, mpint*);
|
||||
vlong mptov(mpint*); // vlong
|
||||
vlong mptov(mpint*); /* vlong */
|
||||
mpint* vtomp(vlong, mpint*);
|
||||
|
||||
// divide 2 digits by one
|
||||
/* divide 2 digits by one */
|
||||
void mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient);
|
||||
|
||||
// in the following, the result mpint may be
|
||||
// the same as one of the inputs.
|
||||
void mpadd(mpint *b1, mpint *b2, mpint *sum); // sum = b1+b2
|
||||
void mpsub(mpint *b1, mpint *b2, mpint *diff); // diff = b1-b2
|
||||
void mpleft(mpint *b, int shift, mpint *res); // res = b<<shift
|
||||
void mpright(mpint *b, int shift, mpint *res); // res = b>>shift
|
||||
void mpmul(mpint *b1, mpint *b2, mpint *prod); // prod = b1*b2
|
||||
void mpexp(mpint *b, mpint *e, mpint *m, mpint *res); // res = b**e mod m
|
||||
void mpmod(mpint *b, mpint *m, mpint *remainder); // remainder = b mod m
|
||||
/* in the following, the result mpint may be */
|
||||
/* the same as one of the inputs. */
|
||||
void mpadd(mpint *b1, mpint *b2, mpint *sum); /* sum = b1+b2 */
|
||||
void mpsub(mpint *b1, mpint *b2, mpint *diff); /* diff = b1-b2 */
|
||||
void mpleft(mpint *b, int shift, mpint *res); /* res = b<<shift */
|
||||
void mpright(mpint *b, int shift, mpint *res); /* res = b>>shift */
|
||||
void mpmul(mpint *b1, mpint *b2, mpint *prod); /* prod = b1*b2 */
|
||||
void mpexp(mpint *b, mpint *e, mpint *m, mpint *res); /* res = b**e mod m */
|
||||
void mpmod(mpint *b, mpint *m, mpint *remainder); /* remainder = b mod m */
|
||||
|
||||
// quotient = dividend/divisor, remainder = dividend % divisor
|
||||
/* quotient = dividend/divisor, remainder = dividend % divisor */
|
||||
void mpdiv(mpint *dividend, mpint *divisor, mpint *quotient, mpint *remainder);
|
||||
|
||||
// return neg, 0, pos as b1-b2 is neg, 0, pos
|
||||
/* return neg, 0, pos as b1-b2 is neg, 0, pos */
|
||||
int mpcmp(mpint *b1, mpint *b2);
|
||||
|
||||
// extended gcd return d, x, and y, s.t. d = gcd(a,b) and ax+by = d
|
||||
/* extended gcd return d, x, and y, s.t. d = gcd(a,b) and ax+by = d */
|
||||
void mpextendedgcd(mpint *a, mpint *b, mpint *d, mpint *x, mpint *y);
|
||||
|
||||
// res = b**-1 mod m
|
||||
/* res = b**-1 mod m */
|
||||
void mpinvert(mpint *b, mpint *m, mpint *res);
|
||||
|
||||
// bit counting
|
||||
int mpsignif(mpint*); // number of sigificant bits in mantissa
|
||||
int mplowbits0(mpint*); // k, where n = 2**k * q for odd q
|
||||
/* bit counting */
|
||||
int mpsignif(mpint*); /* number of sigificant bits in mantissa */
|
||||
int mplowbits0(mpint*); /* k, where n = 2**k * q for odd q */
|
||||
|
||||
// well known constants
|
||||
/* well known constants */
|
||||
extern mpint *mpzero, *mpone, *mptwo;
|
||||
|
||||
// sum[0:alen] = a[0:alen-1] + b[0:blen-1]
|
||||
// prereq: alen >= blen, sum has room for alen+1 digits
|
||||
/* sum[0:alen] = a[0:alen-1] + b[0:blen-1] */
|
||||
/* prereq: alen >= blen, sum has room for alen+1 digits */
|
||||
void mpvecadd(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *sum);
|
||||
|
||||
// diff[0:alen-1] = a[0:alen-1] - b[0:blen-1]
|
||||
// prereq: alen >= blen, diff has room for alen digits
|
||||
/* diff[0:alen-1] = a[0:alen-1] - b[0:blen-1] */
|
||||
/* prereq: alen >= blen, diff has room for alen digits */
|
||||
void mpvecsub(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *diff);
|
||||
|
||||
// p[0:n] += m * b[0:n-1]
|
||||
// prereq: p has room for n+1 digits
|
||||
/* p[0:n] += m * b[0:n-1] */
|
||||
/* prereq: p has room for n+1 digits */
|
||||
void mpvecdigmuladd(mpdigit *b, int n, mpdigit m, mpdigit *p);
|
||||
|
||||
// p[0:n] -= m * b[0:n-1]
|
||||
// prereq: p has room for n+1 digits
|
||||
/* p[0:n] -= m * b[0:n-1] */
|
||||
/* prereq: p has room for n+1 digits */
|
||||
int mpvecdigmulsub(mpdigit *b, int n, mpdigit m, mpdigit *p);
|
||||
|
||||
// p[0:alen*blen-1] = a[0:alen-1] * b[0:blen-1]
|
||||
// prereq: alen >= blen, p has room for m*n digits
|
||||
/* p[0:alen*blen-1] = a[0:alen-1] * b[0:blen-1] */
|
||||
/* prereq: alen >= blen, p has room for m*n digits */
|
||||
void mpvecmul(mpdigit *a, int alen, mpdigit *b, int blen, mpdigit *p);
|
||||
|
||||
// sign of a - b or zero if the same
|
||||
/* sign of a - b or zero if the same */
|
||||
int mpveccmp(mpdigit *a, int alen, mpdigit *b, int blen);
|
||||
|
||||
// divide the 2 digit dividend by the one digit divisor and stick in quotient
|
||||
// we assume that the result is one digit - overflow is all 1's
|
||||
/* divide the 2 digit dividend by the one digit divisor and stick in quotient */
|
||||
/* we assume that the result is one digit - overflow is all 1's */
|
||||
void mpdigdiv(mpdigit *dividend, mpdigit divisor, mpdigit *quotient);
|
||||
|
||||
// playing with magnitudes
|
||||
/* playing with magnitudes */
|
||||
int mpmagcmp(mpint *b1, mpint *b2);
|
||||
void mpmagadd(mpint *b1, mpint *b2, mpint *sum); // sum = b1+b2
|
||||
void mpmagsub(mpint *b1, mpint *b2, mpint *sum); // sum = b1+b2
|
||||
void mpmagadd(mpint *b1, mpint *b2, mpint *sum); /* sum = b1+b2 */
|
||||
void mpmagsub(mpint *b1, mpint *b2, mpint *sum); /* sum = b1+b2 */
|
||||
|
||||
// chinese remainder theorem
|
||||
typedef struct CRTpre CRTpre; // precomputed values for converting
|
||||
// twixt residues and mpint
|
||||
typedef struct CRTres CRTres; // residue form of an mpint
|
||||
/* chinese remainder theorem */
|
||||
typedef struct CRTpre CRTpre; /* precomputed values for converting */
|
||||
/* twixt residues and mpint */
|
||||
typedef struct CRTres CRTres; /* residue form of an mpint */
|
||||
|
||||
struct CRTres
|
||||
{
|
||||
int n; // number of residues
|
||||
mpint *r[1]; // residues
|
||||
int n; /* number of residues */
|
||||
mpint *r[1]; /* residues */
|
||||
};
|
||||
|
||||
CRTpre* crtpre(int, mpint**); // precompute conversion values
|
||||
CRTres* crtin(CRTpre*, mpint*); // convert mpint to residues
|
||||
void crtout(CRTpre*, CRTres*, mpint*); // convert residues to mpint
|
||||
CRTpre* crtpre(int, mpint**); /* precompute conversion values */
|
||||
CRTres* crtin(CRTpre*, mpint*); /* convert mpint to residues */
|
||||
void crtout(CRTpre*, CRTres*, mpint*); /* convert residues to mpint */
|
||||
void crtprefree(CRTpre*);
|
||||
void crtresfree(CRTres*);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ typedef struct Ndbcache Ndbcache;
|
|||
enum
|
||||
{
|
||||
Ndbalen= 32, /* max attribute length */
|
||||
Ndbvlen= 64, /* max value length */
|
||||
Ndbvlen= 64 /* max value length */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ enum {
|
|||
Nfs3FsCanSetTime = 16,
|
||||
|
||||
Nfs3Version = 3,
|
||||
Nfs3Program = 100003,
|
||||
Nfs3Program = 100003
|
||||
};
|
||||
typedef enum
|
||||
{
|
||||
|
|
@ -183,7 +183,7 @@ typedef enum
|
|||
Nfs3ErrBadType = 10007,
|
||||
Nfs3ErrJukebox = 10008,
|
||||
Nfs3ErrFprintNotFound = 10009,
|
||||
Nfs3ErrAborted = 10010,
|
||||
Nfs3ErrAborted = 10010
|
||||
} Nfs3Status;
|
||||
|
||||
void nfs3errstr(Nfs3Status);
|
||||
|
|
@ -196,14 +196,14 @@ typedef enum
|
|||
Nfs3FileChar = 4,
|
||||
Nfs3FileSymlink = 5,
|
||||
Nfs3FileSocket = 6,
|
||||
Nfs3FileFifo = 7,
|
||||
Nfs3FileFifo = 7
|
||||
} Nfs3FileType;
|
||||
|
||||
enum
|
||||
{
|
||||
Nfs3ModeSetUid = 0x800,
|
||||
Nfs3ModeSetGid = 0x400,
|
||||
Nfs3ModeSticky = 0x200,
|
||||
Nfs3ModeSticky = 0x200
|
||||
};
|
||||
|
||||
typedef enum
|
||||
|
|
@ -251,7 +251,7 @@ typedef enum
|
|||
Nfs3CallTPathconf,
|
||||
Nfs3CallRPathconf,
|
||||
Nfs3CallTCommit,
|
||||
Nfs3CallRCommit,
|
||||
Nfs3CallRCommit
|
||||
} Nfs3CallType;
|
||||
|
||||
typedef struct Nfs3Handle Nfs3Handle;
|
||||
|
|
@ -263,7 +263,7 @@ typedef enum
|
|||
{
|
||||
Nfs3SetTimeDont = 0,
|
||||
Nfs3SetTimeServer = 1,
|
||||
Nfs3SetTimeClient = 2,
|
||||
Nfs3SetTimeClient = 2
|
||||
} Nfs3SetTime;
|
||||
|
||||
typedef struct Nfs3SetAttr Nfs3SetAttr;
|
||||
|
|
@ -285,7 +285,7 @@ typedef enum
|
|||
{
|
||||
Nfs3SyncNone = 0,
|
||||
Nfs3SyncData = 1,
|
||||
Nfs3SyncFile = 2,
|
||||
Nfs3SyncFile = 2
|
||||
} Nfs3Sync;
|
||||
|
||||
typedef struct Nfs3TWrite Nfs3TWrite;
|
||||
|
|
@ -294,7 +294,7 @@ typedef enum
|
|||
{
|
||||
Nfs3CreateUnchecked = 0,
|
||||
Nfs3CreateGuarded = 1,
|
||||
Nfs3CreateExclusive = 2,
|
||||
Nfs3CreateExclusive = 2
|
||||
} Nfs3Create;
|
||||
|
||||
typedef struct Nfs3TCreate Nfs3TCreate;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ enum
|
|||
SunAuthNone = 0,
|
||||
SunAuthSys,
|
||||
SunAuthShort,
|
||||
SunAuthDes,
|
||||
SunAuthDes
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -46,7 +46,7 @@ typedef enum {
|
|||
SunAuthRejectedVerf,
|
||||
SunAuthTooWeak,
|
||||
SunAuthInvalidResp,
|
||||
SunAuthFailed,
|
||||
SunAuthFailed
|
||||
} SunStatus;
|
||||
|
||||
struct SunAuthInfo
|
||||
|
|
@ -78,7 +78,7 @@ struct SunRpc
|
|||
u32int proc;
|
||||
|
||||
/* call */
|
||||
// uint proc;
|
||||
/* uint proc; */
|
||||
u32int prog, vers;
|
||||
SunAuthInfo cred;
|
||||
SunAuthInfo verf;
|
||||
|
|
@ -87,16 +87,16 @@ struct SunRpc
|
|||
|
||||
/* reply */
|
||||
u32int status;
|
||||
// SunAuthInfo verf;
|
||||
/* SunAuthInfo verf; */
|
||||
u32int low, high;
|
||||
// uchar *data;
|
||||
// uint ndata;
|
||||
/* uchar *data; */
|
||||
/* uint ndata; */
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SunCallTypeTNull,
|
||||
SunCallTypeRNull,
|
||||
SunCallTypeRNull
|
||||
} SunCallType;
|
||||
|
||||
struct SunCall
|
||||
|
|
@ -191,7 +191,7 @@ typedef struct SunSrv SunSrv;
|
|||
|
||||
enum
|
||||
{
|
||||
SunStackSize = 32768,
|
||||
SunStackSize = 32768
|
||||
};
|
||||
|
||||
struct SunMsg
|
||||
|
|
@ -316,7 +316,7 @@ typedef enum
|
|||
PortCallTDump,
|
||||
PortCallRDump,
|
||||
PortCallTCallit,
|
||||
PortCallRCallit,
|
||||
PortCallRCallit
|
||||
} PortCallType;
|
||||
|
||||
enum
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ enum
|
|||
CHANSND,
|
||||
CHANRCV,
|
||||
CHANNOP,
|
||||
CHANNOBLK,
|
||||
CHANNOBLK
|
||||
};
|
||||
|
||||
struct Alt
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ enum
|
|||
UTFmax = 3, /* maximum bytes per rune */
|
||||
Runesync = 0x80, /* cannot represent part of a UTF sequence (<) */
|
||||
Runeself = 0x80, /* rune and UTF sequences are the same (<) */
|
||||
Runeerror = 0xFFFD, /* decoding error in UTF */
|
||||
Runeerror = 0xFFFD /* decoding error in UTF */
|
||||
};
|
||||
|
||||
/* Edit .+1,/^$/ | cfn $PLAN9/src/lib9/utf/?*.c | grep -v static |grep -v __ */
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ AUTOLIB(venti)
|
|||
*/
|
||||
enum
|
||||
{
|
||||
MaxFragSize = 9*1024,
|
||||
MaxFragSize = 9*1024
|
||||
};
|
||||
|
||||
typedef struct Packet Packet;
|
||||
|
|
@ -91,7 +91,7 @@ enum
|
|||
VtScoreSize = 20,
|
||||
VtMaxStringSize = 1024,
|
||||
VtMaxLumpSize = 56*1024,
|
||||
VtPointerDepth = 7,
|
||||
VtPointerDepth = 7
|
||||
};
|
||||
#define VtMaxFileSize ((1ULL<<48)-1)
|
||||
|
||||
|
|
@ -120,7 +120,7 @@ enum
|
|||
VtCorruptType = 0xFF,
|
||||
|
||||
VtTypeDepthMask = 7,
|
||||
VtTypeBaseMask = ~VtTypeDepthMask,
|
||||
VtTypeBaseMask = ~VtTypeDepthMask
|
||||
};
|
||||
|
||||
/* convert to/from on-disk type numbers */
|
||||
|
|
@ -141,11 +141,11 @@ enum
|
|||
_VtEntryDir = 1<<1, /* a directory */
|
||||
_VtEntryDepthShift = 2, /* shift for pointer depth */
|
||||
_VtEntryDepthMask = 7<<2, /* mask for pointer depth */
|
||||
VtEntryLocal = 1<<5, /* for local storage only */
|
||||
VtEntryLocal = 1<<5 /* for local storage only */
|
||||
};
|
||||
enum
|
||||
{
|
||||
VtEntrySize = 40,
|
||||
VtEntrySize = 40
|
||||
};
|
||||
struct VtEntry
|
||||
{
|
||||
|
|
@ -173,7 +173,7 @@ struct VtRoot
|
|||
enum
|
||||
{
|
||||
VtRootSize = 300,
|
||||
VtRootVersion = 2,
|
||||
VtRootVersion = 2
|
||||
};
|
||||
|
||||
void vtrootpack(VtRoot*, uchar*);
|
||||
|
|
@ -231,7 +231,7 @@ enum
|
|||
VtCryptoStrengthNone,
|
||||
VtCryptoStrengthAuth,
|
||||
VtCryptoStrengthWeak,
|
||||
VtCryptoStrengthStrong,
|
||||
VtCryptoStrengthStrong
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -242,7 +242,7 @@ enum
|
|||
VtCryptoNone,
|
||||
VtCryptoSSL3,
|
||||
VtCryptoTLS1,
|
||||
VtCryptoMax,
|
||||
VtCryptoMax
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
@ -313,7 +313,7 @@ enum
|
|||
{
|
||||
VtStateAlloc,
|
||||
VtStateConnected,
|
||||
VtStateClosed,
|
||||
VtStateClosed
|
||||
};
|
||||
|
||||
struct VtConn
|
||||
|
|
@ -387,7 +387,7 @@ int vtping(VtConn*);
|
|||
*/
|
||||
enum
|
||||
{
|
||||
NilBlock = ~0,
|
||||
NilBlock = ~0
|
||||
};
|
||||
|
||||
typedef struct VtBlock VtBlock;
|
||||
|
|
@ -459,7 +459,7 @@ enum
|
|||
{
|
||||
VtOREAD,
|
||||
VtOWRITE,
|
||||
VtORDWR,
|
||||
VtORDWR
|
||||
};
|
||||
|
||||
VtFile *vtfileopenroot(VtCache*, VtEntry*);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue