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


C++ soap_malloc函数代码示例

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


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

示例1: setAuthorization

static void setAuthorization(soap *soap, const string &access_token)
{
    soap->header = (SOAP_ENV__Header *)soap_malloc(soap, sizeof(SOAP_ENV__Header));
    //soap->header->oxns__Authorization = (char*)soap_malloc(soap, (access_token.length() + 1)
    //        * sizeof(char));
    //strcpy(soap->header->oxns__Authorization, access_token.c_str());
    soap->header->oxns__Authorization = (char *)access_token.c_str();
}
开发者ID:aalto-cbir,项目名称:PicSOM,代码行数:8,代码来源:CbirGVT.C

示例2: soap_fault

SOAP_FMAC3 void SOAP_FMAC4 soap_fault(struct soap *soap)
{
	if (!soap->fault)
	{	soap->fault = (struct SOAP_ENV__Fault*)soap_malloc(soap, sizeof(struct SOAP_ENV__Fault));
		if (!soap->fault)
			return;
		soap_default_SOAP_ENV__Fault(soap, soap->fault);
	}
	if (soap->version == 2 && !soap->fault->SOAP_ENV__Code)
	{	soap->fault->SOAP_ENV__Code = (struct SOAP_ENV__Code*)soap_malloc(soap, sizeof(struct SOAP_ENV__Code));
		soap_default_SOAP_ENV__Code(soap, soap->fault->SOAP_ENV__Code);
	}
	if (soap->version == 2 && !soap->fault->SOAP_ENV__Reason)
	{	soap->fault->SOAP_ENV__Reason = (struct SOAP_ENV__Reason*)soap_malloc(soap, sizeof(struct SOAP_ENV__Reason));
		soap_default_SOAP_ENV__Reason(soap, soap->fault->SOAP_ENV__Reason);
	}
}
开发者ID:biancini,项目名称:Shibboleth-Authentication,代码行数:17,代码来源:soapC.c

示例3: DBG

static void *dime_write_open(struct soap *soap, const char *id, const char *type, const char *options)
{
	DBG("\n");
	// we can return NULL without setting soap->error if we don't want to use the streaming callback for this DIME attachment
	struct dime_write_handle *handle = (struct dime_write_handle*)soap_malloc(soap, sizeof(struct dime_write_handle));
	if (!handle)
	{
		soap->error = SOAP_EOM;
		return NULL;
	}


#if 0
	char *name = tempnam(TMPDIR, "data");
	fprintf(stderr, "Saving file %s\n", name);
	handle->name = soap_strdup(soap, name);
	free(name);
#else
	time_t t = time(NULL);
	struct tm tm = *localtime(&t);

	char name[64];
	memset(name, '\0', sizeof(name));

	switch(bkev){
	case EVENT_SET_FILENAME_CONFIG:
		sprintf(name, "configuration-%d-%d-%d-%d-%d-%d.conf",
				tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
				tm.tm_hour,	tm.tm_min, tm.tm_sec);
		break;
	case EVENT_SET_FILENAME_FIRMWARE:
		sprintf(name, "firmware-%d-%d-%d-%d-%d-%d.ctfw",
				tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
				tm.tm_hour,	tm.tm_min, tm.tm_sec);
		break;
	default:
		sprintf(name, "%d-%d-%d-%d-%d-%d",
				tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,
				tm.tm_hour,	tm.tm_min, tm.tm_sec);
		break;
	}

	DBG("tmpname: %s\n", name);

	handle->name = soap_strdup(soap, name);
#endif


	handle->fd = fopen(handle->name, "wb");
	if (!handle->fd)
	{
		soap->error = SOAP_EOF; // could not open file for writing
		soap->errnum = errno; // get reason
		return NULL;
	}
	return (void*)handle;
}
开发者ID:eslinux,项目名称:Windows,代码行数:57,代码来源:CenticFirewallApp.cpp

示例4: ns__pow

int ns__pow(struct soap *soap, double a, double b, double *result)
{ *result = pow(a, b);
  if (soap_errno == EDOM)	/* soap_errno is like errno, but compatible with Win32 */
  { char *s = (char*)soap_malloc(soap, 1024);
    sprintf(s, "Can't take the power of %f to %f", a, b);
    return soap_receiver_fault(soap, "Power function domain error", s);
  }
  return SOAP_OK;
} 
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:9,代码来源:calcserver.cpp

