int
CommSvc_Alloc(const CommTranspInitArgs *transpArgs,
              const CommImpl *impl,
              int inBH,
              CommChannel *newChannel)
{
   return Comm_Alloc(transpArgs, impl, inBH, newChannel);
}
예제 #2
0
static int
DefaultTranspListener(CommTranspInitArgs *transpArgs,
		      void *probeData)
{
	int rc = -1;
	const int inBH = 1;
	const CommImpl *impl;

	if (!transpArgs || !probeData) {
		commos_debug("%s: NULL args [0x%p, 0x%p].\n",
			      __func__, transpArgs, probeData);
		goto out;
	}

	impl = probeData;
	commos_debug("%s: Received attach info [%u,%u,%u:%u].\n",
		     __func__,
		     transpArgs->capacity, transpArgs->type,
		     transpArgs->id.d32[0], transpArgs->id.d32[1]);

	if (impl->checkArgs(transpArgs))
		goto out;

	transpArgs->mode = COMM_TRANSP_INIT_ATTACH; /* Ensure we attach */

	/*
	 * We recognized it, so don't let others waste any time.
	 * Even if we fail.
	 */

	rc = 0;
	if (Comm_Alloc(transpArgs, impl, inBH, NULL)) {
		impl->closeNtf(impl->closeNtfData, transpArgs, inBH);
		commos_info("%s: Can't allocate new channel!\n", __func__);
	}

out:
	return rc;
}