Classes Reference

Classes

AppServ | AppServRequest | CustomError | CustomException | Dir | DirEnt | Errno | Event | FD | FS | File | GD | GDFont | GDImage | PG | PGCancel | PGConn | PGDataResult | PGNotifies | PGPrintOpt | PGResult | RecvQ | SendQ | Stat | Syslog


AppServ

(Classes)

Provided by js-appserv(8) only. Allows the JS application to access properties and control functions in order to serve clients as it wishes. See the mmserver2(3) manual page for internal details, on which js-appserv(8) is based. js-appserv(8) consists of a processes pool-based server written in C which delegates control to a JavaScript application to serve the clients.

The application should provide the following functions:
void child_init_hook(void); - To be invoked when a new child process is created in the pool.
void child_exit_hook(void); - To be invoked when the child process exists. Note that a process may serve multiple connections before exiting.
void child_sigalrm_hook(void); - Invoked when a SIGALRM signal is received. Controlled via AppServ.alarm().
void request_handler(req::AppServRequest); - Function to handle the client in normal conditions.
void reject_handler(req::AppServRequest, reason::Number); - Function to handle the client in resource exceeded conditions. Allows to provide a protocol-friendly response before the connection gets closed. reason specifies the reason for the rejection, and may be one of AppServ.REASON_CACHE_SIZE, AppServ.REASON_CONCURRENCY or AppServ.REASON_RATE.
void request_close_hook(req::AppServRequest); - Invoked when the connection to the client is about to be closed, always.
void request_interrupt_hook(req::AppServRequest); - If the server is configured to interrupt currently served clients when the SIGHUP or SIGKILL signals are received, this function is invoked.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(AppServ)

Static Properties

(AppServ)

REASON_CACHE_SIZE | REASON_CONCURRENCY | REASON_RATE

Static Methods

(AppServ)

alarm

Properties

(AppServ)

Methods

(AppServ)


AppServRequest

(Classes)

Client request object. Holds necessary information about the client to communicate with it. Provided as an argument to the request_handler() and reject_handler() user functions.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(AppServRequest)

Static Properties

(AppServRequest)

Static Methods

(AppServRequest)

Properties

(AppServRequest)

client_address_concurrency | client_address_hostname | client_address_name | client_port | client_socket | packet_data | server_socket | server_socket_address_name | server_socket_family | server_socket_port | server_socket_type

Methods

(AppServRequest)


CustomError

(Classes)

Extends Error

This class extends the system Error class as should normally be done. However, when doing so the stack backtrace becomes unavailable, possibly as the result of a SpiderMonkey bug. Thus, it is recommended to use CustomException instead.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(CustomError)

CustomError

Static Properties

(CustomError)

Static Methods

(CustomError)

Properties

(CustomError)

Methods

(CustomError)


CustomException

(Classes)

This actually creates an Error system object and then adds custom properties to this. This allows the stack backtrace to be available which is most useful.

Unlike CustomError, this does not extend the system Error class. This means that the code cannot use instanceof to determine the type of exception/error. Instead, conditionals such as x.name == 'IOException' may be used instead.

The C classes invoke customexception_throw() to generate the same object and also preserve the stack backtrace.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(CustomException)

CustomException

Static Properties

(CustomException)

Static Methods

(CustomException)

Properties

(CustomException)

Methods

(CustomException)


Dir

(Classes)

A C opendir(3) and friends wrapper class. Allows to iterate over directory entries. Also see FD.fstat(). Note that deleting a Dir object also closes the directory.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(Dir)

Dir

Static Properties

(Dir)

DT_BLK | DT_CHR | DT_DIR | DT_FIFO | DT_LNK | DT_REG | DT_SOCK | DT_UNKNOWN

Static Methods

(Dir)

Properties

(Dir)

Methods

(Dir)

close | read | rewind | seek | tell


DirEnt

(Classes)

Represents a directory entry. Not an actual class per say, but an untyped object, holding properties. These are returned by Dir.read().

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(DirEnt)

Static Properties

(DirEnt)

Static Methods

(DirEnt)

Properties

(DirEnt)

fileno | name | type

Methods

(DirEnt)


Errno

(Classes)

This class allows to work with C and unix native error codes. It simply consists of a wrapper around strerror(3) and errno(2).

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(Errno)

Static Properties

(Errno)