示例5: rm_getJobStatus

/**
 * Gets the status of the job. 
 *
 * It maps the different states of PBS jobs to
 * pending and running. It does not make a difference between finished, 
 * cancelled, terminated and unknown jobs since PBS does not store this info.
 * @param jobid is the PID assigned by the queue
 * @return 0 if correct, non-zero if error
 */
int rm_getJobStatus(struct soap* s, char* jobid, char* user, struct bes__ActivityStatusType** jobStatus)
{
   struct bes__ActivityStatusType *activityStatus;
   int connectionIdentifier;
   //! stores the status of a job
   struct batch_status* status;

   if (!jobid || !jobStatus) {
      return BESE_BAD_ARG;
   }
   connectionIdentifier = pbs_connect(server);
   if (!connectionIdentifier)
	   return BESE_BACKEND;
   status = pbs_statjob(connectionIdentifier,jobid,NULL,NULL);
   pbs_disconnect(connectionIdentifier);
   if(status == NULL)
   {
      return BESE_NO_ACTIVITY;
   }
   activityStatus = (struct bes__ActivityStatusType*)soap_malloc(s, sizeof(struct bes__ActivityStatusType));
   if (activityStatus == NULL) {
      return BESE_MEM_ALLOC;
   }
   memset(activityStatus, 0, sizeof(struct bes__ActivityStatusType));
   struct attrl* attrList = status->attribs;
   while (attrList != NULL)
   {
      if(!strcmp(attrList->name, ATTR_state))
      {
        if(!strcmp(attrList->value, "T")) {
           activityStatus->state = Pending;
        }
        else if(!strcmp(attrList->value, "Q")) {
           activityStatus->state = Pending;
        }         
        else if(!strcmp(attrList->value,"H")) {
           activityStatus->state = Pending;
	}         
        else if(!strcmp(attrList->value,"W")){
           activityStatus->state = Pending;
        }         
        else if(!strcmp(attrList->value,"R")){
           activityStatus->state = Running;
        }
        else if(!strcmp(attrList->value,"E")) {
           activityStatus->state = Finished;
        }
        pbs_statfree(status);
	*jobStatus = activityStatus;
        return BESE_OK;
     }
     attrList = attrList->next;
  }
  pbs_statfree(status);
  return BESE_NO_ACTIVITY;
}
开发者ID:saga-project,项目名称:saga-cpp-adaptor-bes,代码行数:65,代码来源:rm_pbs.c

示例6: soap_calloc

 soap_type_t * soap_calloc(struct soap *soap)
 {
     if(NULL == soap)
         throw std::invalid_argument("soap_calloc: soap is a null pointer");
     soap_type_t *ptr;
     if(NULL == (ptr = static_cast<soap_type_t*>(soap_malloc(soap, sizeof(soap_type_t)))))
         throw soap_bad_alloc("soap_calloc(soap)");
     memset(ptr, 0, sizeof(soap_type_t));
     return ptr;
 }
开发者ID:italiangrid,项目名称:storm-client,代码行数:10,代码来源:soap_util.hpp

示例7: ns2__div

int ns2__div(struct soap *soap, double a, double b, double *result)
{ if (b)
    *result = a / b;
  else
  { char *s = (char*)soap_malloc(soap, 1024);
    sprintf(s, "<error xmlns=\"http://tempuri.org/\">Can't divide %f by %f</error>", a, b);
    return soap_sender_fault(soap, "Division by zero", s);
  }
  return SOAP_OK;
} 
开发者ID:yuvalif,项目名称:calc2,代码行数:10,代码来源:calcserver.cpp

示例8: ns2__pow

int ns2__pow(struct soap *soap, double a, double b, double *result)
{ *result = pow(a, b);
  if (soap_errno == EDOM)	/* soap_errno is like errno, but compatible with Win32 */
  { char *s = (char*)soap_malloc(soap, 1024);
    sprintf(s, "Can't take the power of %f to %f", a, b);
    sprintf(s, "<error xmlns=\"http://tempuri.org/\">Can't take power of %f to %f</error>", a, b);
    return soap_sender_fault(soap, "Power function domain error", s);
  }
  return SOAP_OK;
} 
开发者ID:yuvalif,项目名称:calc2,代码行数:10,代码来源:calcserver.cpp

