当前位置: 首页>>代码示例>>C++>>正文


C++ DIS_tcp_setup函数代码示例

本文整理汇总了C++中DIS_tcp_setup函数的典型用法代码示例。如果您正苦于以下问题:C++ DIS_tcp_setup函数的具体用法?C++ DIS_tcp_setup怎么用?C++ DIS_tcp_setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DIS_tcp_setup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PBSD_msg_put

int
PBSD_msg_put(int c, char *jobid, int fileopt, char *msg, char *extend, int rpp, char **msgid)
{
	int rc = 0;
	int sock;

	if (!rpp) {
		sock = connection[c].ch_socket;
		DIS_tcp_setup(sock);
	} else {
		sock = c;
		if ((rc = is_compose_cmd(sock, IS_CMD, msgid)) != DIS_SUCCESS)
			return rc;
	}

	if ((rc = encode_DIS_ReqHdr(sock, PBS_BATCH_MessJob,
		pbs_current_user)) ||
		(rc = encode_DIS_MessageJob(sock, jobid, fileopt, msg)) ||
		(rc = encode_DIS_ReqExtend(sock, extend))) {
		return (pbs_errno = PBSE_PROTOCOL);
	}
	if (DIS_wflush(sock, rpp)) {
		pbs_errno = PBSE_PROTOCOL;
		rc	  = pbs_errno;
	}

	return rc;
}
开发者ID:A9-William,项目名称:pbspro,代码行数:28,代码来源:int_msg2.c

示例2: PBS_resc

/**
 * @brief
 * 	-PBS_resc() - internal common code for sending resource requests
 *
 * @par Functionality:
 *	Formats and sends the requests for pbs_rescquery(), pbs_rescreserve(),
 *	and pbs_rescfree().   Note, while the request is overloaded for all
 *	three, each has its own expected reply format.
 *
 * @param[in] c - communication handle
 * @param[in] reqtype - request type
 * @param[in] rescl- pointer to resource list
 * @param[in] ct - count of query strings
 * @param[in] rh - resource handle
 *
 * @return      int
 * @retval      0       success
 * @retval      !0      error
 *
 */
static int
PBS_resc(int c, int reqtype, char **rescl, int ct, pbs_resource_t rh)
{
	int rc;
	int sock;

	sock = connection[c].ch_socket;

	/* setup DIS support routines for following DIS calls */

	DIS_tcp_setup(sock);

	if ((rc = encode_DIS_ReqHdr(sock, reqtype, pbs_current_user)) ||
		(rc = encode_DIS_Resc(sock, rescl, ct, rh)) ||
		(rc = encode_DIS_ReqExtend(sock, (char *)0))) {
		connection[c].ch_errtxt = strdup(dis_emsg[rc]);
		if (connection[c].ch_errtxt == NULL) {
			pbs_errno = PBSE_SYSTEM;
		} else {
			pbs_errno = PBSE_PROTOCOL;
		}
		return (pbs_errno);
	}
	if (DIS_tcp_wflush(sock)) {
		return (pbs_errno = PBSE_PROTOCOL);
	}
	return (0);
}
开发者ID:A9-William,项目名称:pbspro,代码行数:48,代码来源:pbsD_resc.c

示例3: dis_reply_write

static int dis_reply_write(

  int                 sfds,    /* I */
  struct batch_reply *preply)  /* I */

  {
  int              rc = PBSE_NONE;
  char             log_buf[LOCAL_LOG_BUF_SIZE];
  struct tcp_chan *chan = NULL;

  /* setup for DIS over tcp */
  if ((chan = DIS_tcp_setup(sfds)) == NULL)
    {
    }

  /* send message to remote client */
  else if ((rc = encode_DIS_reply(chan, preply)) ||
           (rc = DIS_tcp_wflush(chan)))
    {
    sprintf(log_buf, "DIS reply failure, %d", rc);

    log_event(PBSEVENT_SYSTEM, PBS_EVENTCLASS_REQUEST, __func__, log_buf);

    /* don't need to get the lock here because we already have it from process request */
    close_conn(sfds, FALSE);
    }

  if (chan != NULL)
    DIS_tcp_cleanup(chan);

  return(rc);
  }  /* END dis_reply_write() */
