本文整理汇总了C++中rfbLog函数的典型用法代码示例。如果您正苦于以下问题:C++ rfbLog函数的具体用法?C++ rfbLog怎么用?C++ rfbLog使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rfbLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rfbAuthRevokeUser
void
rfbAuthRevokeUser(const char* name)
{
UserList** prev = &userACL;
UserList* p;
rfbLog("Removing user '%s' from ACL\n", name);
while (*prev != NULL) {
p = *prev;
if (!strcmp(p->name, name)) {
*prev = p->next;
xfree(p->name);
xfree(p);
return;
}
prev = &p->next;
}
}
示例2: idle
static void idle(rfbScreenInfo* server)
{
int c;
rfbBool goForward;
LOCK(statisticsMutex);
#ifdef ALL_AT_ONCE
goForward=(countGotUpdate==NUMBER_OF_ENCODINGS_TO_TEST);
#else
goForward=(countGotUpdate==1);
#endif
/* if(lastUpdateRect.x2==354)
rfbLog("server checked: countGotUpdate=%d\n",countGotUpdate); */
UNLOCK(statisticsMutex);
if(!goForward)
return;
countGotUpdate=0;
LOCK(frameBufferMutex);
{
int i,j;
int x1=(rand()%(server->width-1)),x2=(rand()%(server->width-1)),
y1=(rand()%(server->height-1)),y2=(rand()%(server->height-1));
if(x1>x2) { i=x1; x1=x2; x2=i; }
if(y1>y2) { i=y1; y1=y2; y2=i; }
x2++; y2++;
for(c=0;c<3;c++) {
for(i=x1;i<x2;i++)
for(j=y1;j<y2;j++)
server->frameBuffer[i*4+c+j*server->paddedWidthInBytes]=255*(i-x1+j-y1)/(x2-x1+y2-y1);
}
rfbMarkRectAsModified(server,x1,y1,x2,y2);
lastUpdateRect.x1=x1;
lastUpdateRect.y1=y1;
lastUpdateRect.x2=x2;
lastUpdateRect.y2=y2;
#ifdef VERY_VERBOSE
rfbLog("Sent update (%d,%d)-(%d,%d)\n",x1,y1,x2,y2);
#endif
}
UNLOCK(frameBufferMutex);
}
示例3: getBgColour
/*
* getBgColour() gets the most prevalent colour in a byte array.
*/
static uint32_t
getBgColour(char *data, int size, int bpp)
{
#define NUMCLRS 256
static int counts[NUMCLRS];
int i,j,k;
int maxcount = 0;
uint8_t maxclr = 0;
if (bpp != 8) {
if (bpp == 16) {
return ((uint16_t *)data)[0];
} else if (bpp == 32) {
return ((uint32_t *)data)[0];
} else {
rfbLog("getBgColour: bpp %d?\n",bpp);
return 0;
}
}
for (i=0; i<NUMCLRS; i++) {
counts[i] = 0;
}
for (j=0; j<size; j++) {
k = (int)(((uint8_t *)data)[j]);
if (k >= NUMCLRS) {
rfbErr("getBgColour: unusual colour = %d\n", k);
return 0;
}
counts[k] += 1;
if (counts[k] > maxcount) {
maxcount = counts[k];
maxclr = ((uint8_t *)data)[j];
}
}
return maxclr;
}
示例4: FileUpdateComplete
void
FileUpdateComplete(rfbClientPtr cl, rfbTightClientPtr rtcp)
{
/* Here we are settimg the modification and access time of the file */
/* Windows code stes mod/access/creation time of the file */
struct utimbuf utb;
utb.actime = utb.modtime = rtcp->rcft.rcfu.mTime;
if(utime(rtcp->rcft.rcfu.fName, &utb) == -1) {
rfbLog("File [%s]: Method [%s]: Setting the modification/access"
" time for the file <%s> failed\n", __FILE__,
__FUNCTION__, rtcp->rcft.rcfu.fName);
}
if(rtcp->rcft.rcfu.uploadFD != -1) {
close(rtcp->rcft.rcfu.uploadFD);
rtcp->rcft.rcfu.uploadFD = -1;
rtcp->rcft.rcfu.uploadInProgress = FALSE;
}
}
示例5: HandleFence
/*
* This is called whenever a client fence message is received.
*/
void HandleFence(rfbClientPtr cl, CARD32 flags, unsigned len, const char *data)
{
RTTInfo rttInfo;
if (flags & rfbFenceFlagRequest) {
if (flags & rfbFenceFlagSyncNext) {
cl->pendingSyncFence = TRUE;
cl->fenceFlags = flags & (rfbFenceFlagBlockBefore |
rfbFenceFlagBlockAfter |
rfbFenceFlagSyncNext);
cl->fenceDataLen = len;
if (len > 0)
memcpy(cl->fenceData, data, len);
return;
}
/* We handle everything synchronously, so we trivially honor these
modes */
flags = flags & (rfbFenceFlagBlockBefore | rfbFenceFlagBlockAfter);
rfbSendFence(cl, flags, len, data);
return;
}
switch (len) {
case 0:
// Initial dummy fence
break;
case sizeof(RTTInfo):
memcpy(&rttInfo, data, sizeof(RTTInfo));
HandleRTTPong(cl, &rttInfo);
break;
default:
rfbLog("Fence of unusual size received\n");
}
}
示例6: avahi_reset
void avahi_reset(void) {
int i;
if (db) fprintf(stderr, "in avahi_reset\n");
for (i=0; i<NREG; i++) {
if (registered[i].name) {
free(registered[i].name);
registered[i].name = NULL;
}
if (registered[i].host) {
free(registered[i].host);
registered[i].host = NULL;
}
}
if (!_client || !_group) {
if (db) fprintf(stderr, " avahi_reset client/group null\n");
return;
}
avahi_entry_group_reset(_group);
rfbLog("Avahi resetting group.\n");
if (db) fprintf(stderr, "out avahi_reset\n");
}
示例7: handleMessage
static rfbBool
handleMessage(rfbClientPtr cl,
const char* messageName,
void (*handler)(rfbClientPtr cl, rfbTightClientPtr data))
{
rfbTightClientPtr data;
rfbLog("tightvnc-filetransfer: %s message received\n", messageName);
if((IsFileTransferEnabled() == FALSE) || ( cl->viewOnly == TRUE)) {
rfbCloseClient(cl);
return FALSE;
}
data = rfbGetTightClientData(cl);
if(data == NULL)
return FALSE;
handler(cl, data);
return TRUE;
}
示例8: ConvertPath
/*
* When the console sends the File Transfer Request, it sends the file path with
* ftproot as "/". So on Agent, to get the absolute file path we need to prepend
* the ftproot to it.
*/
char*
ConvertPath(char* path)
{
char p[PATH_MAX];
memset(p, 0, PATH_MAX);
if( (path == NULL) ||
(strlen(path) == 0) ||
(strlen(path)+strlen(ftproot) > PATH_MAX - 1) ) {
rfbLog("File [%s]: Method [%s]: cannot create path for file transfer\n",
__FILE__, __FUNCTION__);
return NULL;
}
memcpy(p, path, strlen(path));
memset(path, 0, PATH_MAX);
sprintf(path, "%s%s", ftproot, p);
return path;
}
示例9: rfbSendRectEncodingHextile
rfbBool
rfbSendRectEncodingHextile(rfbClientPtr cl,
int x,
int y,
int w,
int h)
{
rfbFramebufferUpdateRectHeader rect;
if (cl->ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE) {
if (!rfbSendUpdateBuf(cl))
return FALSE;
}
rect.r.x = Swap16IfLE(x);
rect.r.y = Swap16IfLE(y);
rect.r.w = Swap16IfLE(w);
rect.r.h = Swap16IfLE(h);
rect.encoding = Swap32IfLE(rfbEncodingHextile);
memcpy(&cl->updateBuf[cl->ublen], (char *)&rect,
sz_rfbFramebufferUpdateRectHeader);
cl->ublen += sz_rfbFramebufferUpdateRectHeader;
rfbStatRecordEncodingSent(cl, rfbEncodingHextile,
sz_rfbFramebufferUpdateRectHeader,
sz_rfbFramebufferUpdateRectHeader + w * (cl->format.bitsPerPixel / 8) * h);
switch (cl->format.bitsPerPixel) {
case 8:
return sendHextiles8(cl, x, y, w, h);
case 16:
return sendHextiles16(cl, x, y, w, h);
case 32:
return sendHextiles32(cl, x, y, w, h);
}
rfbLog("rfbSendRectEncodingHextile: bpp %d?\n", cl->format.bitsPerPixel);
return FALSE;
}
示例10: clean_shm
void clean_shm(int quick) {
int i, cnt = 0;
/*
* to avoid deadlock, etc, under quick=1 we just delete the shm
* areas and leave the X stuff hanging.
*/
if (quick) {
shm_delete(&scanline_shm);
shm_delete(&fullscreen_shm);
shm_delete(&snaprect_shm);
} else {
shm_clean(&scanline_shm, scanline);
shm_clean(&fullscreen_shm, fullscreen);
shm_clean(&snaprect_shm, snaprect);
}
/*
* Here we have to clean up quite a few shm areas for all
* the possible tile row runs (40 for 1280), not as robust
* as one might like... sometimes need to run ipcrm(1).
*/
for(i=1; i<=ntiles_x; i++) {
if (i > tile_shm_count) {
break;
}
if (quick) {
shm_delete(&tile_row_shm[i]);
} else {
shm_clean(&tile_row_shm[i], tile_row[i]);
}
cnt++;
if (single_copytile_count && i >= single_copytile_count) {
break;
}
}
if (!quiet && cnt > 0) {
rfbLog("deleted %d tile_row polling images.\n", cnt);
}
}
示例11: rfbSendTunnelingCaps
static void
rfbSendTunnelingCaps(rfbClientPtr cl)
{
rfbTunnelingCapsMsg caps;
uint32_t nTypes = 0; /* we don't support tunneling yet */
rfbLog("tightvnc-filetransfer/rfbSendTunnelingCaps\n");
caps.nTunnelTypes = Swap32IfLE(nTypes);
if (rfbWriteExact(cl, (char *)&caps, sz_rfbTunnelingCapsMsg) < 0) {
rfbLogPerror("rfbSendTunnelingCaps: write");
rfbCloseClient(cl);
return;
}
if (nTypes) {
/* Dispatch client input to rfbProcessClientTunnelingType(). */
/* The flow should not reach here as tunneling is not implemented. */
rfbProcessClientTunnelingType(cl);
} else {
rfbSendAuthCaps(cl);
}
}
示例12: InitFileTransfer
void
InitFileTransfer()
{
char* userHome = NULL;
uid_t uid = geteuid();
if(fileTransferInitted)
return;
rfbLog("tightvnc-filetransfer/InitFileTransfer\n");
memset(ftproot, 0, sizeof(ftproot));
userHome = GetHomeDir(uid);
if((userHome != NULL) && (strlen(userHome) != 0)) {
SetFtpRoot(userHome);
FreeHomeDir(userHome);
}
fileTransferEnabled = TRUE;
fileTransferInitted = TRUE;
}
示例13: rfbConnect
int
rfbConnect(rfbScreenInfoPtr rfbScreen,
char *host,
int port)
{
int sock;
int one = 1;
rfbLog("Making connection to client on host %s port %d\n",
host,port);
if ((sock = rfbConnectToTcpAddr(host, port)) < 0) {
rfbLogPerror("connection failed");
return -1;
}
#ifndef WIN32
if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) {
rfbLogPerror("fcntl failed");
closesocket(sock);
return -1;
}
#endif
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
(char *)&one, sizeof(one)) < 0) {
rfbLogPerror("setsockopt failed");
closesocket(sock);
return -1;
}
/* AddEnabledDevice(sock); */
FD_SET(sock, &rfbScreen->allFds);
rfbScreen->maxFd = max(sock,rfbScreen->maxFd);
return sock;
}
示例14: rfbVncAuthNone
static void
rfbVncAuthNone(rfbClientPtr cl)
{
/* The built-in Mac OS X VNC client behaves in a non-conforming fashion
* when the server version is 3.7 or later AND the list of security types
* sent to the OS X client contains the 'None' authentication type AND
* the OS X client sends back the 'None' type as its choice. In this case,
* and this case ONLY, the built-in Mac OS X VNC client will NOT send the
* ClientInit message and instead will behave as though an implicit
* ClientInit message containing a shared-flag of true has been sent.
* The special state RFB_INITIALISATION_SHARED represents this case.
* The Mac OS X VNC client can be detected by checking protocolMinorVersion
* for a value of 889. No other VNC client is known to use this value
* for protocolMinorVersion. */
uint32_t authResult;
/* The built-in Mac OS X VNC client expects to NOT receive a SecurityResult
* message for authentication type 'None'. Since its protocolMinorVersion
* is greater than 7 (it is 889) this case must be tested for specially. */
if (cl->protocolMajorVersion==3 && cl->protocolMinorVersion > 7 && cl->protocolMinorVersion != 889) {
rfbLog("rfbProcessClientSecurityType: returning securityResult for client rfb version >= 3.8\n");
authResult = Swap32IfLE(rfbVncAuthOK);
if (rfbWriteExact(cl, (char *)&authResult, 4) < 0) {
rfbLogPerror("rfbAuthProcessClientMessage: write");
rfbCloseClient(cl);
return;
}
}
cl->state = cl->protocolMinorVersion == 889 ? RFB_INITIALISATION_SHARED : RFB_INITIALISATION;
if (cl->state == RFB_INITIALISATION_SHARED)
/* In this case we must call rfbProcessClientMessage now because
* otherwise we would hang waiting for data to be received from the
* client (the ClientInit message which will never come). */
rfbProcessClientMessage(cl);
return;
}
示例15: CloseUndoneFileTransfer
void
CloseUndoneFileTransfer(rfbClientPtr cl, rfbTightClientPtr rtcp)
{
/* TODO :: File Upload case is not handled currently */
/* TODO :: In case of concurrency we need to use Critical Section */
if(cl == NULL)
return;
if(rtcp->rcft.rcfu.uploadInProgress == TRUE) {
rtcp->rcft.rcfu.uploadInProgress = FALSE;
if(rtcp->rcft.rcfu.uploadFD != -1) {
close(rtcp->rcft.rcfu.uploadFD);
rtcp->rcft.rcfu.uploadFD = -1;
}
if(unlink(rtcp->rcft.rcfu.fName) == -1) {
rfbLog("File [%s]: Method [%s]: Delete operation on file <%s> failed\n",
__FILE__, __FUNCTION__, rtcp->rcft.rcfu.fName);
}
memset(rtcp->rcft.rcfu.fName, 0 , PATH_MAX);
}
if(rtcp->rcft.rcfd.downloadInProgress == TRUE) {
rtcp->rcft.rcfd.downloadInProgress = FALSE;
if(rtcp->rcft.rcfd.downloadFD != -1) {
close(rtcp->rcft.rcfd.downloadFD);
rtcp->rcft.rcfd.downloadFD = -1;
}
memset(rtcp->rcft.rcfd.fName, 0 , PATH_MAX);
}
}