Annotation of libaitio/inc/aitio.h, revision 1.1.1.1.2.1
1.1 misho 1: /*************************************************************************
2: * (C) 2010 AITNET ltd - Sofia/Bulgaria - <misho@aitbg.com>
3: * by Michael Pounov <misho@openbsd-bg.org>
4: *
5: * $Author: misho $
1.1.1.1.2.1! misho 6: * $Id: aitio.h,v 1.1.1.1 2010/02/23 22:54:52 misho Exp $
1.1 misho 7: *
8: *************************************************************************/
9: #ifndef __AITIO_H
10: #define __AITIO_H
11:
12:
1.1.1.1.2.1! misho 13: typedef struct _tagURLItem {
! 14: int vallen;
! 15: char *value;
! 16: } url_Item_t;
! 17:
! 18: struct tagIOURL {
! 19: unsigned char url_line[BUFSIZ];
! 20:
! 21: url_Item_t url_tech;
! 22: url_Item_t url_user;
! 23: url_Item_t url_pass;
! 24: url_Item_t url_host;
! 25: url_Item_t url_port;
! 26: url_Item_t url_path;
! 27: url_Item_t url_args;
! 28:
! 29: char *url_reserved;
! 30: };
! 31:
1.1 misho 32: // io_GetErrno() Get error code of last operation
33: inline int io_GetErrno();
34: // io_GetError() Get error text of last operation
35: inline const char *io_GetError();
36:
37:
38: /*
39: * ioPromptRead() Read data from input h[0] with prompt to output h[1]
40: * @h = file handles h[0] = input, h[1] = output, if NULL use stdin, stdout
41: * @csPrompt = Prompt before input, may be NULL
42: * @psData = Readed data
43: * @dataLen = Length of data
44: * return: 0 EOF; -1 error:: can`t read; >0 count of readed chars
45: */
46: int ioPromptRead(int *h, const char *csPrompt, char * __restrict psData, int dataLen);
47: /*
48: * ioPromptPassword() Read password from input h[0] with prompt to output h[1]
49: * @h = file handles h[0] = input, h[1] = output, if NULL use stdin, stdout
50: * @csPrompt = Prompt before input, may be NULL
51: * @psPass = Readed password
52: * @passLen = Length of password
53: * @confirm = Confirm password, 0 - get password, !=0 Ask for confirmation
54: * return: 0 EOF; -1 error:: can`t read; >0 count of readed chars
55: */
56: int ioPromptPassword(int *h, const char *csPrompt, char * __restrict psPass, int passLen, int confirm);
57:
58: /*
59: * ioRegexVerify() Function for verify data match in regex expression
60: * @csRegex = Regulare expression pattern
61: * @csData = Data for check and verify
62: * @startPos = Return start positions
63: * @endPos = Return end positions
64: * return: NULL not match or error; !=NULL begin of matched data
65: */
66: const char *ioRegexVerify(const char *csRegex, const char *csData, int *startPos, int *endPos);
67: /*
68: * ioRegexGet() Function for get data match in regex expression
69: * @csRegex = Regulare expression pattern
70: * @csData = Data from get
71: * @psString = Returned string if match
72: * @strLen = Length of string
73: * return: 0 not match; >0 count of returned chars
74: */
75: int ioRegexGet(const char *csRegex, const char *csData, char * __restrict psString, int strLen);
76: /*
77: * ioRegexReplace() Function for replace data match in regex expression with newdata
78: * @csRegex = Regulare expression pattern
79: * @csData = Source data
80: * @csNew = Data for replace
81: * return: NULL not match or error; !=NULL allocated new string, must be free after use!
82: */
83: char *ioRegexReplace(const char *csRegex, const char *csData, const char *csNew);
84:
1.1.1.1.2.1! misho 85: /*
! 86: * ioURLGet() Parse and get data from input URL
! 87: * @csURL = Input URL line
! 88: * @url = Output parsed URL
! 89: * return: 0 error format not find tech:// and return URL like path;
! 90: -1 error:: can`t read; >0 ok, up bits for known elements
! 91: */
! 92: int ioURLGet(const char *csURL, struct tagIOURL *url);
! 93:
1.1 misho 94:
95: #endif
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>