开发者ID:dbeer,项目名称:torque,代码行数:32,代码来源:reply_send.c

示例4: PBSD_py_spawn_put

int
PBSD_py_spawn_put(int c, char *jobid, char **argv, char **envp, int rpp, char **msgid)
{
	int rc = 0;
	int sock;

	if (!rpp) {
		sock = connection[c].ch_socket;
		DIS_tcp_setup(sock);
	} else {
		sock = c;
		if ((rc = is_compose_cmd(sock, IS_CMD, msgid)) != DIS_SUCCESS)
			return rc;
	}

	if ((rc = encode_DIS_ReqHdr(sock, PBS_BATCH_PySpawn,
		pbs_current_user)) ||
		(rc = encode_DIS_PySpawn(sock, jobid, argv, envp)) ||
		(rc = encode_DIS_ReqExtend(sock, NULL))) {
			return (pbs_errno = PBSE_PROTOCOL);
	}

	if (DIS_wflush(sock, rpp)) {
		pbs_errno = PBSE_PROTOCOL;
		rc = pbs_errno;
	}

	return rc;
}
开发者ID:A9-William,项目名称:pbspro,代码行数:29,代码来源:int_msg2.c

示例5: PBSD_rdrpy_sock

/**
 * @brief read a batch reply from the given socket
 *
 * @param[in] sock - The socket fd to read from
 * @param[out] rc  - Return DIS error code
 *
 * @return Batch reply structure
 * @retval  !NULL - Success
 * @retval   NULL - Failure
 *
 */
struct batch_reply *
PBSD_rdrpy_sock(int sock, int *rc)
{
	struct batch_reply *reply;
	time_t old_timeout;

	*rc = DIS_SUCCESS;
	/* clear any prior error message */
	if ((reply = (struct batch_reply *)malloc(sizeof(struct batch_reply))) == 0) {
		pbs_errno = PBSE_SYSTEM;
		return ((struct batch_reply *)0);
	}
	(void)memset(reply, 0, sizeof(struct batch_reply));

	DIS_tcp_setup(sock);
	old_timeout = pbs_tcp_timeout;
	if (pbs_tcp_timeout < PBS_DIS_TCP_TIMEOUT_LONG)
		pbs_tcp_timeout = PBS_DIS_TCP_TIMEOUT_LONG;

	if ((*rc = decode_DIS_replyCmd(sock, reply)) != 0) {
		(void)free(reply);
		pbs_errno = PBSE_PROTOCOL;
		return (struct batch_reply *)NULL;
	}
	DIS_tcp_reset(sock, 0);		/* reset DIS read buffer */
	pbs_tcp_timeout = old_timeout;

	pbs_errno = reply->brp_code;
	return reply;
}
开发者ID:A9-William,项目名称:pbspro,代码行数:41,代码来源:int_rdrpy.c

示例6: pbs_disconnect

int pbs_disconnect(

  int connect)  /* I (socket descriptor) */

  {
  int  sock;

  /* send close-connection message */

  sock = connection[connect].ch_socket;

  DIS_tcp_setup(sock);

  if (encode_DIS_ReqHdr(sock, PBS_BATCH_Disconnect, pbs_current_user) == 0)
    {
    DIS_tcp_wflush(sock);
    }
  close(sock);

  DIS_tcp_release(sock);

  if (connection[connect].ch_errtxt != (char *)NULL)
    free(connection[connect].ch_errtxt);

  connection[connect].ch_errno = 0;

  connection[connect].ch_inuse = 0;

  return(0);
  }  /* END pbs_disconnect() */
开发者ID:CESNET,项目名称:torque,代码行数:30,代码来源:pbsD_connect.c

示例7: addrm

static int addrm(

  int stream)  /* I */

  {

  struct out *op, **head;

  if ((op = (struct out *)calloc(1, sizeof(struct out))) == NULL)
    {
    return(errno);
    }
  else if ((op->chan = DIS_tcp_setup(stream)) == NULL)
    {
    free(op);
    return errno;
    }

  head = &outs[stream % HASHOUT];

  op->len = -1;
  op->next = *head;
  *head = op;
  return 0;
  }
