Rudiments
|
Inherits file.
Public Member Functions | |
url () | |
virtual | ~url () |
void | setUseHttpPost (bool usehttppost) |
bool | getUseHttpPost () |
void | setHttpPostContentType (const char *contenttype) |
const char * | getHttpPostContentType () |
void | setHttpPostData (const char *data, uint64_t size) |
const char * | getHttpPostData () |
uint64_t | getHttpPostDataSize () |
void | setHttpUserAgent (const char *useragent) |
const char * | getHttpUserAgent () |
void | setHttpHeaders (const char *headers) |
const char * | getHttpHeaders () |
void | setValidatePeer (bool validatepeer) |
bool | getValidatePeer () |
void | setCertificateAuthority (const char *ca) |
const char * | getCertificateAuthority () |
const char * | getError () |
Public Member Functions inherited from file | |
file () | |
virtual | ~file () |
virtual bool | open (const char *name, int32_t flags) |
virtual bool | open (const char *name, int32_t flags, mode_t perms) |
virtual bool | create (const char *name, mode_t perms) |
virtual char * | getContents () |
virtual ssize_t | getContents (byte_t *buffer, size_t buffersize) |
virtual ssize_t | getContents (byte_t **buffer, size_t *buffersize) |
virtual bool | truncate () |
virtual bool | truncate (off64_t size) |
virtual bool | tryLockFile (int16_t type) |
virtual bool | lockFile (int16_t type) |
virtual bool | checkLockFile (int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockFile () |
virtual bool | tryLockRegion (int16_t type, off64_t start, off64_t len) |
virtual bool | lockRegion (int16_t type, off64_t start, off64_t len) |
virtual bool | checkLockRegion (int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockRegion (off64_t start, off64_t len) |
virtual bool | tryLockFromCurrent (int16_t type, off64_t len) |
virtual bool | tryLockFromCurrent (int16_t type, off64_t start, off64_t len) |
virtual bool | lockFromCurrent (int16_t type, off64_t len) |
virtual bool | lockFromCurrent (int16_t type, off64_t start, off64_t len) |
virtual bool | checkLockFromCurrent (int16_t type, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | checkLockFromCurrent (int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockFromCurrent (off64_t len) |
virtual bool | unlockFromCurrent (off64_t start, off64_t len) |
virtual bool | tryLockFromEnd (int16_t type, off64_t len) |
virtual bool | tryLockFromEnd (int16_t type, off64_t start, off64_t len) |
virtual bool | lockFromEnd (int16_t type, off64_t len) |
virtual bool | lockFromEnd (int16_t type, off64_t start, off64_t len) |
virtual bool | checkLockFromEnd (int16_t type, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | checkLockFromEnd (int16_t type, off64_t start, off64_t len, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockFromEnd (off64_t len) |
virtual bool | unlockFromEnd (off64_t start, off64_t len) |
virtual bool | tryLockRemainder (int16_t type, off64_t start) |
virtual bool | lockRemainder (int16_t type, off64_t start) |
virtual bool | checkLockRemainder (int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockRemainder (off64_t start) |
virtual bool | tryLockRemainderFromCurrent (int16_t type) |
virtual bool | tryLockRemainderFromCurrent (int16_t type, off64_t start) |
virtual bool | lockRemainderFromCurrent (int16_t type) |
virtual bool | lockRemainderFromCurrent (int16_t type, off64_t start) |
virtual bool | checkLockRemainderFromCurrent (int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | checkLockRemainderFromCurrent (int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockRemainderFromCurrent () |
virtual bool | unlockRemainderFromCurrent (off64_t start) |
virtual bool | tryLockRemainderFromEnd (int16_t type) |
virtual bool | tryLockRemainderFromEnd (int16_t type, off64_t start) |
virtual bool | lockRemainderFromEnd (int16_t type) |
virtual bool | lockRemainderFromEnd (int16_t type, off64_t start) |
virtual bool | checkLockRemainderFromEnd (int16_t type, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | checkLockRemainderFromEnd (int16_t type, off64_t start, int16_t *conftype, int16_t *confwhence, off64_t *confstart, off64_t *conflen) |
virtual bool | unlockRemainderFromEnd () |
virtual bool | unlockRemainderFromEnd (off64_t start) |
virtual bool | adviseSequentialAccess (off64_t start, size_t len) |
virtual bool | adviseRandomAccess (off64_t start, size_t len) |
virtual bool | adviseOnlyOnce (off64_t start, size_t len) |
virtual bool | adviseWillNeed (off64_t start, size_t len) |
virtual bool | adviseWontNeed (off64_t start, size_t len) |
virtual bool | adviseNormalAccess (off64_t start, size_t len) |
virtual bool | reserve (off64_t start, size_t len) |
virtual bool | sync () |
virtual bool | syncData () |
virtual void | setGetCurrentPropertiesOnOpen (bool set) |
virtual bool | getCurrentProperties () |
virtual mode_t | getPermissions () |
virtual uid_t | getOwnerUserId () |
virtual gid_t | getOwnerGroupId () |
virtual off64_t | getSize () |
virtual blksize_t | getBlockSize () |
virtual blkcnt_t | getBlockCount () |
virtual int32_t | isSocket () |
virtual int32_t | isSymbolicLink () |
virtual int32_t | isRegularFile () |
virtual int32_t | isBlockDevice () |
virtual int32_t | isDirectory () |
virtual int32_t | isCharacterDevice () |
virtual int32_t | isFifo () |
virtual time_t | getLastAccessTime () |
virtual time_t | getLastModificationTime () |
virtual time_t | getLastChangeTime () |
virtual dev_t | getDevice () |
virtual dev_t | getDeviceType () |
virtual uint64_t | getInode () |
virtual nlink_t | getNumberOfHardLinks () |
virtual bool | setPermissions (mode_t perms) |
virtual bool | changeOwner (const char *newuser, const char *newgroup) |
virtual bool | changeOwner (uid_t uid, gid_t gid) |
virtual bool | getCanChangeOwner () |
virtual int64_t | getMaxLinks () |
virtual void * | getInternalFileStatisticsStructure () |
virtual ssize_t | getContents (const char *name, byte_t **buffer, size_t *buffersize) |
Public Member Functions inherited from filedescriptor | |
filedescriptor () | |
virtual | ~filedescriptor () |
virtual bool | close () |
int32_t | getFileDescriptor () |
void | setFileDescriptor (int32_t filedesc) |
bool | setIsStream (bool isstream) |
bool | getIsStream () |
int32_t | duplicate () |
bool | duplicate (int32_t newfd) |
void | setSocketLayer (socketlayer *layer) |
socketlayer * | getSocketLayer () |
virtual bool | supportsBlockingAndNonBlockingModes () |
virtual bool | setNonBlockingMode (bool usenonblockingmode) |
virtual bool | getNonBlockingMode () |
virtual off64_t | getPosition () |
virtual off64_t | setPositionRelativeToBeginning (off64_t offset) |
virtual off64_t | setPositionRelativeToCurrent (off64_t offset) |
virtual off64_t | setPositionRelativeToEnd (off64_t offset) |
ssize_t | write (uint16_t number) |
ssize_t | write (uint32_t number) |
ssize_t | write (uint64_t number) |
ssize_t | write (int16_t number) |
ssize_t | write (int32_t number) |
ssize_t | write (int64_t number) |
ssize_t | write (float number) |
ssize_t | write (double number) |
ssize_t | write (byte_t character) |
ssize_t | write (char character) |
ssize_t | write (wchar_t character) |
ssize_t | writeUcs2 (ucs2_t character) |
ssize_t | write (bool value) |
ssize_t | write (const byte_t *string) |
ssize_t | write (const char *string) |
ssize_t | write (const wchar_t *string) |
ssize_t | writeUcs2 (const ucs2_t *string) |
ssize_t | write (const byte_t *string, size_t size) |
ssize_t | write (const char *string, size_t length) |
ssize_t | write (const wchar_t *string, size_t length) |
ssize_t | writeUcs2 (const ucs2_t *string, size_t length) |
ssize_t | write (const void *buffer, size_t size) |
ssize_t | write (uint16_t number, int32_t sec, int32_t usec) |
ssize_t | write (uint32_t number, int32_t sec, int32_t usec) |
ssize_t | write (uint64_t number, int32_t sec, int32_t usec) |
ssize_t | write (int16_t number, int32_t sec, int32_t usec) |
ssize_t | write (int32_t number, int32_t sec, int32_t usec) |
ssize_t | write (int64_t number, int32_t sec, int32_t usec) |
ssize_t | write (float number, int32_t sec, int32_t usec) |
ssize_t | write (double number, int32_t sec, int32_t usec) |
ssize_t | write (byte_t character, int32_t sec, int32_t usec) |
ssize_t | write (char character, int32_t sec, int32_t usec) |
ssize_t | write (wchar_t character, int32_t sec, int32_t usec) |
ssize_t | writeUcs2 (ucs2_t character, int32_t sec, int32_t usec) |
ssize_t | write (bool value, int32_t sec, int32_t usec) |
ssize_t | write (const byte_t *string, int32_t sec, int32_t usec) |
ssize_t | write (const char *string, int32_t sec, int32_t usec) |
ssize_t | write (const wchar_t *string, int32_t sec, int32_t usec) |
ssize_t | writeUcs2 (const ucs2_t *string, int32_t sec, int32_t usec) |
ssize_t | write (const byte_t *string, size_t size, int32_t sec, int32_t usec) |
ssize_t | write (const char *string, size_t length, int32_t sec, int32_t usec) |
ssize_t | write (const wchar_t *string, size_t length, int32_t sec, int32_t usec) |
ssize_t | writeUcs2 (const ucs2_t *string, size_t length, int32_t sec, int32_t usec) |
ssize_t | write (const void *buffer, size_t size, int32_t sec, int32_t usec) |
ssize_t | read (uint16_t *buffer) |
ssize_t | read (uint32_t *buffer) |
ssize_t | read (uint64_t *buffer) |
ssize_t | read (int16_t *buffer) |
ssize_t | read (int32_t *buffer) |
ssize_t | read (int64_t *buffer) |
ssize_t | read (float *buffer) |
ssize_t | read (double *buffer) |
ssize_t | read (byte_t *buffer) |
ssize_t | read (char *buffer) |
ssize_t | read (wchar_t *buffer) |
ssize_t | readUcs2 (ucs2_t *buffer) |
ssize_t | read (bool *buffer) |
ssize_t | read (byte_t *buffer, size_t size) |
ssize_t | read (char *buffer, size_t length) |
ssize_t | read (wchar_t *buffer, size_t length) |
ssize_t | readUcs2 (ucs2_t *buffer, size_t length) |
ssize_t | read (void *buf, size_t size) |
ssize_t | read (char **buffer, const char *terminator) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes) |
ssize_t | read (uint16_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (uint32_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (uint64_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (int16_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (int32_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (int64_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (float *buffer, int32_t sec, int32_t usec) |
ssize_t | read (double *buffer, int32_t sec, int32_t usec) |
ssize_t | read (byte_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (char *buffer, int32_t sec, int32_t usec) |
ssize_t | read (wchar_t *buffer, int32_t sec, int32_t usec) |
ssize_t | readUcs2 (ucs2_t *buffer, int32_t sec, int32_t usec) |
ssize_t | read (bool *buffer, int32_t sec, int32_t usec) |
ssize_t | read (byte_t *buffer, size_t size, int32_t sec, int32_t usec) |
ssize_t | read (char *buffer, size_t length, int32_t sec, int32_t usec) |
ssize_t | read (wchar_t *buffer, size_t length, int32_t sec, int32_t usec) |
ssize_t | readUcs2 (ucs2_t *buffer, size_t length, int32_t sec, int32_t usec) |
ssize_t | read (void *buf, size_t size, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec) |
int32_t | waitForNonBlockingRead (int32_t sec, int32_t usec) |
int32_t | waitForNonBlockingWrite (int32_t sec, int32_t usec) |
void | setRetryInterruptedReads (bool retry) |
bool | getRetryInterruptedReads () |
void | setRetryInterruptedWrites (bool retry) |
bool | getRetryInterruptedWrites () |
void | setRetryInterruptedWaits (bool retry) |
bool | getRetryInterruptedWaits () |
void | setRetryInterruptedFcntl (bool retry) |
bool | getRetryInterruptedFcntl () |
void | setRetryInterruptedIoctl (bool retry) |
bool | getRetryInterruptedIoctl () |
void | setAllowShortReads (bool allow) |
bool | getAllowShortReads () |
void | setAllowShortWrites (bool allow) |
bool | getAllowShortWrites () |
virtual bool | passFileDescriptor (int32_t fd) |
virtual bool | receiveFileDescriptor (int32_t *fd) |
virtual bool | passSocket (int32_t sock) |
virtual bool | receiveSocket (int32_t *sock) |
void | setTranslateByteOrder (bool translate) |
bool | getTranslateByteOrder () |
virtual int32_t | fCntl (int32_t command, long arg) |
virtual int32_t | ioCtl (int32_t command, void *arg) |
bool | setNaglesAlgorithmEnabled (bool enabled) |
bool | getNaglesAlgorithmEnabled () |
bool | setSocketWriteBufferSize (int32_t size) |
bool | getSocketWriteBufferSize (int32_t *size) |
bool | setSocketReadBufferSize (int32_t size) |
bool | getSocketReadBufferSize (int32_t *size) |
bool | disableIPv4 () |
bool | enableIPv4 () |
const char * | getType () |
char * | getPeerAddress () |
bool | setWriteBufferSize (size_t size) |
size_t | getWriteBufferSize () |
bool | flushWriteBuffer (int32_t sec, int32_t usec) |
bool | setReadBufferSize (size_t size) |
size_t | getReadBufferSize () |
void | setMmapBufferingEnabled (bool enabled) |
bool | getMmapBufferingEnabled () |
bool | isCurrentBlockMmapBuffered () |
off64_t | getCurrentBlockOffset () |
bool | setCloseOnExec (bool close) |
bool | getCloseOnExec () |
Public Member Functions inherited from input | |
input () | |
virtual | ~input () |
ssize_t | read (char **buffer, const char *terminator) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes) |
ssize_t | read (char **buffer, const char *terminator, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, int32_t sec, int32_t usec) |
ssize_t | read (char **buffer, const char *terminator, size_t maxbytes, char escapechar, int32_t sec, int32_t usec) |
Public Member Functions inherited from object | |
virtual | ~object () |
Public Member Functions inherited from output | |
output () | |
virtual | ~output () |
virtual ssize_t | printf (const char *format,...) |
virtual ssize_t | printf (const char *format, va_list *argp) |
virtual ssize_t | printf (const wchar_t *format,...) |
virtual ssize_t | printf (const wchar_t *format, va_list *argp) |
virtual ssize_t | printfUcs2 (const ucs2_t *format,...) |
virtual ssize_t | printfUcs2 (const ucs2_t *format, va_list *argp) |
void | safePrint (byte_t c) |
void | safePrint (const byte_t *str) |
void | safePrint (const byte_t *str, int32_t length) |
void | safePrint (char c) |
void | safePrint (const char *str) |
void | safePrint (const char *str, int32_t length) |
void | printBits (byte_t value) |
void | printBits (uint16_t value) |
void | printBits (uint32_t value) |
void | printBits (uint64_t value) |
void | printBits (char value) |
void | printBits (int16_t value) |
void | printBits (int32_t value) |
void | printBits (int64_t value) |
void | printBits (const byte_t *bits, uint64_t size) |
void | printHex (const byte_t *data, uint64_t size) |
void | printHex (const byte_t *data, uint64_t size, uint16_t indent) |
Static Public Member Functions | |
static bool | supportsProtocol (const char *protocol) |
Static Public Member Functions inherited from file | |
static bool | createFile (const char *name, mode_t perms) |
static bool | createFifo (const char *filename, mode_t perms) |
static int32_t | createTemporaryFile (char *templatefilename) |
static int32_t | createTemporaryFile (char *templatefilename, mode_t perms) |
static bool | createHardLink (const char *oldpath, const char *newpath) |
static bool | createSymbolicLink (const char *oldpath, const char *newpath) |
static char * | resolveSymbolicLink (const char *filename) |
static bool | rename (const char *oldpath, const char *newpath) |
static bool | remove (const char *filename) |
static bool | truncate (const char *filename) |
static bool | truncate (const char *filename, off64_t size) |
static char * | getContents (const char *name) |
static ssize_t | getContents (const char *name, byte_t *buffer, size_t buffersize) |
static bool | exists (const char *filename) |
static bool | isReadable (const char *filename) |
static bool | isWriteable (const char *filename) |
static bool | isExecutable (const char *filename) |
static bool | isAccessible (const char *filename, int32_t mode) |
static bool | getLastChangeTime (const char *filename, time_t *ctime) |
static bool | setPermissions (const char *filename, mode_t perms) |
static bool | changeOwner (const char *filename, const char *newuser, const char *newgroup) |
static bool | changeOwner (const char *filename, uid_t uid, gid_t gid) |
static bool | getCanChangeOwner (const char *filename) |
static bool | setLastAccessTime (const char *filename, time_t lastaccesstime) |
static bool | setLastModificationTime (const char *filename, time_t lastmodtime) |
static bool | setLastAccessAndModificationTimes (const char *filename, time_t lastaccesstime, time_t lastmodtime) |
static bool | setLastAccessAndModificationTimes (const char *filename) |
static char * | getDirName (const char *filename) |
static char * | getBaseName (const char *filename) |
static char * | getBaseName (const char *filename, const char *ext) |
static char * | getExtension (const char *filename) |
static char * | getEightDotThree (const char *filename) |
static key_t | generateKey (const char *filename, int32_t id) |
static int64_t | getMaxLinks (const char *filename) |
static bool | getMatchingFileNames (const char *pattern, linkedlist< char * > *matches) |
static bool | getMatchingFileNames (const char *const *patterns, linkedlist< char * > *matches) |
static bool | getMatchingFileNames (linkedlist< const char * > *patterns, linkedlist< char * > *matches) |
static bool | getMatchingFileNames (linkedlist< char * > *patterns, linkedlist< char * > *matches) |
Static Public Member Functions inherited from filedescriptor | |
static bool | supportsPassAndReceiveFileDescriptor () |
static bool | supportsPassAndReceiveSocket () |
static bool | createPipe (filedescriptor *readfd, filedescriptor *writefd) |
static uint16_t | convertHostToNet (uint16_t value) |
static uint32_t | convertHostToNet (uint32_t value) |
static uint64_t | convertHostToNet (uint64_t value) |
static uint16_t | convertNetToHost (uint16_t value) |
static uint32_t | convertNetToHost (uint32_t value) |
static uint64_t | convertNetToHost (uint64_t value) |
static uint16_t | convertHostToLittleEndian (uint16_t value) |
static uint32_t | convertHostToLittleEndian (uint32_t value) |
static uint64_t | convertHostToLittleEndian (uint64_t value) |
static uint16_t | convertLittleEndianToHost (uint16_t value) |
static uint32_t | convertLittleEndianToHost (uint32_t value) |
static uint64_t | convertLittleEndianToHost (uint64_t value) |
The url class provides read access to urls.
Its parent class: file provides provides open(), read(), and close() methods.
http urls, with Basic Authentication, are supported on all platforms.
urls for other protocols, including ftp, https, scp, sftp, and others, are supported if rudiments was compiled with support for libcurl.
Examples of supported urls include:
The url class supports storing the user:password portion of a url in a user-password file. These files may be referenced in the url by enclosing the full pathname of the file in square brackets. The file should consist of a single line containing the user and password, separated by a colon.
For example:
myusername:mypassword
url::url | ( | ) |
Creates an instance of the url class.
|
virtual |
Deletes this instance of the url class.
const char* url::getCertificateAuthority | ( | ) |
Returns the certificate authority that will be used to perform SSL validation of the peer.
const char* url::getError | ( | ) |
If an error occurs, returns a higher level, possibly more descriptive or useful error than might be returned by the system using error::getErrorMessage().
const char* url::getHttpHeaders | ( | ) |
Returns raw HTTP headers set by a previous call to setHttpHeaders().
const char* url::getHttpPostContentType | ( | ) |
Returuns the content type to send when doing an HTTP POST.
const char* url::getHttpPostData | ( | ) |
Returns the "data" that was set during a previous call to setHttpPostData().
uint64_t url::getHttpPostDataSize | ( | ) |
Returns the "size" that was set duringby a previous call to setHttpPostData().
const char* url::getHttpUserAgent | ( | ) |
Returns the value that will be sent in the User-Agent header that is sent during an HTTP/HTTPS request.
bool url::getUseHttpPost | ( | ) |
Returns true if HTTP POST is used when making an HTTP/HTTPS request and false if HTTP GET is used.
bool url::getValidatePeer | ( | ) |
Returns true if SSL validation of the peer will be done or false otherwise.
void url::setCertificateAuthority | ( | const char * | ca | ) |
Sets the certificate authority to use when SSL validation of the peer is being done.
void url::setHttpHeaders | ( | const char * | headers | ) |
Sets raw HTTP headers to send when making HTTP/HTTPS requests.
Note that if these raw HTTP headers include a User-Agent header, then it will override any value set by setHttpUserAgent().
Similarly, if these raw HTTP headers include a Host, or Authorization: Basic header, then it will override what would have been sent by parsing the url.
void url::setHttpPostContentType | ( | const char * | contenttype | ) |
Sets the content type to send when doing an HTTP POST.
Defaults to application/x-www-form-urlencoded, which is correct for sending key/value pairs.
May be set though, for example, to application/json when sending JSON.
void url::setHttpPostData | ( | const char * | data, |
uint64_t | size | ||
) |
Posts "size" bytes of "data" during an HTTP POST. Data in any format that agrees with the http post content type may be sent.
void url::setHttpUserAgent | ( | const char * | useragent | ) |
Sets the value sent in the User-Agent header that is sent during an HTTP/HTTPS request to "useragent".
Defaults to rudiments/RUDIMENTS_VERSION where RUDIMENTS_VERSION is replaced with the current Rudiments version string.
void url::setUseHttpPost | ( | bool | usehttppost | ) |
Sets whether to use HTTP GET or POST when making an HTTP/HTTPS request and post data has been set using setHttpPostData().
If "usehttppost" is set to true then POST is used. If "usehttppost" is set to false then GET is used.
Defaults to false.
void url::setValidatePeer | ( | bool | validatepeer | ) |
Sets whether or not to perform SSL validation of the peer when the url is any url that uses SSL.
|
static |
Returns true if "protocol" is supported and false if it is not supported.