EACCES | EADDRINUSE | EADDRNOTAVAIL | EAFNOSUPPORT | EAGAIN | EALREADY | EBADF | EBADMSG | EBUSY | ECANCELED | ECONNABORTED | ECONNREFUSED | ECONNRESET | EDESTADDRREQ | EDQUOT | EEXIST | EFBIG | EFTYPE | EHOSTDOWN | EHOSTUNREACH | EINPROGRESS | EINTR | EINVAL | EIO | EISCONN | EISDIR | ELOOP | EMFILE | EMLINK | EMSGSIZE | ENAMETOOLONG | ENETDOWN | ENETRESET | ENETUNREACH | ENFILE | ENOBUFS | ENODATA | ENODEV | ENOENT | ENOLCK | ENOMSG | ENOSPC | ENOSYS | ENOTBLK | ENOTCONN | ENOTDIR | ENOTEMPTY | ENOTSOCK | ENOTSUP | ENOTTY | ENXIO | EOPNOTSUPP | EPERM | EPFNOSUPPORT | EPIPE | EPROTONOSUPPORT | EPROTOTYPE | EROFS | ESHUTDOWN | ESPIPE | ESTALE | ETIME | ETIMEDOUT | ETXTBSY | EXDEV

Static Methods

(Errno)

strerror

Properties

(Errno)

Methods

(Errno)


Event

(Classes)

This class allows to use efficient OS primitives for events, through the event(3) library. For instance, on BSD systems, kqueue(2) is used internally, which not only is a system which exceeds dramatically the performance of poll(2), but also supports a number of event types other than for file descriptor polling.

Currently, only file descriptor polling is supported in JS using FD objects. There are however plans to eventually support signal and timer events as well.

This is a callback driven system. This means that you must register descriptors and events you're interested in as well as which JS functions to execute, and call a dispatch function. Very much like unix signal handling. This allows the main processing loop to remain in C.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(Event)

Static Properties

(Event)

EVLOOP_NONBLOCK | EVLOOP_ONCE | EV_PERSIST | EV_READ | EV_SIGNAL | EV_TIMEOUT | EV_WRITE | SIGABRT | SIGALRM | SIGBUS | SIGCHLD | SIGCONT | SIGEMT | SIGFPE | SIGHUP | SIGILL | SIGINFO | SIGINT | SIGIO | SIGKILL | SIGPIPE | SIGPROF | SIGPWR | SIGQUIT | SIGSEGV | SIGSTOP | SIGSYS | SIGTERM | SIGTRAP | SIGTSTP | SIGTTIN | SIGTTOU | SIGURG | SIGUSR1 | SIGUSR2 | SIGVTALRM | SIGWINCH | SIGXCPU | SIGXFSZ

Static Methods

(Event)

addFD | delFD | dispatch | initializedFD | loop | loopExit | onceFD | pendingFD | setFD

Properties

(Event)

Methods

(Event)


FD

(Classes)

Implements support for unix file descriptor objects. Blocking, non-blocking modes are provided, as well as libevent(3) and poll(2) support. IPv4 sockets also are along with socket options. XXX Other address families should eventually be supported, although js-appserv(8) supports them already.

The static properties of this class map to the C equivalent integers. These are required for a number of functions which are basically C function mappings as well, other than having been reorganized to be more OO friendly.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(FD)

FD

Static Properties

(FD)

AF_INET | F_GETFL | F_SETFL | LOCK_EX | LOCK_NB | LOCK_SH | LOCK_UN | O_CREAT | O_NONBLOCK | O_RDONLY | O_RDWR | O_TRUNC | O_WRONLY | POLLERR | POLLHUP | POLLIN | POLLNVAL | POLLOUT | POLLPRI | POLLRDBAND | POLLRDNORM | POLLWRBAND | POLLWRNORM | SEEK_CUR | SEEK_END | SEEK_SET | SF_APPEND | SF_ARCHIVED | SF_IMMUTABLE | SHUT_RD | SHUT_RDRW | SHUT_RW | SOCK_DGRAM | SOCK_STREAM | SO_BROADCAST | SO_DONTROUTE | SO_ERROR | SO_KEEPALIVE | SO_LINGER | SO_OOBINLINE | SO_RCVBUF | SO_RCVLOWAT | SO_RCVTIMEO | SO_REUSEADDR | SO_REUSEPORT | SO_SNDBUF | SO_SNDLOWAT | SO_SNDTIMEO | SO_TYPE | STDERR_FILENO | STDIN_FILENO | STDOUT_FILENO | S_IFBLK | S_IFCHR | S_IFDIR | S_IFIFO | S_IFLNK | S_IFMT | S_IFREG | S_IFSOCK | S_IFWHT | S_IRGRP | S_IROTH | S_IRUSR | S_IRWXG | S_IRWXO | S_IRWXU | S_ISGID | S_ISUID | S_ISVTX | S_IWOTH | S_IWUSR | S_IXGRP | S_IXOTH | S_IXUSR | TCP_NODELAY | UF_APPEND | UF_IMMUTABLE | UF_NODUMP | UF_OPAQUE