开发者ID:AlbertDeFusco,项目名称:torque,代码行数:25,代码来源:rm.c

示例8: dis_reply_write

static int dis_reply_write(

  int                 sfds,    /* I */
  struct batch_reply *preply)  /* I */

  {
  int rc;

  /* setup for DIS over tcp */

  DIS_tcp_setup(sfds);

  /* send message to remote client */

  if ((rc = encode_DIS_reply(sfds, preply)) ||
      (rc = DIS_tcp_wflush(sfds)))
    {
    sprintf(log_buffer, "DIS reply failure, %d",
            rc);

    LOG_EVENT(
      PBSEVENT_SYSTEM,
      PBS_EVENTCLASS_REQUEST,
      "dis_reply_write",
      log_buffer);

    close_conn(sfds);
    }

  return(rc);
  }  /* END dis_reply_write() */
开发者ID:Johnlihj,项目名称:torque,代码行数:31,代码来源:reply_send.c

示例9: __pbs_orderjob

int
__pbs_orderjob(int c, char *job1, char *job2, char *extend)
{
	struct batch_reply *reply;
	int rc;
	int sock;


	if ((job1 == NULL) || (*job1 == '\0') ||
		(job2 == NULL) || (*job2 == '\0'))
		return (pbs_errno = PBSE_IVALREQ);

	sock = connection[c].ch_socket;

	/* initialize the thread context data, if not already initialized */
	if (pbs_client_thread_init_thread_context() != 0)
		return pbs_errno;

	/* lock pthread mutex here for this connection */
	/* blocking call, waits for mutex release */
	if (pbs_client_thread_lock_connection(c) != 0)
		return pbs_errno;

	/* setup DIS support routines for following DIS calls */

	DIS_tcp_setup(sock);

	if ((rc = encode_DIS_ReqHdr(sock, PBS_BATCH_OrderJob, pbs_current_user)) ||
		(rc = encode_DIS_MoveJob(sock, job1, job2)) ||
		(rc = encode_DIS_ReqExtend(sock, extend))) {
		connection[c].ch_errtxt = strdup(dis_emsg[rc]);
		if (connection[c].ch_errtxt == NULL) {
			pbs_errno = PBSE_SYSTEM;
		} else {
			pbs_errno = PBSE_PROTOCOL;
		}
		(void)pbs_client_thread_unlock_connection(c);
		return pbs_errno;
	}
	if (DIS_tcp_wflush(sock)) {
		pbs_errno = PBSE_PROTOCOL;
		(void)pbs_client_thread_unlock_connection(c);
		return pbs_errno;
	}

	/* read reply */

	reply = PBSD_rdrpy(c);

	PBSD_FreeReply(reply);

	rc = connection[c].ch_errno;

	/* unlock the thread lock and update the thread context data */
	if (pbs_client_thread_unlock_connection(c) != 0)
		return pbs_errno;

	return rc;
}
开发者ID:Bhagat-Rajput,项目名称:pbspro,代码行数:59,代码来源:pbsD_orderjo.c

示例10: parse_response_svr

int parse_response_svr(
    int sock,
    char **err_msg)
  {
  /*
   * PBS_BATCH_PROT_TYPE
   * PBS_BATCH_PROT_VER
   * reply->brp_code
   * reply->brp_auxcode
   * reply->brp_choice
   * if reply->brp_choice == BATCH_REPLY_CHOICE_Text also read:
   * preq->rq_reply.brp_un.brp_txt.brp_str
   * using
   * preq->rq_reply.brp_un.brp_txt.brp_txtlen
   */
  int rc = PBSE_NONE;
  struct batch_reply *reply = NULL;
  char *tmp_val = NULL;
  struct tcp_chan *chan = NULL;
  if ((chan = DIS_tcp_setup(sock)) == NULL)
    {
    }
  else if ((reply = (struct batch_reply *)calloc(1, sizeof(struct batch_reply))) == NULL)
    {
    }
  else if ((rc = decode_DIS_replyCmd(chan, reply)))
    {
    free(reply);
    if (chan->IsTimeout == TRUE)
      {
      rc = PBSE_TIMEOUT;
      }
    else
      {
      rc = PBSE_PROTOCOL;
      }
    if ((tmp_val = pbs_strerror(rc)) == NULL)
      {
      char err_buf[80];
      snprintf(err_buf, 79, "Error creating error message for code %d", rc);
      *err_msg = strdup(err_buf);
      }
    else
      *err_msg = strdup(tmp_val);
    }
  else
    {
    rc = reply->brp_code;
    if (reply->brp_code != PBSE_NONE)
      {
      *err_msg = strdup(reply->brp_un.brp_txt.brp_str);
      }
    free(reply);
    }
  DIS_tcp_cleanup(chan);
  return rc;
  }
