您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ str_init函数代码示例

51自学网 2021-06-03 08:26:23
  C++
这篇教程C++ str_init函数代码示例写得很实用,希望能帮到您。

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

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

示例1: LM_ERR

		return -1;	}	if(pvs->setf==NULL) {		LM_ERR("read only output var [%.*s]/n", spv->len, spv->s);		return -1;	}	return janssonmod_get_helper(msg, spath, sdoc, pvs);}/** * */static sr_kemi_t sr_kemi_jansson_exports[] = {	{ str_init("jansson"), str_init("get"),		SR_KEMIP_INT, ki_jansson_get,		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }	},	{{0, 0}, {0, 0}, 0, NULL, {0, 0, 0, 0, 0, 0}}};/** * */int mod_register(char *path, int *dlflags, void *p1, void *p2){	sr_kemi_modules_add(sr_kemi_jansson_exports);	return 0;
开发者ID:btriller,项目名称:kamailio,代码行数:31,


示例2: compare_uri_val

					}				}	/* got here, it means all unknown params in first URI have been resolved		=> first URI matched second URI, and the other way around	*/headers_check:	 /* XXX Do we really care ? */	compare_uri_val(headers,strncasecmp);	return 0;}static const str uri_type_names[6] = {	{NULL, 0}, /*This is the error type*/	str_init("sip"),	str_init("sips"),	str_init("tel"),	str_init("tels"),	str_init("urn:service")};char* uri_type2str(const uri_type type, char *result){	if (type == ERROR_URI_T)		return NULL;	memcpy(result, uri_type_names[type].s, uri_type_names[type].len);	return result + uri_type_names[type].len;}
开发者ID:Parantido,项目名称:opensips,代码行数:30,


示例3: str_init

int b2bl_key_avp_name;unsigned short b2bl_key_avp_type;static str b2bl_key_avp_param = {NULL, 0};static str b2bl_from_spec_param = {NULL, 0};static pv_spec_t b2bl_from_spec;static pv_value_t b2bl_from_tok;static struct to_body b2bl_from;#define B2BL_FROM_BUF_LEN    255static char b2bl_from_buf[B2BL_FROM_BUF_LEN + 1];str db_url= {0, 0};db_con_t *b2bl_db = NULL;db_func_t b2bl_dbf;str b2bl_dbtable= str_init("b2b_logic");str init_callid_hdr={0, 0};str server_address = {0, 0};int b2bl_db_mode = WRITE_BACK;int unsigned b2bl_th_init_timeout = 60;static cmd_export_t cmds[]={	{"b2b_init_request", (cmd_function)b2b_init_request, {		{CMD_PARAM_STR, fixup_b2b_logic, fixup_free_b2b_logic},		{CMD_PARAM_STR|CMD_PARAM_OPT,0,0},		{CMD_PARAM_STR|CMD_PARAM_OPT,0,0},		{CMD_PARAM_STR|CMD_PARAM_OPT,0,0},		{CMD_PARAM_STR|CMD_PARAM_OPT,0,0}, {0,0,0}},		REQUEST_ROUTE},
开发者ID:OpenSIPS,项目名称:opensips,代码行数:31,


示例4: ge_save