示例9: getdata

static int getdata(struct soap *soap, const char *name, ns__Data& data)
{

	struct stat sb;
	FILE *fd = NULL;
	if (name && !strchr(name, '/') && !strchr(name, '\\') && !strchr(name, ':'))
	{ char *s = (char*)soap_malloc(soap, strlen(TMPDIR) + strlen(name) + 2);
		strcpy(s, TMPDIR);
		strcat(s, "/");
		strcat(s, name);
		fd = fopen(s, "rb");
		if (!fd)
		{ strcpy(s, name);
			fd = fopen(s, "rb");
		}
	}
	if (!fd)
		return SOAP_EOF;
	if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK) // chunked response is possible
	{ data.__ptr = (unsigned char*)fd; // must set to non-NULL (this is our fd handle which we need in the callbacks)
		data.__size = 0; // zero size streams data with HTTP chunking
	}
	else if (!fstat(fileno(fd), &sb) && sb.st_size > 0)
	{ // since we can get the length of the file, we can stream it
		data.__ptr = (unsigned char*)fd; // must set to non-NULL (this is our fd handle which we need in the callbacks)
		data.__size = sb.st_size;
	}
	else // we can't use HTTP chunking and we don't know the size, so buffer it
	{ int i;
		data.__ptr = (unsigned char*)soap_malloc(soap, MAX_FILE_SIZE);
		for (i = 0; i < MAX_FILE_SIZE; i++)
		{ int c;
			if ((c = fgetc(fd)) == EOF)
				break;
			data.__ptr[i] = c;
		}
		fclose(fd);
		data.__size = i;
	}
	data.type = (char*)""; // specify non-NULL id or type to enable DIME
	data.options = soap_dime_option(soap, 0, name);
	return SOAP_OK;
}
开发者ID:eslinux,项目名称:Windows,代码行数:43,代码来源:CenticFirewallApp.cpp

示例10: new_reqList

static struct ns2__requestParameterList* new_reqList(struct soap* soap, char* reqOp, char* paramName, char* comparOp, char* paramValue) {
  struct ns2__requestParameterList* reqList = (struct ns2__requestParameterList*) soap_malloc(soap, sizeof(struct ns2__requestParameterList));
  struct ns2__parameterListItem* listItem = (struct ns2__parameterListItem*) soap_malloc(soap, sizeof(struct ns2__parameterListItem));

  soap_default_ns2__requestParameterList(soap, reqList);
  soap_default_ns2__parameterListItem(soap, listItem);

  reqList->requestAPI = "REQUEST1";
  reqList->requestOperation = reqOp;
  reqList->parameters = listItem;
  reqList->__sizeparameters = 1;
  listItem->comparisonOp = comparOp;
  listItem->parameterValue = soap_malloc(soap, sizeof(char*));
  listItem->parameterValue[0] = paramValue;
  listItem->__sizeparameterValue = 1;
  listItem->parameterName = paramName;

  return reqList;
}
开发者ID:abidinz,项目名称:Stormee,代码行数:19,代码来源:ipaws.c

示例11: ns__div

int ns__div(struct soap *soap, double a, double b, double *result)
{ if (b)
    *result = a / b;
  else
  { char *s = (char*)soap_malloc(soap, 1024);
    sprintf(s, "Can't divide %f by %f", a, b);
    return soap_receiver_fault(soap, "Division by zero", s);
  }
  return SOAP_OK;
} 
开发者ID:xin3liang,项目名称:platform_external_gsoap,代码行数:10,代码来源:calcserver.cpp

示例12: m__EchoTestMultiple