开发者ID:adaptivecomputing,项目名称:torque-old,代码行数:57,代码来源:trq_auth.c

示例11: return

void *start_process_request(void *vp)
  {
  int sock = *(int *)vp;
  struct tcp_chan *chan = NULL;
  if ((chan = DIS_tcp_setup(sock)) == NULL)
    return NULL;
  process_request(chan);
  DIS_tcp_cleanup(chan);
  return(NULL);
  }
开发者ID:actorquedeveloper,项目名称:torque,代码行数:10,代码来源:run_sched.c

示例12: PBSD_selectattr_put

int PBSD_selectattr_put(

  int             c,
  int             type,
  struct attropl *attropl,
  struct attrl   *attrib,
  char           *extend)

  {
  int rc = PBSE_NONE;
  int sock;
  struct tcp_chan *chan = NULL;
  
  if ((c < 0) || 
      (c >= PBS_NET_MAX_CONNECTIONS))
    {
    return(PBSE_IVALREQ);
    }

  pthread_mutex_lock(connection[c].ch_mutex);

  sock = connection[c].ch_socket;

  /* setup DIS support routines for following DIS calls */

  if ((chan = DIS_tcp_setup(sock)) == NULL)
    {
    pthread_mutex_unlock(connection[c].ch_mutex);
    rc = PBSE_PROTOCOL;
    return rc;
    }
  else if ((rc = encode_DIS_ReqHdr(chan, type, pbs_current_user)) ||
      (rc = encode_DIS_attropl(chan, attropl)) ||
      (rc = encode_DIS_attrl(chan, attrib)) ||
      (rc = encode_DIS_ReqExtend(chan, extend)))
    {
    connection[c].ch_errtxt = strdup(dis_emsg[rc]);

    pthread_mutex_unlock(connection[c].ch_mutex);
    DIS_tcp_cleanup(chan);
    return (PBSE_PROTOCOL);
    }

  pthread_mutex_unlock(connection[c].ch_mutex);

  /* write data */

  if (DIS_tcp_wflush(chan))
    {
    rc = PBSE_PROTOCOL;
    }

  DIS_tcp_cleanup(chan);
  return rc;
  } /* END PBSD_selectattr_put() */
开发者ID:adaptivecomputing,项目名称:torque,代码行数:55,代码来源:pbsD_selectj.c

示例13: PBSD_rdytocmt

int PBSD_rdytocmt(

  int   connect,
  char *jobid)

  {
  int                 rc;

  struct batch_reply *reply;
  int                 sock;
  struct tcp_chan *chan = NULL;
  
  if ((connect < 0) || 
      (connect >= PBS_NET_MAX_CONNECTIONS))
    {
    return(PBSE_IVALREQ);
    }

  pthread_mutex_lock(connection[connect].ch_mutex);
  sock = connection[connect].ch_socket;
  pthread_mutex_unlock(connection[connect].ch_mutex);

  if ((chan = DIS_tcp_setup(sock)) == NULL)
    {
    return(PBSE_MEM_MALLOC);
    }
  else if ((rc = encode_DIS_ReqHdr(chan, PBS_BATCH_RdytoCommit, pbs_current_user)) ||
      (rc = encode_DIS_JobId(chan, jobid)) ||
      (rc = encode_DIS_ReqExtend(chan, NULL)))
    {
    pthread_mutex_lock(connection[connect].ch_mutex);
    connection[connect].ch_errtxt = strdup(dis_emsg[rc]);
    pthread_mutex_unlock(connection[connect].ch_mutex);
    DIS_tcp_cleanup(chan);
    return(PBSE_PROTOCOL);
    }

  if (DIS_tcp_wflush(chan))
    {
    DIS_tcp_cleanup(chan);
    return(PBSE_PROTOCOL);
    }
  DIS_tcp_cleanup(chan);

  /* read reply */

  reply = PBSD_rdrpy(&rc, connect);

  PBSD_FreeReply(reply);

  return(rc);
  }