uint STDCALL ge_save( pvmEngine pThis, char* fileName, char* isSave){    gehead   head;    pgehead  phead;    uint     i, ii, count;    pvmobj   pvmo;    buf       out;    str  filename;    if ( setjmp( pThis->stack_state) == -1 )         return 0;    str_init( pThis, &filename );    str_copyzero( pThis, &filename, fileName );    buf_init( pThis, &out );    pThis->gesave = &out;    buf_reserve( pThis, &out, 0x1ffff );   *( puint )&head.idname = GE_STRING;//0x00004547;   // строка GE   head.flags = 0;   head.crc = 0;   head.headsize = sizeof( gehead );   head.size = 0;   head.vermajor = GEVER_MAJOR;    head.verminor = GEVER_MINOR;       buf_append( pThis, &out, ( pubyte )&head, sizeof( gehead ));   // Save resources at the first !   gesave_resource(pThis);   count = arr_count( pThis, &pThis->_vm.objtbl );   for ( i = KERNEL_COUNT; i < count ; i++ )   {      if(isSave && isSave[i] == 0)      {         /* gesave_addubyte( pThis, OVM_NONE );          gesave_adduint( pThis, GHCOM_PACK);          gesave_bwd( pThis, 6 );*/          pThis->popravka ++;          continue;      }      pvmo = ( pvmobj )PCMD( i );      pvmo->id -= pThis->popravka;      //@init @delete @array @oftype @index -не удалять имена      if(pThis->isDelName&&(pvmo->flag&GHCOM_NAME)&&pvmo->name&&lstrcmpA("@init",pvmo->name)&&          lstrcmpA("@delete",pvmo->name)&&lstrcmpA("@array",pvmo->name)&&          lstrcmpA("@oftype",pvmo->name)&&lstrcmpA("@index",pvmo->name))      {          pvmo->flag &= ~GHCOM_NAME;      }else          if(pvmo->name)             pvmo->flag |= ~GHCOM_NAME;      gesave_head( pThis, pvmo->type, pvmo->flag & GHCOM_NAME ?           pvmo->name : NULL, pvmo->flag );            switch ( pvmo->type )      {         case OVM_NONE:            break;         case OVM_BYTECODE:            gesave_bytecode( pThis, ( povmbcode )pvmo );            break;         case OVM_EXFUNC:            ((povmfunc)pvmo)->import = ((pvmobj)PCMD(((povmfunc)pvmo)->import))->id;            gesave_exfunc( pThis, ( povmfunc )pvmo );            break;         case OVM_TYPE:             {                for(ii = 0; ii<((povmtype)pvmo)->count; ii++)                {                    if(pThis->isDelName)                        ((povmtype)pvmo)->children[ii].flag &=~GHCOM_NAME;                    else if(((povmtype)pvmo)->children[ii].name)                        ((povmtype)pvmo)->children[ii].flag |=GHCOM_NAME;                }                gesave_type( pThis, ( povmtype )pvmo );             }break;         case OVM_GLOBAL:            gesave_var( pThis, (( povmglobal )pvmo)->type );            break;         case OVM_DEFINE:            gesave_define( pThis, ( povmdefine )pvmo );            break;         case OVM_IMPORT:            gesave_import( pThis, ( povmimport )pvmo );            break;         case OVM_ALIAS:            gesave_bwd( pThis, (( povmalias )pvmo)->idlink );            break;      }      gesave_finish(pThis);   }   // Specify the full size and crc   phead = ( pgehead )buf_ptr( pThis, &out );   phead->size = buf_len( pThis, &out );   phead->crc = crc( pThis, ( pubyte )phead + 12, phead->size - 12, 0xFFFFFFFF );   buf2file( pThis, &filename, &out );   buf_delete( pThis, &out );//.........这里部分代码省略.........
开发者ID:Refandler,项目名称:gentee,代码行数:101,


示例5: str_init

static int rules_num;  /* Number of parsed allow/deny files *//* Module parameter variables */static char* default_allow_file = DEFAULT_ALLOW_FILE;static char* default_deny_file = DEFAULT_DENY_FILE;char* allow_suffix = ".allow";static char* deny_suffix = ".deny";/* for allow_trusted and allow_address function */str db_url = {NULL, 0};                    /* Don't connect to the database by default *//* for allow_trusted function */int db_mode = DISABLE_CACHE;               /* Database usage mode: 0=no cache, 1=cache */str trusted_table = str_init("trusted");   /* Name of trusted table */str source_col = str_init("src_ip");       /* Name of source address column */str proto_col = str_init("proto");         /* Name of protocol column */str from_col = str_init("from_pattern");   /* Name of from pattern column */str ruri_col = str_init("ruri_pattern");   /* Name of RURI pattern column */str tag_col = str_init("tag");             /* Name of tag column */str priority_col = str_init("priority");   /* Name of priority column */str tag_avp_param = {NULL, 0};             /* Peer tag AVP spec */int peer_tag_mode = 0;                     /* Add tags form all mathcing peers to avp *//* for allow_address function */str address_table = str_init("address");   /* Name of address table */str grp_col = str_init("grp");             /* Name of address group column */str ip_addr_col = str_init("ip_addr");     /* Name of ip address column */str mask_col = str_init("mask");           /* Name of mask column */str port_col = str_init("port");           /* Name of port column */
开发者ID:krys1976,项目名称:kamailio,代码行数:31,


示例6: main

/*************************************************************************  Main Program  *****  Programa Principal                              *************************************************************************/void main(){   setup_psp(PSP_DISABLED);   setup_wdt(WDT_OFF);   setup_timer_0(RTCC_INTERNAL);   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);   setup_timer_2(T2_DIV_BY_16,0xFF,16);   setup_timer_3(T3_DISABLED|T3_DIV_BY_1);   setup_comparator(NC_NC_NC_NC);   setup_vref(FALSE);      setup_adc( ADC_OFF );   enable_interrupts(INT_TIMER1);   enable_interrupts(INT_TIMER2);   enable_interrupts(INT_RDA);   enable_interrupts(INT_EXT1);   enable_interrupts(global);      str_init(print_date);   str_init(print_time);                  set_timer1(0);      init_ext_eeprom();   ds1307_init();   glcd_init(ON);          readconfig();           draw_sect();   while (1)   {                         if (firstrun==255)      {         glcd_fillscreen(OFF);         glcd_loadscreen();         glcd_showlogo();         delay_ms(1500);         menu_mainmenu();         firstrun = 0;         write_eeprom(0x00, firstrun);      }            if (config==1)      {            menu_mainmenu();         if(UniTemp[0]==0x43)         {            write_eeprom(0x01, 1);         }         else if(UniTemp[0]==0x46)         {            write_eeprom(0x01, 2);         }         if(UniPres[0]==0x6D)         {            write_eeprom(0x02, 1);         }         else if(UniPres[0]==0x50)         {            write_eeprom(0x02, 2);         }         if(UniVel[0]==0x4E)         {            write_eeprom(0x03, 1);         }         else if(UniVel[0]==0x6B)         {            write_eeprom(0x03, 2);         }         else if(UniVel[0]==0x6D)         {            write_eeprom(0x03, 3);         }                  update_readings();                  button = !PRESSED;         config=0;      }      //.........这里部分代码省略.........
开发者ID:castro732,项目名称:X-Weather,代码行数:101,


示例7: b2b_entities_bind

int b2b_entities_bind(b2b_api_t* api);static mi_response_t *mi_b2be_list(const mi_params_t *params,								struct mi_handler *async_hdl);/** Global variables */unsigned int server_hsize = 9;unsigned int client_hsize = 9;static char* script_req_route = NULL;static char* script_reply_route = NULL;int req_routeid  = -1;int reply_routeid = -1;int replication_mode= 0;static str db_url= {0, 0};db_con_t *b2be_db = NULL;db_func_t b2be_dbf;str b2be_dbtable= str_init("b2b_entities");static int b2b_update_period = 100;int uac_auth_loaded;str b2b_key_prefix = str_init("B2B");int b2be_db_mode = WRITE_BACK;#define DB_COLS_NO  26/* TM bind */struct tm_binds tmb;/* UAC_AUTH bind */uac_auth_api_t uac_auth_api;/** Exported functions */static cmd_export_t cmds[] = {
开发者ID:OpenSIPS,项目名称:opensips,代码行数:31,


示例8: str_init

/* * timer interval length in seconds, tunable via modparam */#define RL_TIMER_INTERVAL 10/** SL API structure */sl_api_t slb;enum {	LOAD_SOURCE_CPU,	LOAD_SOURCE_EXTERNAL};str_map_t source_names[] = {	{str_init("cpu"),	LOAD_SOURCE_CPU},	{str_init("external"),	LOAD_SOURCE_EXTERNAL},	{{0, 0},		0},};static int pl_drop_code = 503;static str pl_drop_reason = str_init("Server Unavailable");static int pl_hash_size = 6;typedef struct pl_queue {	int     *       pipe;	int             pipe_mp;	str     *       method;	str             method_mp;} pl_queue_t;
开发者ID:TheGrandWazoo,项目名称:kamailio,代码行数:29,


示例9: CPL_RUNTIME_ERROR

#include "cpl_sig.h"#include "cpl_env.h"#include "cpl_run.h"#define EO_SCRIPT            ((char*)0xffffffff)#define DEFAULT_ACTION       ((char*)0xfffffffe)#define CPL_SCRIPT_ERROR     ((char*)0xfffffffd)#define CPL_RUNTIME_ERROR    ((char*)0xfffffffc)#define CPL_TO_CONTINUE      ((char*)0xfffffffb)#define HDR_NOT_FOUND        ((char*)0xffffffff)#define UNDEF_CHAR           (0xff)static str cpl_301_reason = str_init("Moved permanently");static str cpl_302_reason = str_init("Moved temporarily");#define check_overflow_by_ptr(_ptr_,_intr_,_error_) /	do {/		if ( (char*)(_ptr_)>(_intr_)->script.len+(_intr_)->script.s ) {/			LM_ERR("overflow detected ip=%p ptr=%p in "/			"func. %s, line %d/n",(_intr_)->ip,_ptr_,__FILE__,__LINE__);/			goto _error_; /		} /	}while(0)#define check_overflow_by_offset(_len_,_intr_,_error_) /	do {/		if ( (char*)((_intr_)->ip+(_len_)) > /		(_intr_)->script.len+(_intr_)->script.s ) {/
开发者ID:SibghatullahSheikh,项目名称:kamailio,代码行数:31,


示例10: str_init

 */#include <regex.h>#include "ldap.h"#include "h350_mod.h"#include "h350_exp_fn.h"#include "../../pvar.h"#include "../../ut.h"#include "../../mem/mem.h"#define H350_SIPURI_LOOKUP_LDAP_FILTER "(&(objectClass=SIPIdentity)(SIPIdentitySIPURI=%s))"#define H350_AUTH_FILTER_PATTERN "(&(objectClass=SIPIdentity)(SIPIdentityUserName=%s))"static str h350_call_pref_name = str_init("callPreferenceURI");static str h350_sip_pwd_name = str_init("SIPIdentityPassword");static str h350_service_level_name = str_init("SIPIdentityServiceLevel");#define H350_CALL_PREF_REGEX "^([^ ]+) +([a-zA-Z]+)(:([0-9]+))?$"#define SIP_URI_ESCAPED_MAX_LEN 1024#define AVP_NAME_STR_BUF_LEN 1024#define DIGEST_USERNAME_BUF_SIZE 2048static regex_t* call_pref_preg;int h350_sipuri_lookup(struct sip_msg* _msg, pv_elem_t* _sip_uri){	str sip_uri, sip_uri_escaped;	int ld_result_count;
开发者ID:Drooids,项目名称:openser-xmlrpc,代码行数:31,


示例11: str_init

 * @{ * * <h1>Overview of Operation</h1> * This module provides a web interface for RPC management interface. * It is built on top of the xhttp API module. *//** @file * * This is the main file of xhttp_rpc module which contains all the functions * related to http processing, as well as the module interface. */MODULE_VERSIONstr XHTTP_RPC_REASON_OK = str_init("OK");str XHTTP_RPC_CONTENT_TYPE_TEXT_HTML = str_init("text/html");xhttp_rpc_mod_cmds_t *xhttp_rpc_mod_cmds = NULL;int xhttp_rpc_mod_cmds_size = 0;/* FIXME: this should be initialized in ../../core/ver.c */int full_version_len;int ver_name_len;static int mod_init(void);static int child_init(int rank);static int xhttp_rpc_dispatch(sip_msg_t* msg, char* s1, char* s2);
开发者ID:TheGrandWazoo,项目名称:kamailio,代码行数:29,


示例12: str_deinit

void str_deinit(string *str) {    if (str->data != NULL) {        free((void*)(str->data));        str_init(str);    }}
开发者ID:bluesalt,项目名称:libcutil,代码行数:6,


示例13: str_init

static int** ds_ping_reply_codes = NULL;static int* ds_ping_reply_codes_cnt;int ds_hash_size = 0;int ds_hash_expire = 7200;int ds_hash_initexpire = 7200;int ds_hash_check_interval = 30;str ds_outbound_proxy = {0, 0};/* tm */struct tm_binds tmb;/*db */str ds_db_url            = {NULL, 0};str ds_set_id_col        = str_init(DS_SET_ID_COL);str ds_dest_uri_col      = str_init(DS_DEST_URI_COL);str ds_dest_flags_col    = str_init(DS_DEST_FLAGS_COL);str ds_dest_priority_col = str_init(DS_DEST_PRIORITY_COL);str ds_dest_attrs_col    = str_init(DS_DEST_ATTRS_COL);str ds_table_name        = str_init(DS_TABLE_NAME);str ds_setid_pvname   = {NULL, 0};pv_spec_t ds_setid_pv;str ds_attrs_pvname   = {NULL, 0};pv_spec_t ds_attrs_pv;/** module functions */static int mod_init(void);static int child_init(int);
开发者ID:gbour,项目名称:kamailio,代码行数:30,


示例14: str_init

#include "../../core/rpc_lookup.h"#include "db_matrix.h"MODULE_VERSION#define MAXCOLS 1000str matrix_db_url = str_init(DEFAULT_RODB_URL);/** * Generic parameter that holds a string, an int or an pseudo-variable * @todo replace this with gparam_t */struct multiparam_t {	enum {		MP_INT,		MP_STR,		MP_AVP,		MP_PVE,	} type;
开发者ID:krys1976,项目名称:kamailio,代码行数:31,


示例15: domain_init_rpc

#define DOMAIN_ATTRS_TABLE_VERSION 1#define DOMAIN_TABLE "domain"#define DOMAIN_ATTRS_TABLE "domain_attrs"#define DID_COL "did"#define DOMAIN_COL "domain"#define NAME_COL "name"#define TYPE_COL "type"#define VALUE_COL "value"static int domain_init_rpc(void);/* * Module parameter variables */str db_url = str_init(DEFAULT_RODB_URL);str domain_table = str_init(DOMAIN_TABLE); /* Name of domain table */str domain_attrs_table = str_init(DOMAIN_ATTRS_TABLE);str did_col = str_init(DID_COL);       /* Name of domain id column */str domain_col = str_init(DOMAIN_COL);       /* Name of domain column */str name_col = str_init(NAME_COL);   /* Name of attribute name column */str type_col = str_init(TYPE_COL);   /* Name of attribute type column */str value_col = str_init(VALUE_COL); /* Name of attribute value column */int domain_reg_myself = 0;/* * Other module variables */struct domain_list ***hash_table = 0;	/* Pointer to current hash table pointer */struct domain_list **hash_table_1 = 0;	/* Pointer to hash table 1 */struct domain_list **hash_table_2 = 0;	/* Pointer to hash table 2 */
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:31,


示例16: str_init

#include "../../dprint.h"#include "../../mem/mem.h"#include "../../mem/shm_mem.h"#include "../../ut.h"#include "../../error.h"#include "../../prime_hash.h"#include "../../db/db.h"#include "carrierroute.h"#include "load_data.h"#include "route_fifo.h"#include "carrier_tree.h"#include "route_func.h"str db_url = {NULL, 0};str db_table = str_init("carrierroute");str db_failure_table = str_init("carrierfailureroute");str subscriber_table = str_init("subscriber");str carrier_table = str_init("route_tree");static str id_col = str_init("id");static str carrier_col = str_init("carrier");static str domain_col = str_init("domain");static str scan_prefix_col = str_init("scan_prefix");static str flags_col = str_init("flags");static str mask_col = str_init("mask");static str prob_col = str_init("prob");static str rewrite_host_col = str_init("rewrite_host");static str strip_col = str_init("strip");static str rewrite_prefix_col = str_init("rewrite_prefix");static str rewrite_suffix_col = str_init("rewrite_suffix");
开发者ID:KISSMonX,项目名称:opensips,代码行数:31,


示例17: VARCHAR

		tprefix VARCHAR(32) NOT NULL,		tvalue VARCHAR(128) DEFAULT '' NOT NULL,		CONSTRAINT tprefix_idx UNIQUE (tprefix)		) ENGINE=MyISAM;INSERT INTO version (table_name, table_version) values ('mtrees','1');CREATE TABLE mtrees (		id INT(10) UNSIGNED AUTO_INCREMENT PRIMARY KEY NOT NULL,		tname VARCHAR(128) NOT NULL,		tprefix VARCHAR(32) NOT NULL,		tvalue VARCHAR(128) DEFAULT '' NOT NULL,		CONSTRAINT tname_tprefix_idx UNIQUE (tname, tprefix)		) ENGINE=MyISAM;#endif/** parameters */static str db_url = str_init(DEFAULT_DB_URL);/* default name created by sql scripts is 'mtrees' * - don't set it here with default value, only via config param */static str db_table = str_init("");static str tname_column   = str_init("tname");static str tprefix_column = str_init("tprefix");static str tvalue_column  = str_init("tvalue");/* List of allowed chars for a prefix*/str mt_char_list = str_init("0123456789");static str value_param = str_init("$avp(s:tvalue)");static str values_param = str_init("$avp(s:tvalues)");static str dstid_param = str_init("$avp(s:tdstid)");static str weight_param = str_init("$avp(s:tweight)");static str count_param = str_init("$avp(s:tcount)");
开发者ID:adubovikov,项目名称:kamailio,代码行数:31,


示例18: str_init

#include <mysql/mysqld_error.h>#include <mysql/mysql_version.h>#include "../../mem/mem.h"#include "../../dprint.h"#include "../../db/db_query.h"#include "../../db/db_async.h"#include "../../db/db_ut.h"#include "../../db/db_insertq.h"#include "val.h"#include "my_con.h"#include "res.h"#include "row.h"#include "db_mysql.h"#include "dbase.h"static str mysql_event_name = str_init("E_MYSQL_CONNECTION");static str mysql_url_str = str_init("url");static str mysql_stat_str = str_init("status");static str mysql_stat_connected_str = str_init("connected");static str mysql_stat_disconnected_str = str_init("disconnected");static event_id_t mysql_evi_id = EVI_ERROR;static int mysql_last_event = 0; /* ensures an event is									raised only when status changes */int mysql_register_event(void){	mysql_evi_id = evi_publish_event(mysql_event_name);	if (mysql_evi_id == EVI_ERROR) {		LM_ERR("cannot register event/n");		return -1;	}
开发者ID:vladpaiu,项目名称:opensips,代码行数:31,


示例19: main

//.........这里部分代码省略.........         else if(UniVel[1]=="k")         {            write_eeprom(0x03, 2);         }         else if(UniVel[1]=="N")         {            write_eeprom(0x03, 3);         }                                   pressed=0;         config=0;      }            if (try==1)      {                        try=0;               output_toggle(PIN_C2);      }            while(bkbhit)       {         auxi = bgetc();         if (auxi==0x54)         {            type=1;            for(i=0;i<15;i++)            {                                  string[i]=0x00;                                      }            i = 0;         }         if (auxi==0x50)         {            type=2;            for(i=0;i<15;i++)            {                                  string[i]=0x00;                                      }            i = 0;         }         if (auxi!=0x0D)         {                     }         if (type==1)      //Temperatura         {                     if ((auxi!=0x0D)&&(auxi!=0x54))            {               string[i] = auxi;               i++;            }            if (auxi==0x0D)            {               str_init(tprint);               tt = atol(string);                 sprintf(ttt,"%3.1w",tt);               strcat(tprint,temp);               strcat(tprint,ttt);               strcat(tprint,UniTemp);                draw_sect();               glcd_text_sec(1, 1, tprint, OFF);               glcd_update();                           }         }         if (type==2)      //Presion         {            if ((auxi!=0x0D)&&(auxi!=0x50))            {               string[i] = auxi;               i++;            }            if (auxi==0x0D)            {               str_init(pprint);               pp = atoi32(string);               sprintf(ppp,"%3.1w",pp);               strcat(pprint,pres);               strcat(pprint,ppp);               strcat(pprint,UniPres);                  draw_sect();               glcd_text_sec(1, 2, pprint, OFF);               glcd_update();            }         }                  glcd_update();         //END KBHIT      }                  glcd_update();      //ENDWHILE   }//ENDMAIN}
开发者ID:castro732,项目名称:X-Weather,代码行数:101,


示例20: str_init

#include "enum_mod.h"#include <stdio.h>#include <stdlib.h>#include "../../core/sr_module.h"#include "../../core/error.h"#include "../../core/mod_fix.h"#include "enum.h"MODULE_VERSION/* * Module parameter variables */str suffix = str_init("e164.arpa.");str param = str_init("");str i_branchlabel = str_init("i");str i_suffix = str_init("e164.arpa.");str i_bl_alg = str_init("cc");str service = {0,0};/* * Exported functions */static cmd_export_t cmds[] = {	{"enum_query", (cmd_function)enum_query_0, 0, 0, 0, REQUEST_ROUTE},	{"enum_query", (cmd_function)enum_query_1, 1, fixup_spve_null, 0,	 REQUEST_ROUTE},	{"enum_query", (cmd_function)enum_query_2, 2, fixup_spve_str, 0,
开发者ID:TheGrandWazoo,项目名称:kamailio,代码行数:30,


示例21: control_udp_incoming

static void control_udp_incoming(struct obj *obj, str *buf, struct sockaddr_in6 *sin, char *addr) {	struct control_udp *u = (void *) obj;	int ret;	int ovec[100];	char **out;	struct msghdr mh;	struct iovec iov[10];	str cookie, *reply;	ret = pcre_exec(u->parse_re, u->parse_ree, buf->s, buf->len, 0, 0, ovec, G_N_ELEMENTS(ovec));	if (ret <= 0) {		ret = pcre_exec(u->fallback_re, NULL, buf->s, buf->len, 0, 0, ovec, G_N_ELEMENTS(ovec));		if (ret <= 0) {			ilog(LOG_WARNING, "Unable to parse command line from udp:%s: %.*s", addr, STR_FMT(buf));			return;		}		ilog(LOG_WARNING, "Failed to properly parse UDP command line '%.*s' from %s, using fallback RE", STR_FMT(buf), addr);		pcre_get_substring_list(buf->s, ovec, ret, (const char ***) &out);		ZERO(mh);		mh.msg_name = sin;		mh.msg_namelen = sizeof(*sin);		mh.msg_iov = iov;		iov[0].iov_base = (void *) out[RE_UDP_COOKIE];		iov[0].iov_len = strlen(out[RE_UDP_COOKIE]);		if (out[RE_UDP_UL_CMD] && (chrtoupper(out[RE_UDP_UL_CMD][0]) == 'U' || chrtoupper(out[RE_UDP_UL_CMD][0]) == 'L')) {			iov[1].iov_base = (void *) out[4];			iov[1].iov_len = strlen(out[4]);			iov[2].iov_base = (void *) out[3];			iov[2].iov_len = strlen(out[3]);			iov[3].iov_base = "/n";			iov[3].iov_len = 1;			mh.msg_iovlen = 4;		}		else {			iov[1].iov_base = " E8/n";			iov[1].iov_len = 4;			mh.msg_iovlen = 2;		}		sendmsg(u->udp_listener.fd, &mh, 0);		pcre_free(out);		return;	}	ilog(LOG_INFO, "Got valid command from udp:%s: %.*s", addr, STR_FMT(buf));	pcre_get_substring_list(buf->s, ovec, ret, (const char ***) &out);	str_init(&cookie, (void *) out[RE_UDP_COOKIE]);	reply = cookie_cache_lookup(&u->cookie_cache, &cookie);	if (reply) {		ilog(LOG_INFO, "Detected command from udp:%s as a duplicate", addr);		sendto(u->udp_listener.fd, reply->s, reply->len, 0, (struct sockaddr *) sin, sizeof(*sin));		free(reply);		goto out;	}	if (chrtoupper(out[RE_UDP_UL_CMD][0]) == 'U')		reply = call_update_udp(out, u->callmaster);	else if (chrtoupper(out[RE_UDP_UL_CMD][0]) == 'L')		reply = call_lookup_udp(out, u->callmaster);	else if (chrtoupper(out[RE_UDP_DQ_CMD][0]) == 'D')		reply = call_delete_udp(out, u->callmaster);	else if (chrtoupper(out[RE_UDP_DQ_CMD][0]) == 'Q')		reply = call_query_udp(out, u->callmaster);	else if (chrtoupper(out[RE_UDP_V_CMD][0]) == 'V') {		ZERO(mh);		mh.msg_name = sin;		mh.msg_namelen = sizeof(*sin);		mh.msg_iov = iov;		mh.msg_iovlen = 2;		iov[0].iov_base = (void *) out[RE_UDP_COOKIE];		iov[0].iov_len = strlen(out[RE_UDP_COOKIE]);		iov[1].iov_base = " ";		iov[1].iov_len = 1;		if (chrtoupper(out[RE_UDP_V_FLAGS][0]) == 'F') {			ret = 0;			if (!strcmp(out[RE_UDP_V_PARMS], "20040107"))				ret = 1;			else if (!strcmp(out[RE_UDP_V_PARMS], "20050322"))				ret = 1;			else if (!strcmp(out[RE_UDP_V_PARMS], "20060704"))				ret = 1;			iov[2].iov_base = ret ? "1/n" : "0/n";			iov[2].iov_len = 2;			mh.msg_iovlen++;		}		else {			iov[2].iov_base = "20040107/n";			iov[2].iov_len = 9;			mh.msg_iovlen++;		}//.........这里部分代码省略.........
开发者ID:arpagon,项目名称:rtpengine,代码行数:101,


示例22: trace_onreq_in

static void trace_onreq_in(struct cell* t, int type, struct tmcb_params *ps);static void trace_onreq_out(struct cell* t, int type, struct tmcb_params *ps);static void trace_onreply_in(struct cell* t, int type, struct tmcb_params *ps);static void trace_onreply_out(struct cell* t, int type, struct tmcb_params *ps);static void trace_sl_onreply_out(sl_cbp_t *slcb);static void trace_sl_ack_in(sl_cbp_t *slcb);static int trace_send_hep_duplicate(str *body, str *from, str *to, struct dest_info*);static int pipport2su (char *pipport, union sockaddr_union *tmp_su, unsigned int *proto);int siptrace_net_data_recv(void *data);int siptrace_net_data_send(void *data);static int _siptrace_mode = 0;static str db_url             = str_init(DEFAULT_DB_URL);static str siptrace_table     = str_init("sip_trace");static str date_column        = str_init("time_stamp");  /* 00 */static str callid_column      = str_init("callid");      /* 01 */static str traced_user_column = str_init("traced_user"); /* 02 */static str msg_column         = str_init("msg");         /* 03 */static str method_column      = str_init("method");      /* 04 */static str status_column      = str_init("status");      /* 05 */static str fromip_column      = str_init("fromip");      /* 06 */static str toip_column        = str_init("toip");        /* 07 */static str fromtag_column     = str_init("fromtag");     /* 08 */static str direction_column   = str_init("direction");   /* 09 */static str time_us_column     = str_init("time_us");     /* 10 */static str totag_column       = str_init("totag");       /* 11 */#define NR_KEYS 12
开发者ID:quentusrex,项目名称:kamailio,代码行数:31,


示例23: str_init

 * Kamailio is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA * */#include "ht_dmq.h"#include "ht_api.h"static str ht_dmq_content_type = str_init("application/json");static str dmq_200_rpl  = str_init("OK");static str dmq_400_rpl  = str_init("Bad Request");static str dmq_500_rpl  = str_init("Server Internal Error");typedef struct _ht_dmq_repdata {	int action;	str htname;	str cname;	int type;	int intval;	str strval;	int expire;} ht_dmq_repdata_t;dmq_api_t ht_dmqb;
开发者ID:albertollamaso,项目名称:kamailio,代码行数:31,


示例24: TEMP_GRUU_HEADER_SIZE

#define TEMP_GRUU_HEADER "tgruu."#define TEMP_GRUU_HEADER_SIZE (sizeof(TEMP_GRUU_HEADER) - 1)#define GR_PARAM ";gr="#define GR_PARAM_SIZE (sizeof(GR_PARAM) - 1)#define GR_NO_VAL ";gr"#define GR_NO_VAL_SIZE (sizeof(GR_NO_VAL) - 1)#define CONTACT_SEP ", "#define CONTACT_SEP_LEN (sizeof(CONTACT_SEP) - 1)extern str gruu_secret;extern int disable_gruu;str default_gruu_secret=str_init("0p3nS1pS");/*! /brief * Buffer for Contact header field */static struct {	char* buf;	int buf_len;	int data_len;} contact = {0, 0, 0};static inline int calc_temp_gruu_len(str* aor,str* instance,str *callid){	int time_len,temp_gr_len;
开发者ID:NormB,项目名称:opensips,代码行数:29,


示例25: w_ldap_result_check_1

		char* filter_component, char* dst_avp_name);static int w_ldap_result_check_1(struct sip_msg* msg, 		char* attr_name_check_str, char* param);static int w_ldap_result_check_2(struct sip_msg* msg,		char* attr_name_check_str, char* attr_val_re);/* * Default module parameter values */#define DEF_LDAP_CONFIG "/usr/local/etc/kamailio/ldap.cfg"/** Module parameter variables*/str ldap_config = str_init(DEF_LDAP_CONFIG);static dictionary* config_vals = NULL;/** Exported functions*/static cmd_export_t cmds[] = {	{"ldap_search",            (cmd_function)w_ldap_search,            1, 		ldap_search_fixup, 0,		REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},	{"ldap_result",            (cmd_function)w_ldap_result1,           1, 		ldap_result_fixup, 0,		REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},	{"ldap_result",            (cmd_function)w_ldap_result2,           2, 		ldap_result_fixup, 0,		REQUEST_ROUTE|FAILURE_ROUTE|BRANCH_ROUTE|ONREPLY_ROUTE|LOCAL_ROUTE},
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:31,


示例26: send_reply

/*! /brief * Send a reply */int send_reply(struct sip_msg* _m, unsigned int _flags){	str unsup = str_init(SUPPORTED_PATH_STR);	long code;	str msg = str_init(MSG_200); /* makes gcc shut up */	char* buf;	if (contact.data_len > 0) {		add_lump_rpl( _m, contact.buf, contact.data_len, LUMP_RPL_HDR|LUMP_RPL_NODUP|LUMP_RPL_NOFREE);		contact.data_len = 0;	}	if (rerrno == R_FINE && (_flags&REG_SAVE_PATH_FLAG) && _m->path_vec.s) {		if ( (_flags&REG_SAVE_PATH_OFF_FLAG)==0 ) {			if (parse_supported(_m)<0 && (_flags&REG_SAVE_PATH_STRICT_FLAG)) {				rerrno = R_PATH_UNSUP;				if (add_unsupported(_m, &unsup) < 0)					return -1;				if (add_path(_m, &_m->path_vec) < 0)					return -1;			}			else if (get_supported(_m) & F_SUPPORTED_PATH) {				if (add_path(_m, &_m->path_vec) < 0)					return -1;			} else if ((_flags&REG_SAVE_PATH_STRICT_FLAG)) {				rerrno = R_PATH_UNSUP;				if (add_unsupported(_m, &unsup) < 0)					return -1;				if (add_path(_m, &_m->path_vec) < 0)					return -1;			}		}	}	code = rerr_codes[rerrno];	switch(code) {	case 200: msg.s = MSG_200; msg.len = sizeof(MSG_200)-1; break;	case 400: msg.s = MSG_400; msg.len = sizeof(MSG_400)-1;break;	case 420: msg.s = MSG_420; msg.len = sizeof(MSG_420)-1;break;	case 500: msg.s = MSG_500; msg.len = sizeof(MSG_500)-1;break;	case 503: msg.s = MSG_503; msg.len = sizeof(MSG_503)-1;break;	}	if (code != 200) {		buf = (char*)pkg_malloc(E_INFO_LEN + error_info[rerrno].len + CRLF_LEN + 1);		if (!buf) {			LM_ERR("no pkg memory left/n");			return -1;		}		memcpy(buf, E_INFO, E_INFO_LEN);		memcpy(buf + E_INFO_LEN, error_info[rerrno].s, error_info[rerrno].len);		memcpy(buf + E_INFO_LEN + error_info[rerrno].len, CRLF, CRLF_LEN);		add_lump_rpl( _m, buf, E_INFO_LEN + error_info[rerrno].len + CRLF_LEN,			LUMP_RPL_HDR|LUMP_RPL_NODUP);		if (code >= 500 && code < 600 && retry_after) {			if (add_retry_after(_m) < 0) {				return -1;			}		}	}	if (sigb.reply(_m, code, &msg, NULL) == -1) {		LM_ERR("failed to send %ld %.*s/n", code, msg.len,msg.s);		return -1;	} else return 0;}
开发者ID:NormB,项目名称:opensips,代码行数:70,


示例27: pack_ci

/*! /brief * Fills the common part (for all contacts) of the info structure */static inline ucontact_info_t* pack_ci( struct sip_msg* _m, contact_t* _c,											unsigned int _e, unsigned int _f){	static ucontact_info_t ci;	static str no_ua = str_init("n/a");	static str callid;	static str path_received = {0,0};	static str path;	static str received = {0,0};	static int received_found;	static unsigned int allowed, allow_parsed;	static struct sip_msg *m = 0;	int_str val;	if (_m!=0) {		memset( &ci, 0, sizeof(ucontact_info_t));		/* Get callid of the message */		callid = _m->callid->body;		trim_trailing(&callid);		if (callid.len > CALLID_MAX_SIZE) {			rerrno = R_CALLID_LEN;			LM_ERR("callid too long/n");			goto error;		}		ci.callid = &callid;		/* Get CSeq number of the message */		if (str2int(&get_cseq(_m)->number, (unsigned int*)&ci.cseq) < 0) {			rerrno = R_INV_CSEQ;			LM_ERR("failed to convert cseq number/n");			goto error;		}		/* set received socket */		if (_m->flags&sock_flag) {			ci.sock = get_sock_hdr(_m);			if (ci.sock==0)				ci.sock = _m->rcv.bind_address;		} else {			ci.sock = _m->rcv.bind_address;		}		/* additional info from message */		if (parse_headers(_m, HDR_USERAGENT_F, 0) != -1 && _m->user_agent &&		_m->user_agent->body.len>0 && _m->user_agent->body.len<UA_MAX_SIZE) {			ci.user_agent = &_m->user_agent->body;		} else {			ci.user_agent = &no_ua;		}		/* extract Path headers */		if (path_enabled) {			if (build_path_vector(_m, &path, &path_received) < 0) {				rerrno = R_PARSE_PATH;				goto error;			}			if (path.len && path.s) {				ci.path = &path;				if (path_mode != PATH_MODE_OFF) {					/* save in msg too for reply */					if (set_path_vector(_m, &path) < 0) {						rerrno = R_PARSE_PATH;						goto error;					}				}			}		}		ci.last_modified = act_time;		/* set flags */		ci.flags  = _f;		getbflagsval(0, &ci.cflags);		/* get received */		if (path_received.len && path_received.s) {			ci.cflags |= ul.nat_flag;			ci.received = path_received;		}		allow_parsed = 0; /* not parsed yet */		received_found = 0; /* not found yet */		m = _m; /* remember the message */	}	if(_c!=0) {		/* hook uri address - should be more than 'sip:' chars */		if(_c->uri.s!=NULL && _c->uri.len>4)			ci.c = &_c->uri;		/* Calculate q value of the contact */		if (calc_contact_q(_c->q, &ci.q) < 0) {			rerrno = R_INV_Q;			LM_ERR("failed to calculate q/n");			goto error;		}//.........这里部分代码省略.........
开发者ID:halan,项目名称:kamailio,代码行数:101,


示例28: mi_b2b_bridge

/* * arguments: b2bl_key, new_dest, entity (1 - client) * */static struct mi_root* mi_b2b_bridge(struct mi_root* cmd, void* param){	struct mi_node* node= NULL;	str key;	b2bl_tuple_t* tuple;	str new_dest;	unsigned int entity_no = 0;	b2bl_entity_id_t* entity, *old_entity, *bridging_entity;	struct sip_uri uri;	str meth_inv = {INVITE, INVITE_LEN};	str meth_bye = {BYE, BYE_LEN};	unsigned int hash_index, local_index;	str ok= str_init("ok");	b2b_req_data_t req_data;	b2b_rpl_data_t rpl_data;	node = cmd->node.kids;	if(node == NULL)		return 0;	/* b2bl_key */	key = node->value;	if(key.s == NULL || key.len== 0)	{		LM_ERR("Wrong b2b_logic key parameter/n");		return init_mi_tree(404, "Empty b2bl key", 14);	}	/* new destination- must be a valid SIP URI */	node = node->next;	if(node == NULL)		return 0;		new_dest = node->value;	if(new_dest.s == NULL || new_dest.len == 0)	{		LM_ERR("Empty new dest parameter/n");		return init_mi_tree(404, "Empty parameter", 15);	}	if(parse_uri(new_dest.s, new_dest.len, &uri)< 0)	{		LM_ERR("Bad argument. Not a valid uri [%.*s]/n", new_dest.len, new_dest.s);		return init_mi_tree(404, "Bad parameter", 13);	}	/* the last parameter is optional, if present and 1 - >	 * means that destination from the current call must be	 * bridged to the new destination */	node = node->next;	if(node)	{		if (node->value.len==1)		{			if(strncmp(node->value.s, "0", 1)==0)				entity_no = 0;			else if(strncmp(node->value.s, "1", 1)==0)				entity_no = 1;			else				return init_mi_tree(404, "Invalid entity no parameter", 27);		}		else		{			return init_mi_tree(404, "Invalid entity no parameter", 27);		}	}	else	{		return init_mi_tree(404, "Invalid entity no parameter", 27);	}	if(b2bl_parse_key(&key, &hash_index, &local_index) < 0)	{		LM_ERR("Failed to parse key '%.*s'/n", key.len, key.s);		return 0;	}	entity = b2bl_create_new_entity(B2B_CLIENT, 0, &new_dest, 0, 0, 0, 0);	if(entity == NULL)	{		LM_ERR("Failed to create new b2b entity/n");		return 0;	}	lock_get(&b2bl_htable[hash_index].lock);	tuple = b2bl_search_tuple_safe(hash_index, local_index);	if(tuple == NULL)	{		LM_ERR("No entity found/n");		goto error;	}	bridging_entity = tuple->bridge_entities[entity_no];	old_entity = tuple->bridge_entities[(entity_no?0:1)];	if(old_entity == NULL || bridging_entity == NULL)//.........这里部分代码省略.........
开发者ID:ryzhov,项目名称:ATS0,代码行数:101,


示例29: regex_init_rpc

static int regex_init_rpc(void){	if (rpc_register_array(regex_rpc_cmds)!=0)	{		LM_ERR("failed to register RPC commands/n");		return -1;	}	return 0;}/** * *//* clang-format off */static sr_kemi_t sr_kemi_regex_exports[] = {	{ str_init("regex"), str_init("pcre_match"),		SR_KEMIP_INT, ki_pcre_match,		{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_NONE,			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }	},	{ str_init("regex"), str_init("pcre_match_group"),		SR_KEMIP_INT, ki_pcre_match_group,		{ SR_KEMIP_STR, SR_KEMIP_INT, SR_KEMIP_NONE,			SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }	},	{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }};/* clang-format on *//**
开发者ID:SipSeb,项目名称:kamailio,代码行数:31,



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


C++ str_isempty函数代码示例
C++ str_hash函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。