⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vncextinit.cc

📁 Informix Table extraction queries have been optimized
💻 CC
📖 第 1 页 / 共 2 页
字号:
  register char n;  REQUEST(xVncExtSetParamReq);  swaps(&stuff->length, n);  REQUEST_AT_LEAST_SIZE(xVncExtSetParamReq);  return ProcVncExtSetParam(client);}static int ProcVncExtGetParam(ClientPtr client){  REQUEST(xVncExtGetParamReq);  REQUEST_FIXED_SIZE(xVncExtGetParamReq, stuff->paramLen);  CharArray param(stuff->paramLen+1);  strncpy(param.buf, (char*)&stuff[1], stuff->paramLen);  param.buf[stuff->paramLen] = 0;  xVncExtGetParamReply rep;  int n;  rep.type = X_Reply;  rep.sequenceNumber = client->sequence;  rep.success = 0;  int len = 0;  char* value = 0;  rfb::VoidParameter* p = rfb::Configuration::getParam(param.buf);  // Hack to avoid exposing password!  if (strcasecmp(param.buf, "Password") == 0)    p = 0;  if (p) {    value = p->getValueStr();    rep.success = 1;    len = value ? strlen(value) : 0;  }  rep.length = (len + 3) >> 2;  rep.valueLen = len;  if (client->swapped) {    swaps(&rep.sequenceNumber, n);    swapl(&rep.length, n);    swaps(&rep.valueLen, n);  }  WriteToClient(client, sizeof(xVncExtGetParamReply), (char *)&rep);  if (value)    WriteToClient(client, len, value);  delete [] value;  return (client->noClientException);}static int SProcVncExtGetParam(ClientPtr client){  register char n;  REQUEST(xVncExtGetParamReq);  swaps(&stuff->length, n);  REQUEST_AT_LEAST_SIZE(xVncExtGetParamReq);  return ProcVncExtGetParam(client);}static int ProcVncExtGetParamDesc(ClientPtr client){  REQUEST(xVncExtGetParamDescReq);  REQUEST_FIXED_SIZE(xVncExtGetParamDescReq, stuff->paramLen);  CharArray param(stuff->paramLen+1);  strncpy(param.buf, (char*)&stuff[1], stuff->paramLen);  param.buf[stuff->paramLen] = 0;  xVncExtGetParamDescReply rep;  int n;  rep.type = X_Reply;  rep.sequenceNumber = client->sequence;  rep.success = 0;  int len = 0;  const char* desc = 0;  rfb::VoidParameter* p = rfb::Configuration::getParam(param.buf);  if (p) {    desc = p->getDescription();    rep.success = 1;    len = desc ? strlen(desc) : 0;  }  rep.length = (len + 3) >> 2;  rep.descLen = len;  if (client->swapped) {    swaps(&rep.sequenceNumber, n);    swapl(&rep.length, n);    swaps(&rep.descLen, n);  }  WriteToClient(client, sizeof(xVncExtGetParamDescReply), (char *)&rep);  if (desc)    WriteToClient(client, len, (char*)desc);  return (client->noClientException);}static int SProcVncExtGetParamDesc(ClientPtr client){  register char n;  REQUEST(xVncExtGetParamDescReq);  swaps(&stuff->length, n);  REQUEST_AT_LEAST_SIZE(xVncExtGetParamDescReq);  return ProcVncExtGetParamDesc(client);}static int ProcVncExtListParams(ClientPtr client){  REQUEST(xVncExtListParamsReq);  REQUEST_SIZE_MATCH(xVncExtListParamsReq);  xVncExtListParamsReply rep;  int n;  rep.type = X_Reply;  rep.sequenceNumber = client->sequence;  int nParams = 0;  int len = 0;  for (ParameterIterator i(Configuration::global()); i.param; i.next()) {    int l = strlen(i.param->getName());    if (l <= 255) {      nParams++;      len += l + 1;    }  }  rep.length = (len + 3) >> 2;  rep.nParams = nParams;  if (client->swapped) {    swaps(&rep.sequenceNumber, n);    swapl(&rep.length, n);    swaps(&rep.nParams, n);  }  WriteToClient(client, sizeof(xVncExtListParamsReply), (char *)&rep);  rdr::U8* data = new rdr::U8[len];  rdr::U8* ptr = data;  for (ParameterIterator i(Configuration::global()); i.param; i.next()) {    int l = strlen(i.param->getName());    if (l <= 255) {      *ptr++ = l;      memcpy(ptr, i.param->getName(), l);      ptr += l;    }  }  WriteToClient(client, len, (char*)data);  delete [] data;  return (client->noClientException);}static int SProcVncExtListParams(ClientPtr client){  register char n;  REQUEST(xVncExtListParamsReq);  swaps(&stuff->length, n);  REQUEST_SIZE_MATCH(xVncExtListParamsReq);  return ProcVncExtListParams(client);}static int ProcVncExtSetServerCutText(ClientPtr client){  REQUEST(xVncExtSetServerCutTextReq);  REQUEST_FIXED_SIZE(xVncExtSetServerCutTextReq, stuff->textLen);  char* str = new char[stuff->textLen+1];  strncpy(str, (char*)&stuff[1], stuff->textLen);  str[stuff->textLen] = 0;  for (int scr = 0; scr < screenInfo.numScreens; scr++) {    if (desktop[scr]) {      desktop[scr]->serverCutText(str, stuff->textLen);    }  }  delete [] str;  return (client->noClientException);}static int SProcVncExtSetServerCutText(ClientPtr client){  register char n;  REQUEST(xVncExtSetServerCutTextReq);  swaps(&stuff->length, n);  REQUEST_AT_LEAST_SIZE(xVncExtSetServerCutTextReq);  swapl(&stuff->textLen, n);  return ProcVncExtSetServerCutText(client);}static int ProcVncExtGetClientCutText(ClientPtr client){  REQUEST(xVncExtGetClientCutTextReq);  REQUEST_SIZE_MATCH(xVncExtGetClientCutTextReq);  xVncExtGetClientCutTextReply rep;  int n;  rep.type = X_Reply;  rep.length = (clientCutTextLen + 3) >> 2;  rep.sequenceNumber = client->sequence;  rep.textLen = clientCutTextLen;  if (client->swapped) {    swaps(&rep.sequenceNumber, n);    swapl(&rep.length, n);    swapl(&rep.textLen, n);  }  WriteToClient(client, sizeof(xVncExtGetClientCutTextReply), (char *)&rep);  if (clientCutText)    WriteToClient(client, clientCutTextLen, clientCutText);  return (client->noClientException);}static int SProcVncExtGetClientCutText(ClientPtr client){  register char n;  REQUEST(xVncExtGetClientCutTextReq);  swaps(&stuff->length, n);  REQUEST_SIZE_MATCH(xVncExtGetClientCutTextReq);  return ProcVncExtGetClientCutText(client);}static int ProcVncExtSelectInput(ClientPtr client){  REQUEST(xVncExtSelectInputReq);  REQUEST_SIZE_MATCH(xVncExtSelectInputReq);  VncInputSelect** nextPtr = &vncInputSelectHead;  VncInputSelect* cur;  for (cur = vncInputSelectHead; cur; cur = *nextPtr) {    if (cur->client == client && cur->window == stuff->window) {      cur->mask = stuff->mask;      if (!cur->mask) {        *nextPtr = cur->next;        delete cur;      }      break;    }    nextPtr = &cur->next;  }  if (!cur) {    cur = new VncInputSelect(client, stuff->window, stuff->mask);  }  return (client->noClientException);}static int SProcVncExtSelectInput(ClientPtr client){  register char n;  REQUEST(xVncExtSelectInputReq);  swaps(&stuff->length, n);  REQUEST_SIZE_MATCH(xVncExtSelectInputReq);  swapl(&stuff->window, n);  swapl(&stuff->mask, n);  return ProcVncExtSelectInput(client);}static int ProcVncExtConnect(ClientPtr client){  REQUEST(xVncExtConnectReq);  REQUEST_FIXED_SIZE(xVncExtConnectReq, stuff->strLen);  CharArray str(stuff->strLen+1);  strncpy(str.buf, (char*)&stuff[1], stuff->strLen);  str.buf[stuff->strLen] = 0;  xVncExtConnectReply rep;  rep.success = 0;  if (desktop[0]) {    if (stuff->strLen == 0) {      try {        desktop[0]->disconnectClients();        rep.success = 1;      } catch (rdr::Exception& e) {        vlog.error("Disconnecting all clients: %s",e.str());      }    } else {      int port = 5500;      for (int i = 0; i < stuff->strLen; i++) {        if (str.buf[i] == ':') {          port = atoi(&str.buf[i+1]);          str.buf[i] = 0;          break;        }      }      try {        network::Socket* sock = new network::TcpSocket(str.buf, port);        desktop[0]->addClient(sock, true);	rep.success = 1;      } catch (rdr::Exception& e) {        vlog.error("Reverse connection: %s",e.str());      }    }  }  rep.type = X_Reply;  rep.length = 0;  rep.sequenceNumber = client->sequence;  if (client->swapped) {    int n;    swaps(&rep.sequenceNumber, n);    swapl(&rep.length, n);  }  WriteToClient(client, sizeof(xVncExtConnectReply), (char *)&rep);  return (client->noClientException);}static int SProcVncExtConnect(ClientPtr client){  register char n;  REQUEST(xVncExtConnectReq);  swaps(&stuff->length, n);  REQUEST_AT_LEAST_SIZE(xVncExtConnectReq);  return ProcVncExtConnect(client);}static int ProcVncExtGetQueryConnect(ClientPtr client){  REQUEST(xVncExtGetQueryConnectReq);  REQUEST_SIZE_MATCH(xVncExtGetQueryConnectReq);  const char *qcAddress=0, *qcUsername=0;  int qcTimeout;  if (queryConnectDesktop)    qcTimeout = queryConnectDesktop->getQueryTimeout(queryConnectId,                                                     &qcAddress, &qcUsername);  else    qcTimeout = 0;  xVncExtGetQueryConnectReply rep;  int n;  rep.type = X_Reply;  rep.sequenceNumber = client->sequence;  rep.timeout = qcTimeout;  rep.addrLen = qcTimeout ? strlen(qcAddress) : 0;  rep.userLen = qcTimeout ? strlen(qcUsername) : 0;  rep.opaqueId = (CARD32)queryConnectId;  rep.length = (rep.userLen + rep.addrLen + 3) >> 2;  if (client->swapped) {    swaps(&rep.sequenceNumber, n);    swapl(&rep.userLen, n);    swapl(&rep.addrLen, n);    swapl(&rep.timeout, n);    swapl(&rep.opaqueId, n);  }  WriteToClient(client, sizeof(xVncExtGetQueryConnectReply), (char *)&rep);  if (qcTimeout)    WriteToClient(client, strlen(qcAddress), (char*)qcAddress);  if (qcTimeout)    WriteToClient(client, strlen(qcUsername), (char*)qcUsername);  return (client->noClientException);}static int SProcVncExtGetQueryConnect(ClientPtr client){  register char n;  REQUEST(xVncExtGetQueryConnectReq);  swaps(&stuff->length, n);  REQUEST_SIZE_MATCH(xVncExtGetQueryConnectReq);  return ProcVncExtGetQueryConnect(client);}static int ProcVncExtApproveConnect(ClientPtr client){  REQUEST(xVncExtApproveConnectReq);  REQUEST_SIZE_MATCH(xVncExtApproveConnectReq);  if (queryConnectId == (void*)stuff->opaqueId) {    for (int scr = 0; scr < screenInfo.numScreens; scr++) {      if (desktop[scr]) {        desktop[scr]->approveConnection(queryConnectId, stuff->approve,                                        "Connection rejected by local user");      }    }    // Inform other clients of the event and tidy up    vncQueryConnect(queryConnectDesktop, queryConnectId);  }  return (client->noClientException);}static int SProcVncExtApproveConnect(ClientPtr client){  register char n;  REQUEST(xVncExtApproveConnectReq);  swaps(&stuff->length, n);  swapl(&stuff->opaqueId, n);  REQUEST_SIZE_MATCH(xVncExtApproveConnectReq);  return ProcVncExtApproveConnect(client);}static int ProcVncExtDispatch(ClientPtr client){  REQUEST(xReq);  switch (stuff->data) {  case X_VncExtSetParam:    return ProcVncExtSetParam(client);  case X_VncExtGetParam:    return ProcVncExtGetParam(client);  case X_VncExtGetParamDesc:    return ProcVncExtGetParamDesc(client);  case X_VncExtListParams:    return ProcVncExtListParams(client);  case X_VncExtSetServerCutText:    return ProcVncExtSetServerCutText(client);  case X_VncExtGetClientCutText:    return ProcVncExtGetClientCutText(client);  case X_VncExtSelectInput:    return ProcVncExtSelectInput(client);  case X_VncExtConnect:    return ProcVncExtConnect(client);  case X_VncExtGetQueryConnect:    return ProcVncExtGetQueryConnect(client);  case X_VncExtApproveConnect:    return ProcVncExtApproveConnect(client);  default:    return BadRequest;  }}static int SProcVncExtDispatch(ClientPtr client){  REQUEST(xReq);  switch (stuff->data) {  case X_VncExtSetParam:    return SProcVncExtSetParam(client);  case X_VncExtGetParam:    return SProcVncExtGetParam(client);  case X_VncExtGetParamDesc:    return SProcVncExtGetParamDesc(client);  case X_VncExtListParams:    return SProcVncExtListParams(client);  case X_VncExtSetServerCutText:    return SProcVncExtSetServerCutText(client);  case X_VncExtGetClientCutText:    return SProcVncExtGetClientCutText(client);  case X_VncExtSelectInput:    return SProcVncExtSelectInput(client);  case X_VncExtConnect:    return SProcVncExtConnect(client);  case X_VncExtGetQueryConnect:    return SProcVncExtGetQueryConnect(client);  case X_VncExtApproveConnect:    return SProcVncExtApproveConnect(client);  default:    return BadRequest;  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -