亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? recvqueue.c++

?? fax相關(guān)的東西
?? C++
字號:
/*	$Id: RecvQueue.c++,v 1.15 2006/07/19 07:35:46 aidan Exp $ *//* * Copyright (c) 1995-1996 Sam Leffler * Copyright (c) 1995-1996 Silicon Graphics, Inc. * HylaFAX is a trademark of Silicon Graphics * * Permission to use, copy, modify, distribute, and sell this software and  * its documentation for any purpose is hereby granted without fee, provided * that (i) the above copyright notices and this permission notice appear in * all copies of the software and related documentation, and (ii) the names of * Sam Leffler and Silicon Graphics may not be used in any advertising or * publicity relating to the software without the specific, prior written * permission of Sam Leffler and Silicon Graphics. *  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.   *  * IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR * ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, * WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF  * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE  * OF THIS SOFTWARE. *//* * Support related to received facsimile. */#include "HylaFAXServer.h"#include "Sys.h"#include "Socket.h"#include "tiffio.h"#include <ctype.h>#include <sys/file.h>RecvInfo::RecvInfo(){    beingReceived = false;    recvTime = 0;}RecvInfo::RecvInfo(const char* qf){    qfile = qf;    beingReceived = false;    recvTime = 0;}RecvInfo::~RecvInfo() {}fxIMPLEMENT_StrKeyPtrValueDictionary(RecvInfoDict, RecvInfo*)/* * This tests whether the tif file is a "fax" image. * Traditional fax images are MH, MR, MMR, but some can * be JPEG, JBIG, and possibly others.  So we use * TIFFTAG_FAXRECVPARAMS as a "fax" image identifier, * and if it's not there, then we resort to traditional * tactics. */static boolisFAXImage(TIFF* tif){#ifdef TIFFTAG_FAXRECVPARAMS    uint32 v;    if (TIFFGetField(tif, TIFFTAG_FAXRECVPARAMS, &v) && v != 0)	return (true);#endif    uint16 w;    if (TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &w) && w != 1)	return (false);    if (TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &w) && w != 1)	return (false);    if (!TIFFGetField(tif, TIFFTAG_COMPRESSION, &w) ||      (w != COMPRESSION_CCITTFAX3 && w != COMPRESSION_CCITTFAX4))	return (false);    if (!TIFFGetField(tif, TIFFTAG_PHOTOMETRIC, &w) ||      (w != PHOTOMETRIC_MINISWHITE && w != PHOTOMETRIC_MINISBLACK))	return (false);    return (true);}/* * Construct receive information from a file's contents. */boolHylaFAXServer::getRecvDocStatus(RecvInfo& ri){    int fd = Sys::open(ri.qfile, O_RDWR);	// RDWR for flock emulation    if (fd < 0)	return (false);    /*     * Files that are being received are locked     * for exclusive use by faxgetty.       */    ri.beingReceived = (flock(fd, LOCK_SH|LOCK_NB) < 0 && errno == EWOULDBLOCK);    TIFF* tif = TIFFFdOpen(fd, ri.qfile, "r");    if (!tif) {	Sys::close(fd);	/*	 * File may not have an IFD written yet,	 * if it's locked just assume so...	 */	return (ri.beingReceived);    }    /*     * We know that faxgetty will write received     * data in only a limited set for formats.     */    if (!isFAXImage(tif)) {	TIFFClose(tif);	return (false);    }    /*     * Should be a received facsimile, build up status.     * Note that certain information was not recorded     * in older versions of the software; thus the careful     * checks for certain tags and their values.     */    uint32 v;#ifdef TIFFTAG_FAXRECVPARAMS    if (TIFFGetField(tif, TIFFTAG_FAXRECVPARAMS, &v))	ri.params.decode((u_int) v);			// page transfer params    else {#endif    float vres = 3.85;					// XXX default    if (TIFFGetField(tif, TIFFTAG_YRESOLUTION, &vres)) {	uint16 resunit = RESUNIT_INCH;			// TIFF spec default	TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);	if (resunit == RESUNIT_INCH)	    vres /= 25.4;	if (resunit == RESUNIT_NONE)	    vres /= 720.0;				// postscript units ?    }    float hres = 8.03;					// XXX default    if (TIFFGetField(tif, TIFFTAG_XRESOLUTION, &hres)) {	uint16 resunit = RESUNIT_INCH;			// TIFF spec default	TIFFGetField(tif, TIFFTAG_RESOLUTIONUNIT, &resunit);	if (resunit == RESUNIT_INCH)	    hres /= 25.4;	if (resunit == RESUNIT_NONE)	    hres /= 720.0;				// postscript units ?    }    ri.params.setRes((u_int) hres, (u_int) vres);	// resolution    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &v);    ri.params.setPageWidthInPixels((u_int) v);		// page width    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &v);    ri.params.setPageLengthInMM((u_int)(v / vres));	// page length#ifdef TIFFTAG_FAXRECVPARAMS    }#endif    char* cp;#ifdef TIFFTAG_FAXDCS    if (TIFFGetField(tif, TIFFTAG_FAXDCS, &cp) && strncmp(cp, "00 00 00", 8) != 0) {	// cannot trust br from faxdcs as V.34-Fax does not provide it there	u_int brhold = ri.params.br;	fxStr faxdcs(cp);	sanitize(faxdcs);	ri.params.asciiDecode((const char*) faxdcs);	// params per Table 2/T.30	ri.params.setFromDCS(ri.params);	ri.params.br = brhold;    }#endif    ri.sender = "";    CallID empty_callid;    ri.callid = empty_callid;    if (TIFFGetField(tif, TIFFTAG_IMAGEDESCRIPTION, &cp)) {	while (cp[0] != '\0' && cp[0] != '\n') {	// sender 	    ri.sender.append(cp[0]);	    cp++;	}	sanitize(ri.sender);	u_int i = 0;	while (cp[0] == '\n') {	    cp++;	    ri.callid.resize(i+1);	    while (cp[0] != '\0' && cp[0] != '\n') {		ri.callid[i].append(cp[0]);		cp++;	    }	    sanitize(ri.callid[i]);	    i++;	}    } else	ri.sender = "<unknown>";#ifdef TIFFTAG_FAXSUBADDRESS    if (TIFFGetField(tif, TIFFTAG_FAXSUBADDRESS, &cp)) {	ri.subaddr = cp;	sanitize(ri.subaddr);    } else#endif	ri.subaddr = "";    fxStr date;    if (TIFFGetField(tif, TIFFTAG_DATETIME, &cp)) {	// time received	date = cp;	sanitize(date);    }    ri.time = 0;    ri.npages = 0;					// page count    do {	ri.npages++;#ifdef TIFFTAG_FAXRECVTIME	if (TIFFGetField(tif, TIFFTAG_FAXRECVTIME, &v))	    ri.time += (u_int) v;#endif    } while (TIFFReadDirectory(tif));    TIFFClose(tif);    return (true);}boolHylaFAXServer::isVisibleRecvQFile(const char* filename, const struct stat&){    return (strncmp(filename, "fax", 3) == 0);}RecvInfo*HylaFAXServer::getRecvInfo(const fxStr& qfile, const struct stat& sb){    RecvInfo* rip = recvq[qfile];    if (!rip) {	rip = new RecvInfo(qfile);	if (!getRecvDocStatus(*rip)) {	    delete rip;	    return (NULL);	}	// NB: this will be wrong if the file is copied	rip->recvTime = sb.st_mtime;		// time recv completed	recvq[qfile] = rip;    } else if (rip->beingReceived && rip->recvTime < sb.st_mtime) {	if (!getRecvDocStatus(*rip)) {	    recvq.remove(qfile);	    delete rip;	    return (NULL);	}	// NB: this will be wrong if the file is copied	rip->recvTime = sb.st_mtime;		// time recv completed    }    return (rip);}voidHylaFAXServer::listRecvQ(FILE* fd, const SpoolDir& sd, DIR* dir){    /*     * Use an absolute pathname when doing file     * lookups to improve cache locality.     */    fxStr path(sd.pathname);    struct dirent* dp;    while ((dp = readdir(dir))) {	struct stat sb;	if (!isVisibleRecvQFile(dp->d_name, sb))	    continue;	fxStr qfile(path | dp->d_name);	RecvInfo* rip;	if (FileCache::update(qfile, sb) && (rip = getRecvInfo(qfile, sb))) {	    Rprintf(fd, recvFormat, *rip, sb);	    fputs("\r\n", fd);	}    }}voidHylaFAXServer::listRecvQFile(FILE* fd, const SpoolDir& dir,    const char* filename, const struct stat& sb){    RecvInfo* rip =	getRecvInfo(fxStr::format("%s%s", dir.pathname, filename), sb);    if (rip)	Rprintf(fd, recvFormat, *rip, sb);    else	listUnixFile(fd, dir, filename, sb);}static const char rformat[] = {    'A',		// A    'B',		// B    'C',		// C    'D',		// D    'E',		// E    'F',		// F    'G',		// G    'H',		// H    'I',		// I    'J',		// J    'K',		// K    'L',		// L    'M',		// M    'N',		// N    'O',		// O    'P',		// P    'Q',		// Q    'R',		// R    'S',		// S    'T',		// T    'U',		// U    'V',		// V    'W',		// W#ifdef OLDPROTO_SUPPORT    'u',		// X (beingReceived as 1 or 0)    's',		// Y (recvTime in strftime %Y:%m:%d %H:%M:%S format)    'u',		// Z (recvTime as decimal time_t)#else    'X',		// X    'Y',		// Y    'Z',		// Z#endif    '[',		// [    '\\',		// \ (must have something after the backslash)    ']',		// ]    '^',		// ^    '_',		// _    '`',		// `    's',		// a (subaddr)    'u',		// b (bitrate)    'c',		// c    's',		// d (data format)    's',		// e (error a.k.a. reason)    's',		// f (filename)    'g',		// g    's',		// h (time spent receiving)    's',		// i (CIDName)    's',		// j (CIDNumber)    'k',		// k    'u',		// l (pagelength)    's',		// m (protection mode)    'u',		// n (file size)    's',		// o (owner)    'u',		// p (npages)    'q',		// q (UNIX-style protection mode)    'u',		// r (resolution)    's',		// s (sender TSI)    's',		// t (time received)    'u',		// u    'v',		// v    'u',		// w (pagewidth)    'x',		// x    'y',		// y    's'			// z (``*'' if being received)};#define	rounddown(x, y)	(((x)/(y))*(y))/* * Return a compact notation for the specified * time.  This notation is guaranteed to fit in * a 7-character field.  We select one of 5 * representations based on how close the time * is to ``now''. */const char*HylaFAXServer::compactRecvTime(time_t t){    time_t now = Sys::now();    if (t < now) {				// in the past	static char buf[15];	const struct tm* tm = cvtTime(t);	if (t > rounddown(now, 24*60*60))	// today, use 19:37	    strftime(buf, sizeof (buf), "%H:%M", tm);	else if (t > now-7*24*60*60)		// within a week, use Sun 6pm	    strftime(buf, sizeof (buf), "%a%I%p", tm);	else					// over a week, use 25Dec95	    strftime(buf, sizeof (buf), "%d%b%y", tm);	return (buf);    } else	return ("");}/* * Print a formatted string with fields filled in from * the specified received facsimile state.  This * functionality is used to permit clients to get recv * queue state listings in preferred formats. */voidHylaFAXServer::Rprintf(FILE* fd, const char* fmt,    const RecvInfo& ri, const struct stat& sb){    for (const char* cp = fmt; *cp; cp++) {	if (*cp == '%') {#define	MAXSPEC	20	    char fspec[MAXSPEC];	    char* fp = fspec;	    *fp++ = '%';	    char c = *++cp;	    if (c == '-')		*fp++ = c, c = *++cp;	    if (isdigit(c)) {		do {		    *fp++ = c;		} while (isdigit(c = *++cp) && fp < &fspec[MAXSPEC-3]);	    }	    if (c == '.') {		do {		    *fp++ = c;		} while (isdigit(c = *++cp) && fp < &fspec[MAXSPEC-2]);	    }	    if (!isalpha(c)) {		if (c == '%')		// %% -> %		    putc(c, fd);		else		    fprintf(fd, "%.*s%c", fp-fspec, fspec, c);		continue;	    }	    fp[0] = rformat[c-'A'];	// printf format string	    fp[1] = '\0';	    switch (c) {	    case 'a':		fprintf(fd, fspec, (const char*) ri.subaddr);		break;	    case 'b':		fprintf(fd, fspec, ri.params.bitRate());		break;	    case 'd':		fprintf(fd, fspec, ri.params.dataFormatName());		break;	    case 'e':		fprintf(fd, fspec, (const char*) ri.reason);		break;	    case 'f':		fp = (char *) strrchr(ri.qfile, '/');		fprintf(fd, fspec, fp ? fp+1 : (const char*) ri.qfile);		break;	    case 'h':		fprintf(fd, fspec, fmtTime(ri.time));		break;	    case 'i':		fprintf(fd, fspec, ri.callid.size() > CallID::NAME ? (const char*) ri.callid.id(CallID::NAME) : "");		break;	    case 'j':		fprintf(fd, fspec, ri.callid.size() > CallID::NUMBER ? (const char*) ri.callid.id(CallID::NUMBER) : "");		break;	    case 'l':		fprintf(fd, fspec, ri.params.pageLength());		break;	    case 'm':	    case 'q':		{ char prot[8];					// XXX HP C++		  makeProt(sb, c == 'q', prot);		  fprintf(fd, fspec, prot);		}		break;	    case 'n':		fprintf(fd, fspec, (u_int) sb.st_size);		// XXX		break;	    case 'o':		fprintf(fd, fspec, userName((u_int) sb.st_gid));		break;	    case 'p':		fprintf(fd, fspec, ri.npages);		break;	    case 'r':		fprintf(fd, fspec, ri.params.verticalRes());		break;	    case 's':		fprintf(fd, fspec, (const char*) ri.sender);		break;	    case 't':		fprintf(fd, fspec, compactRecvTime(ri.recvTime));		break;	    case 'w':		fprintf(fd, fspec, ri.params.pageWidth());		break;	    case 'z':		fprintf(fd, fspec, ri.beingReceived ? "*" : " ");		break;#if OLDPROTO_SUPPORT	    case 'X':		fprintf(fd, fspec, ri.beingReceived);		break;	    case 'Y':		{ char buf[30];					// XXX HP C++		  strftime(buf, sizeof (buf), "%Y:%m:%d %H:%M:%S",			IS(USEGMT) ? gmtime(&ri.recvTime) : localtime(&ri.recvTime));		  fprintf(fd, fspec, buf);		}		break;	    case 'Z':		fprintf(fd, fspec, (u_int) ri.recvTime);		break;#endif /* OLDPROTO_SUPPORT */	    }	} else	    putc(*cp, fd);    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91美女在线视频| 91精品国产手机| 日韩av中文字幕一区二区| 久久久精品2019中文字幕之3| www.亚洲激情.com| 麻豆精品一区二区av白丝在线| 中文字幕第一区综合| 日韩一级二级三级精品视频| 99热这里都是精品| 久草精品在线观看| 亚洲成人精品影院| 亚洲裸体在线观看| 久久久99精品久久| 欧美一卡二卡在线观看| 欧美羞羞免费网站| 成人午夜av在线| 久久66热re国产| 视频一区视频二区中文字幕| 亚洲欧美一区二区三区极速播放| 国产日韩欧美制服另类| 欧美一级淫片007| 欧美日韩免费高清一区色橹橹 | 国产乱子伦视频一区二区三区| 一区二区三区欧美日| 国产女人aaa级久久久级| 久久久三级国产网站| 91精品国产高清一区二区三区| 欧美影视一区在线| 在线精品观看国产| 在线精品视频一区二区| 97se亚洲国产综合在线| 色综合久久天天| 一本一道久久a久久精品| 99riav一区二区三区| 国产成人免费高清| 成人黄色免费短视频| 国产激情精品久久久第一区二区 | 成人a免费在线看| 国产真实乱子伦精品视频| 老色鬼精品视频在线观看播放| 日本一区中文字幕 | 国模套图日韩精品一区二区| 日韩在线一二三区| 琪琪久久久久日韩精品| 麻豆精品精品国产自在97香蕉| 免费成人美女在线观看.| 青草av.久久免费一区| 精品一区中文字幕| 国产乱人伦偷精品视频不卡| 国产成人午夜精品5599| 不卡一卡二卡三乱码免费网站| 成人一区二区三区在线观看| 成人免费看视频| 91在线视频在线| 91国产成人在线| 欧美高清性hdvideosex| 欧美一区永久视频免费观看| 日韩视频国产视频| 久久综合色一综合色88| 国产精品美女久久久久久久久| 亚洲美女精品一区| 日韩二区三区在线观看| 国产一区二区三区在线观看精品| 国产精品一区二区免费不卡| 99在线热播精品免费| 欧美三级视频在线播放| 日韩亚洲欧美一区| 中文字幕欧美国产| 亚洲综合图片区| 久久成人久久爱| 成人亚洲一区二区一| 色老头久久综合| 日韩手机在线导航| 中文字幕av免费专区久久| 亚洲美女屁股眼交| 久久爱www久久做| 波波电影院一区二区三区| 欧美日韩中字一区| 久久众筹精品私拍模特| 伊人一区二区三区| 久久精品国产秦先生| 色婷婷精品大在线视频| 日韩一区二区在线播放| 国产精品国产三级国产有无不卡| 亚洲黄色小视频| 精品一区二区综合| 欧美午夜电影一区| 亚洲国产成人自拍| 麻豆国产精品官网| 91麻豆自制传媒国产之光| 日韩三级在线观看| 亚洲蜜臀av乱码久久精品蜜桃| 久久99久国产精品黄毛片色诱| 色婷婷激情一区二区三区| 欧美精品一区二区三区一线天视频| 一区二区在线观看免费| 国产精品18久久久久久久久 | 国产suv一区二区三区88区| 欧美精品久久天天躁| 国产精品不卡在线| 国精品**一区二区三区在线蜜桃| 欧美在线视频日韩| 国产精品福利一区二区| 免费的成人av| 欧美猛男男办公室激情| 综合久久一区二区三区| 国产一区二区中文字幕| 91精品国产一区二区| 亚洲一区二区成人在线观看| 成人丝袜高跟foot| 久久综合九色综合97婷婷| 亚洲成av人片一区二区三区| 99国产精品久久久久久久久久久| 欧美电视剧免费观看| 亚洲一区二区av电影| 99久久国产综合精品色伊| 国产色婷婷亚洲99精品小说| 日韩精品亚洲一区二区三区免费| 色综合久久久久网| 中文字幕日本不卡| 成人爱爱电影网址| 久久久久99精品国产片| 美女一区二区三区| 欧美日韩视频在线第一区| 亚洲蜜臀av乱码久久精品蜜桃| 成人精品免费看| 国产日韩精品一区| 国产精品18久久久久久久久久久久 | 99精品视频一区二区三区| 久久久久久9999| 国产一区欧美一区| 久久免费国产精品| 国产美女在线观看一区| 久久视频一区二区| 国产精品系列在线观看| 久久久久久久久久久久久久久99 | 懂色av一区二区三区蜜臀| 久久综合中文字幕| 国产河南妇女毛片精品久久久| 久久综合九色综合97_久久久| 狠狠色狠狠色合久久伊人| 久久综合久久99| 国产a级毛片一区| 国产精品无遮挡| 91丨九色丨黑人外教| 亚洲最新视频在线播放| 欧美日韩亚洲丝袜制服| 天堂午夜影视日韩欧美一区二区| 欧美精品成人一区二区三区四区| 日韩精品五月天| 26uuu精品一区二区| 成人国产电影网| 亚洲码国产岛国毛片在线| 欧美日韩aaaaa| 国产最新精品精品你懂的| 欧美激情一区不卡| 色婷婷一区二区| 奇米精品一区二区三区在线观看 | 99re在线视频这里只有精品| 亚洲欧美乱综合| 91.麻豆视频| 国产精品亚洲专一区二区三区| 国产精品人妖ts系列视频| 色婷婷精品大视频在线蜜桃视频 | 粉嫩绯色av一区二区在线观看| 国产精品国产三级国产三级人妇| 91免费国产在线观看| 一区二区三区美女视频| 日韩三级免费观看| 国产成都精品91一区二区三| 亚洲另类春色国产| 日韩欧美在线网站| 成人免费看片app下载| 午夜久久久影院| 久久久www成人免费无遮挡大片| 91视频免费看| 蜜臀精品久久久久久蜜臀| 久久久久久久久免费| 91美女精品福利| 九一久久久久久| 亚洲美腿欧美偷拍| 欧美r级在线观看| 91在线观看成人| 麻豆精品国产传媒mv男同| 亚洲色大成网站www久久九九| 欧美一二三四在线| 91麻豆国产福利精品| 久久99国产精品免费网站| 亚洲理论在线观看| 欧美电影免费观看高清完整版在线| 99精品视频一区| 国产尤物一区二区| 亚洲成人av资源| 欧美极品美女视频| 欧美一区二区三区日韩视频| 成人aaaa免费全部观看| 久久精品国产亚洲一区二区三区| 亚洲欧美韩国综合色| 欧美精品一区二区三区在线播放 | 五月婷婷久久丁香|