int m__EchoTestMultiple(struct soap *soap, struct x__WrapperType *x__EchoTest, struct m__EchoTestMultipleResponse *response)
{ int i;
  if (!x__EchoTest)
    return soap_sender_fault(soap, "No data", NULL);
  /* allocate response */
  response->x__EchoTest = (struct x__WrapperType*)soap_malloc(soap, sizeof(struct x__WrapperType));
  if (!response->x__EchoTest)
    return SOAP_EOM;
  response->x__EchoTest->__size = x__EchoTest->__size;
  response->x__EchoTest->Data = (struct x__DataType*)soap_malloc(soap, sizeof(struct x__DataType) * x__EchoTest->__size);
  if (!response->x__EchoTest->Data)
    return SOAP_EOM;
  /* copy data into response, switching from base64 to MTOM and vice versa */
  for (i = 0; i < x__EchoTest->__size; ++i)
  { switch (x__EchoTest->Data[i].__union)
    { case SOAP_UNION_x__data_xop__Include:
        /* convert MTOM attachment to base64Binary */
        response->x__EchoTest->Data[i].__union = SOAP_UNION_x__data_base64;
        response->x__EchoTest->Data[i].choice.base64.__ptr = x__EchoTest->Data[i].choice.xop__Include.__ptr;
        response->x__EchoTest->Data[i].choice.base64.__size = x__EchoTest->Data[i].choice.xop__Include.__size;
        response->x__EchoTest->Data[i].xmime5__contentType = x__EchoTest->Data[i].choice.xop__Include.type;
        break;
      case SOAP_UNION_x__data_base64:
        /* convert base64Binary to MTOM attachment */
        response->x__EchoTest->Data[i].__union = SOAP_UNION_x__data_xop__Include;
        response->x__EchoTest->Data[i].choice.xop__Include.__ptr = x__EchoTest->Data[i].choice.base64.__ptr;
        response->x__EchoTest->Data[i].choice.xop__Include.__size = x__EchoTest->Data[i].choice.base64.__size;
        response->x__EchoTest->Data[i].choice.xop__Include.id = NULL;
        response->x__EchoTest->Data[i].choice.xop__Include.type = x__EchoTest->Data[i].xmime5__contentType;
        response->x__EchoTest->Data[i].choice.xop__Include.options = NULL;
        response->x__EchoTest->Data[i].xmime5__contentType = x__EchoTest->Data[i].xmime5__contentType;
#ifdef WITH_NOIDREF
        /* compiling with WITH_NOIDREF removes auto-detection of attachments */
        soap_set_mime(soap, NULL, NULL); /* so we explicitly set MIME attachments */
#endif
        break;
      default:
        return soap_sender_fault(soap, "Wrong data format", NULL);
    }
  }
  return SOAP_OK;
}
开发者ID:allenway,项目名称:onvif,代码行数:42,代码来源:mtom-test.c

示例13: sizeof

int CSetSoapSecurityDigest2Impl::soap_wsse_add_UsernameTokenText(struct soap *soap, 
												  const char *username, const char *password)  
{   
    _wsse__Security *security = soap->header->wsse__Security;  
    /* allocate a UsernameToken if we don't have one already */  
    if (!security->UsernameToken)  
        security->UsernameToken = (_wsse__UsernameToken*)soap_malloc(soap, sizeof(_wsse__UsernameToken));  
    soap_default__wsse__UsernameToken(soap, security->UsernameToken);  
    /* populate the UsernameToken */  
/*    security->UsernameToken->wsu__Id = soap_strdup(soap, id);  */
    security->UsernameToken->Username = soap_strdup(soap, username);  
    /* allocate and populate the Password */  
    if (password)  
    {   
        security->UsernameToken->Password = (_wsse__Password*)soap_malloc(soap, sizeof(_wsse__Password));  
        soap_default__wsse__Password(soap, security->UsernameToken->Password);  
        security->UsernameToken->Password->__item = soap_strdup(soap, password);  
    }  
    return SOAP_OK;  
}  
开发者ID:cqzhanghy,项目名称:onvifclient,代码行数:20,代码来源:SetSoapSecurityDigest2Impl.cpp

示例14: onvif_db