开发者ID:ansonl,项目名称:torque,代码行数:52,代码来源:PBSD_submit_caps.c

示例14: PBSD_ucred

int
PBSD_ucred(int c, char *user, int type, char *buf, int len)
{
	int			rc;
	struct batch_reply	*reply = NULL;
	int			sock;

	sock = connection[c].ch_socket;

	/* initialize the thread context data, if not already initialized */
	if (pbs_client_thread_init_thread_context() != 0)
		return pbs_errno;

	/* lock pthread mutex here for this connection */
	/* blocking call, waits for mutex release */
	if (pbs_client_thread_lock_connection(c) != 0)
		return pbs_errno;

	DIS_tcp_setup(sock);

	if ((rc =encode_DIS_ReqHdr(sock, PBS_BATCH_UserCred, pbs_current_user)) ||
		(rc = encode_DIS_UserCred(sock, user, type, buf, len)) ||
		(rc = encode_DIS_ReqExtend(sock, (char *)0))) {
		connection[c].ch_errtxt = strdup(dis_emsg[rc]);
		if (connection[c].ch_errtxt == NULL) {
			pbs_errno = PBSE_SYSTEM;
		} else {
			pbs_errno = PBSE_PROTOCOL;
		}
		(void)pbs_client_thread_unlock_connection(c);
		return pbs_errno;
	}
	if (DIS_tcp_wflush(sock)) {
		pbs_errno = PBSE_PROTOCOL;
		(void)pbs_client_thread_unlock_connection(c);
		return pbs_errno;
	}

	reply = PBSD_rdrpy(c);

	PBSD_FreeReply(reply);

	rc = connection[c].ch_errno;

	/* unlock the thread lock and update the thread context data */
	if (pbs_client_thread_unlock_connection(c) != 0)
		return pbs_errno;

	return rc;
}
开发者ID:A9-William,项目名称:pbspro,代码行数:50,代码来源:int_ucred.c

示例15: PBSD_status_put

int PBSD_status_put(

    int           c,
    int           function,
    char         *id,
    struct attrl *attrib,
    char         *extend)

{
    int rc = 0;
    int sock;
    struct tcp_chan *chan = NULL;

    if ((c < 0) ||
            (c >= PBS_NET_MAX_CONNECTIONS))
    {
        return(PBSE_IVALREQ);
    }

    mutex_mgr ch_mutex = mutex_mgr(connection[c].ch_mutex, false);

    sock = connection[c].ch_socket;

    if ((chan = DIS_tcp_setup(sock)) == NULL)
    {
        rc = PBSE_MEM_MALLOC;
        return rc;
    }
    else if ((rc = encode_DIS_ReqHdr(chan, function, pbs_current_user)) ||
             (rc = encode_DIS_Status(chan, id, attrib)) ||
             (rc = encode_DIS_ReqExtend(chan, extend)))
    {
        connection[c].ch_errtxt = strdup(dis_emsg[rc]);

        DIS_tcp_cleanup(chan);
        return(PBSE_PROTOCOL);
    }

    ch_mutex.unlock();

    if (DIS_tcp_wflush(chan))
    {
        rc = PBSE_PROTOCOL;
    }

    /* success */

    DIS_tcp_cleanup(chan);
    return(PBSE_NONE);
}  /* END PBSD_status_put() */
开发者ID:gbeane,项目名称:torque,代码行数:50,代码来源:PBSD_status2.c


注:本文中的DIS_tcp_setup函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。