Static Methods

(FD)

poll

Properties

(FD)

client_addr | client_port | errno | events | fd | mode | path | revents

Methods

(FD)

accept | bind | close | connect | fchmod | fchown | fcntl | fdatasync | flock | fstat | ftruncate | get | getsockopt | listen | lseek | open | put | read | set | setsockopt | shutdown | socket | write


FS

(Classes)

This class wraps around various file system related unix system calls.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(FS)

Static Properties

(FS)

Static Methods

(FS)

chdir | chmod | chown | creat | getcwd | lchown | mkdir | mkfifo | mknod | rename | rmdir | stat | symlink | truncate | unlink

Properties

(FS)

Methods

(FS)


File

(Classes)

This class consists of a wrapper around C stdio. When it is initialized by the system, three File objects are also created as first-level objects: stdin, stdout and stderr.

Because various C libraries also work with C FILE objects, it was important to implement support for stdio. For instance, the GD and PG classes support it.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(File)

File

Static Properties

(File)

SEEK_CUR | SEEK_END | SEEK_SET | STDERR_FILENO | STDIN_FILENO | STDOUT_FILENO | _IOFBF | _IOLBF | _IONBF

Static Methods

(File)

popen | remove | strerror | tmpfile

Properties

(File)

Methods

(File)

clearerr | close | eof | error | fileno | flush | getc | gets | purge | putc | read | reopen | rewind | seek | setvbuf | tell | ungetc | write


GD

(Classes)

Implements libgd(3) 2.0.33 support for JavaScript. This class provides a container for the various constructors and C-imported static properties.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(GD)

Static Properties

(GD)

GD2_FMT_COMPRESSED | GD2_FMT_RAW | GD_CMP_BACKGROUND | GD_CMP_COLOR | GD_CMP_IMAGE | GD_CMP_INTERLACE | GD_CMP_NUM_COLORS | GD_CMP_SIZE_X | GD_CMP_SIZE_Y | GD_CMP_TRANSPARENT | GD_CMP_TRUECOLOR | gdAlphaOpaque | gdAlphaTransparent | gdAntiAliased | gdArc | gdBrushed | gdChord | gdDashSize | gdDisposalNone | gdDisposalRestoreBackground | gdDisposalRestorePrevious | gdDisposalUnknown | gdEdged | gdFTEX_Big5 | gdFTEX_Shift_JIS | gdFTEX_Unicode | gdMaxColors | gdNoFill | gdPie | gdStyled | gdStyledBrushed | gdTiled | gdTransparent

Static Methods

(GD)

create | createFromGd | createFromGd2 | createFromGd2Part | createFromGd2PartStr | createFromGd2Str | createFromGdStr | createFromGif | createFromGifStr | createFromJpeg | createFromJpegStr | createFromPng | createFromPngStr | createFromWBMP | createFromWBMPStr | createFromXbm | createFromXpm | createTrueColor | ftUseFontConfig | trueColor | trueColorAlpha

Properties

(GD)

Methods

(GD)


GDFont

(Classes)

A GD native font object. Of this type are the following global objects: gdFontSmall, gdFontLarge, gdFontMediumBold, gdFontGiant, gdFontTiny.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(GDFont)

Static Properties

(GDFont)

Static Methods

(GDFont)

Properties

(GDFont)

Methods

(GDFont)


GDImage

(Classes)

Represents an image object. Created via the GD.* static methods.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(GDImage)

Static Properties

(GDImage)

Static Methods

(GDImage)

Properties

(GDImage)

sx | sy

Methods

(GDImage)