/// Web service operation 'Probe' (returns error code or SOAP_OK)
int OnvifRemoteDiscoveryBindingService::Probe(struct wsdd__ProbeType tdn__Probe, struct wsdd__ProbeMatchesType &tdn__ProbeResponse) {
	char *pEndpointAddress = NULL, *pTypes = NULL, *pItem = NULL, *pXAddrs = NULL, *pMatchBy = NULL, *pAction = NULL;

	onvif_db(("Entered: %s:%u.\n", __FUNCTION__, __LINE__));

#if WSDISCOVERY_SPEC_VER == WSDISCOVERY_SPEC_200901
   set_field_string(&pAction, "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/ProbeMatches");
   set_field_string(&pMatchBy, "http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/rfc3986");
#else
   set_field_string(&pAction, "http://schemas.xmlsoap.org/ws/2005/04/discovery/ProbeMatches");
   set_field_string(&pMatchBy, "http://schemas.xmlsoap.org/ws/2005/04/discovery/rfc3986");
#endif

	pTypes           = nativeGetTypes();
	pItem            = nativeGetScopesItem();
	pXAddrs          = nativeGetXAddrs(ONVIF_ETH_INF);
	pEndpointAddress = nativeGetEndpointAddress(ONVIF_ETH_INF);

	tdn__ProbeResponse.__sizeProbeMatch = 1;
	tdn__ProbeResponse.ProbeMatch = (struct wsdd__ProbeMatchType *) soap_malloc(this, sizeof(struct wsdd__ProbeMatchType));
	soap_default_wsdd__ProbeMatchType(this, tdn__ProbeResponse.ProbeMatch);

	soap_set_field_string(this, &tdn__ProbeResponse.ProbeMatch->wsa__EndpointReference.Address, pEndpointAddress);
	soap_set_field_string(this, &tdn__ProbeResponse.ProbeMatch->Types, pTypes);

	tdn__ProbeResponse.ProbeMatch->Scopes = (struct wsdd__ScopesType *)soap_malloc(this, sizeof(struct wsdd__ScopesType));
	soap_default_wsdd__ScopesType(this, tdn__ProbeResponse.ProbeMatch->Scopes);

	soap_set_field_string(this, &tdn__ProbeResponse.ProbeMatch->Scopes->__item, pItem);
	soap_set_field_string(this, &tdn__ProbeResponse.ProbeMatch->Scopes->MatchBy, pMatchBy);
	soap_set_field_string(this, &tdn__ProbeResponse.ProbeMatch->XAddrs, pXAddrs);
	tdn__ProbeResponse.ProbeMatch->MetadataVersion = 1;

	free(pAction);
	free(pMatchBy);
	free(pEndpointAddress);
	free(pTypes);
	free(pItem);
	free(pXAddrs);
	return SOAP_OK;
}
开发者ID:haohd,项目名称:bananaPiCam,代码行数:42,代码来源:soapRemoteDiscoveryBindingServiceImpl.cpp

示例15: SetDeltaScreenCaptureAttachment

//**********************************************************************************
// SetDeltaScreenCaptureAttachment
//**********************************************************************************
int SetDeltaScreenCaptureAttachment(struct soap* soap,
							        BYTE* data,
							        int dataSize,
                                    BYTE command,
							        char* mimeType,
                                    struct ns1__captureDeltaScreenResponse &r)
{
	// Set rectangle
	r._returnDeltaAttachment.rect.topLeftX     = *(WORD*)data; data+=2;
	r._returnDeltaAttachment.rect.topLeftY     = *(WORD*)data; data+=2;
	r._returnDeltaAttachment.rect.bottomRightX = *(WORD*)data; data+=2;
	r._returnDeltaAttachment.rect.bottomRightY = *(WORD*)data; data+=2;
	dataSize -= 2*4;

	// No attachment?
	if ( dataSize == 0 )
		return SOAP_OK;

	// alloc soap memory for attachment
	char* soapAttachment = (char*)soap_malloc(soap, dataSize );
	memcpy( soapAttachment, data, dataSize );

	// get & set href for attachment
	char href[MAX_HREF_LEN];
	GetHref(href, command);
	r._returnDeltaAttachment.href = (char*)soap_malloc(soap, strlen(href)+1 );
	strcpy( r._returnDeltaAttachment.href, href );

	// default mimetype is bmp
	if ( !( mimeType ? strlen( mimeType ) : 0 ) )
        mimeType = "image/bmp";

	// set mimetype
	r._returnDeltaAttachment.mimeType = (char*)soap_malloc(soap, strlen(mimeType)+1 );
	strcpy( r._returnDeltaAttachment.mimeType, mimeType );

	// set the attahcment
	soap_set_dime(soap);
	return soap_set_dime_attachment(soap, soapAttachment, dataSize,
	                                mimeType, href, 0, NULL);
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:44,代码来源:HtiScreenshot.cpp


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