alpha | alphaBlending | arc | blue | boundsSafe | charRight | charUp | colorAllocate | colorAllocateAlpha | colorClosest | colorClosestAlpha | colorClosestHWB | colorDeallocate | colorExact | colorResolve | colorResolveAlpha | colorTransparent | colorsTotal | compare | copy | copyMerge | copyMergeGray | copyResampled | copyResized | copyRotated | createPaletteFromTrueColor | dashedLine | destroy | fill | fillToBorder | filledEllipse | filledPolygon | filledRectangle | gd | gd2 | gd2Str | gdStr | getClip | getInterlaced | getPixel | getTransparent | gif | gifAnimAdd | gifAnimAddStr | gifAnimBegin | gifAnimBeginStr | gifAnimEnd | gifAnimEndStr | gifStr | green | imageSX | imageSY | interlace | jpeg | jpegStr | line | openPolygon | paletteCopy | png | pngEx | pngExStr | pngStr | polygon | rectangle | red | saveAlpha | setAntiAliased | setAntiAliasedDontBlend | setBrush | setClip | setPixel | setStyle | setThickness | setTile | squareToCircle | stringFt | stringFtCircle | stringFtEx | stringRight | stringUp | trueColorToPalette | wbmp | wbmpStr


PG

(Classes)

This class allows to configure the environment and create connections to PostgreSQL. It also serves as a container for a number of static properties which are required by the libpq(3) API, which we map to rather closely. This API was mostly modeled after the PostgreSQL 8.1.4 libpq(3), yet an effort was made to be OO friendly.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PG)

Static Properties

(PG)

CONNECTION_AUTH_OK | CONNECTION_AWAITING_RESPONSE | CONNECTION_BAD | CONNECTION_MADE | CONNECTION_OK | CONNECTION_SETENV | CONNECTION_SSL_STARTUP | CONNECTION_STARTED | INV_READ | INV_WRITE | InvalidOid | PGRES_BAD_RESPONSE | PGRES_COMMAND_OK | PGRES_COPY_IN | PGRES_COPY_OUT | PGRES_EMPTY_QUERY | PGRES_FATAL_ERROR | PGRES_NONFATAL_ERROR | PGRES_POLLING_FAILED | PGRES_POLLING_OK | PGRES_POLLING_READING | PGRES_POLLING_WRITING | PGRES_TUPLES_OK | PG_DIAG_CONTEXT | PG_DIAG_INTERNAL_POSITION | PG_DIAG_INTERNAL_QUERY | PG_DIAG_MESSAGE_DETAIL | PG_DIAG_MESSAGE_HINT | PG_DIAG_MESSAGE_PRIMARY | PG_DIAG_SEVERITY | PG_DIAG_SOURCE_FILE | PG_DIAG_SOURCE_FUNCTION | PG_DIAG_SOURCE_LINE | PG_DIAG_SQLSTATE | PG_DIAG_STATEMENT_POSITION | PQERRORS_DEFAULT | PQERRORS_TERSE | PQERRORS_VERBOSE | PQTRANS_ACTIVE | PQTRANS_IDLE | PQTRANS_INERROR | PQTRANS_INTRANS | PQTRANS_UNKNOWN | SEEK_CUR | SEEK_END | SEEK_SET

Static Methods

(PG)

connDefaults | connectDb | connectStart | resStatus | unescapeBytea

Properties

(PG)

Methods

(PG)


PGCancel

(Classes)

Allows to cancel a query in progress. This object is obtained through a call to PGConn.getCancel().

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PGCancel)

Static Properties

(PGCancel)

Static Methods

(PGCancel)

Properties

(PGCancel)

Methods

(PGCancel)

cancel | freeCancel


PGConn

(Classes)

Represents a connection instance to a PostgreSQL server. These objects are created by static methods of the PG class.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PGConn)

Static Properties

(PGConn)

Static Methods

(PGConn)

Properties

(PGConn)

Methods

(PGConn)

backendPid | connectPoll | consumeInput | db | errorMessage | escapeByteaConn | escapeStringConn | exec | execParams | execPrepared | finish | flush | getCancel | getCopyData | getResult | host | isBusy | isNonBlocking | jsExecParams | jsExecPrepared | jsPrepare | loClose | loCreat | loCreate | loExport | loImport | loOpen | loRead | loSeek | loTell | loUnlink | loWrite | makeEmptyPGResult | notifies | options | pass | port | prameterStatus | prepare | protocolVersion | putCopyData | putCopyEnd | reset | resetPoll | resetStart | sendPrepare | sendQuery | sendQueryParams | sendQueryPrepared | serverVersion | setErrorVerbosity | setNonBlocking | setNoticeProcessor | setNoticeReceiver | socket | status | trace | transactionStatus | tty | untrace | user


PGDataResult

(Classes)

Not a class per se, but an object returned by PGConn.getCopyData.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PGDataResult)

Static Properties

(PGDataResult)

Static Methods

(PGDataResult)

Properties

(PGDataResult)

data | result

Methods

(PGDataResult)


PGNotifies

(Classes)

Not an actual class per se, used to describe the object returned by PGConn.notifies().

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PGNotifies)

Static Properties

(PGNotifies)

Static Methods

(PGNotifies)

Properties

(PGNotifies)

be_pid | extra | relname

Methods

(PGNotifies)


PGPrintOpt

(Classes)

When invoking PGResult.print(), an object of this type must be supplied, and its properties filled for the printing configuration.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PGPrintOpt)

Static Properties

(PGPrintOpt)

Static Methods

(PGPrintOpt)

Properties

(PGPrintOpt)

align | caption | expanded | fieldName | fieldSep | header | html3 | pager | standard | tableOpt

Methods

(PGPrintOpt)


PGResult

(Classes)

This class is used to represent results of SQL queries made to a PostgreSQL server, via an open PGConn object.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(PGResult)

Static Properties

(PGResult)

Static Methods

(PGResult)

Properties

(PGResult)

Methods

(PGResult)

binaryTuples | clear | cmdStatus | cmdTuples | fFormat | fMod | fName | fNumber | fSize | fTable | fTableCol | fType | getIsNull | getLength | getValue | jsGetResults | nFields | nTuples | oidValue | print | resultErrorField | resultErrorMessage | resultStatus


RecvQ

(Classes)

Implements a general purpose receive queue buffer. Especially useful for use with non-blocking sockets and polling events. Faster than custom implementations in JavaScript using strings, and uses half the memory.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(RecvQ)

RecvQ

Static Properties

(RecvQ)

EMPTY | EOF | ERROR | FULL | TOOLONG

Static Methods

(RecvQ)

Properties

(RecvQ)

length

Methods

(RecvQ)

purge | read | readLine | substr


SendQ

(Classes)

General purpose send queue buffer. Especially useful for use with non-blocking sockets and polling events. Faster than a JavaScript implementation using strings, and uses half the memory.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(SendQ)

SendQ

Static Properties

(SendQ)

EMPTY | ERROR | FULL

Static Methods

(SendQ)

Properties

(SendQ)

length

Methods

(SendQ)

flush | write


Stat

(Classes)

This class has no constructors, and is in fact simply an unclassed Object. This object is returned by FD.fstat() and FS.stat(), FS.lstat(). XXX A real Stat class should probably be created, with stat-related constants set as static properties of it. Because they are now static properties of FD, yet FS also creates Stat objects.

See also

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(Stat)

Static Properties

(Stat)

Static Methods

(Stat)

Properties

(Stat)

st_atime | st_blksize | st_blocks | st_ctime | st_dev | st_flags | st_gen | st_gid | st_ino | st_mode | st_mtime | st_nlink | st_rdev | st_size | st_uid

Methods

(Stat)


Syslog

(Classes)

Provides access to the syslog(3) facilities.

Constructors | Static Properties | Static Methods | Properties | Methods

Constructors

(Syslog)

Static Properties

(Syslog)

LOG_ALERT | LOG_AUTH | LOG_AUTHPRIV | LOG_CONS | LOG_CRIT | LOG_CRON | LOG_DAEMON | LOG_DEBUG | LOG_EMERG | LOG_ERR | LOG_FTP | LOG_INFO | LOG_KERN | LOG_LOCAL0 | LOG_LOCAL1 | LOG_LOCAL2 | LOG_LOCAL3 | LOG_LOCAL4 | LOG_LOCAL5 | LOG_LOCAL6 | LOG_LOCAL7 | LOG_LPR | LOG_MAIL | LOG_NDELAY | LOG_NEWS | LOG_NOTICE | LOG_PERROR | LOG_PID | LOG_SYSLOG | LOG_USER | LOG_UUCP | LOG_WARNING

Static Methods

(Syslog)

close | log | mask | maskUpto | open | setMask

Properties

(Syslog)

Methods

(Syslog)


Generated by $Id: jsdoc-html.js,v 1.12 2007/10/21 02:13:37 mmondor Exp $
Copyright (c) 2007, Matthew Mondor.
Updated: Fri, 14 Sep 2012 06:00:06 GMT

Valid XHTML 1.0 Strict