static int restore_remaining_dirs(struct asfd *asfd, struct bu *bu, struct slist *slist, enum action act, struct sdirs *sdirs, enum cntr_status cntr_status, struct conf **cconfs) { int ret=-1; struct sbuf *sb; struct sbuf *need_data=NULL; if(!(need_data=sbuf_alloc(get_protocol(cconfs)))) goto end; // Restore any directories that are left in the list. for(sb=slist->head; sb; sb=sb->next) { if(get_protocol(cconfs)==PROTO_1) { if(restore_sbuf_protocol1(asfd, sb, bu, act, sdirs, cntr_status, cconfs)) goto end; } else { if(restore_sbuf_protocol2(asfd, sb, act, cntr_status, get_cntr(cconfs), need_data)) goto end; } } ret=0; end: sbuf_free(&need_data); return ret; }
/** Duplicate this socket, including its underlying descriptor. @return the duplicate StreamSocket on success, NULL+errno on failure. */ virtual YO_NEW_REF StreamSocket* dup() { socket_t socket_ = Socket::create(get_domain(), TYPE, get_protocol()); if (socket_ != static_cast<socket_t>(-1)) { return new StreamSocket(get_domain(), get_protocol(), socket_); } else { return NULL; } }
void print_pkt (const char *pkt, unsigned int len, int verbose) { struct ether_header *ether; struct ip *ip_hdr; const unsigned char *src, *dst; unsigned short type; char ip_src[BUFSIZ], ip_dst[BUFSIZ]; int af; ether = (struct ether_header *) pkt; src = ether->ether_shost; dst = ether->ether_dhost; type = ntohs (ether->ether_type); if (verbose == JSON_OUTPUT) { printf ("\"hw_src\": \"%02x:%02x:%02x:%02x:%02x:%02x\", " "\"hw_dst\": \"%02x:%02x:%02x:%02x:%02x:%02x\", " "\"ethertype\": \"%s (%#.4x)\", \"length\": %d, ", src[0] & 0xff, src[1] & 0xff, src[2] & 0xff, src[3] & 0xff, src[4] & 0xff, src[5] & 0xff, dst[0] & 0xff, dst[1] & 0xff, dst[2] & 0xff, dst[3] & 0xff, dst[4] & 0xff, dst[5] & 0xff, get_ether_type (type), type, len); } else { printf ("\t" "%02x:%02x:%02x:%02x:%02x:%02x > " "%02x:%02x:%02x:%02x:%02x:%02x, " "ethertype %s (%#.4x), length: %d\n", src[0] & 0xff, src[1] & 0xff, src[2] & 0xff, src[3] & 0xff, src[4] & 0xff, src[5] & 0xff, dst[0] & 0xff, dst[1] & 0xff, dst[2] & 0xff, dst[3] & 0xff, dst[4] & 0xff, dst[5] & 0xff, get_ether_type (type), type, len); } if (type == ETHERTYPE_IP) { af = AF_INET; } else { af = AF_INET6; } ip_hdr = (struct ip *) (pkt + sizeof (struct ether_header)); if (verbose == JSON_OUTPUT) { printf ("\"ip_src\": \"%s\", \"ip_dst\": \"%s\", " "\"length\": %d, \"protocol\": \"%s\"", inet_ntop (af, &(ip_hdr->ip_src), ip_src, sizeof (ip_src)), inet_ntop (af, &(ip_hdr->ip_dst), ip_dst, sizeof (ip_dst)), ntohs (ip_hdr->ip_len), get_protocol (ip_hdr->ip_p)); } else { printf ("\t" "%s > %s length: %d, protocol: %s\n", inet_ntop (af, &(ip_hdr->ip_src), ip_src, sizeof (ip_src)), inet_ntop (af, &(ip_hdr->ip_dst), ip_dst, sizeof (ip_dst)), ntohs (ip_hdr->ip_len), get_protocol (ip_hdr->ip_p)); } }
void RedClient::set_target(const std::string& host, int port, int sport, int protocol) { if (protocol != get_protocol()) { LOG_INFO("old protocol %d, new protocol %d", get_protocol(), protocol); } _port = port; _sport = sport; _host.assign(host); set_protocol(protocol); }
static const char * get_uri(const char * url){ size_t proto_len = 0; if (get_protocol(url)) proto_len = strlen(get_protocol(url)); size_t host_len = strlen(get_host(url)); url = url + proto_len + host_len; if (*url != '\0') return url; else{ return "/"; } }
static const char * get_host(const char * url){ size_t proto_len = 0; if (get_protocol(url)) proto_len = strlen(get_protocol(url)); url = url + proto_len; const char * first_slash = index(url,'/'); if (!first_slash){ return url; }else{ char * host = (char *)calloc(MAX_HOST_SIZE,sizeof(char)); strncpy(host,url,first_slash - url); return host; } }
static int do_to_server(struct asfd *asfd, struct conf **confs, FF_PKT *ff, struct sbuf *sb, enum cmd cmd, int compression) { #ifdef HAVE_WIN32 int split_vss=0; int strip_vss=0; if(get_protocol(confs)==PROTO_1) { split_vss=get_int(confs[OPT_SPLIT_VSS]); strip_vss=get_int(confs[OPT_STRIP_VSS]); } #endif struct cntr *cntr=get_cntr(confs); enum protocol protocol=get_protocol(confs); sb->compression=compression; sb->statp=ff->statp; attribs_encode(sb); #ifdef HAVE_WIN32 if(split_vss && !strip_vss && cmd!=CMD_EFS_FILE && maybe_send_extrameta(asfd, ff->fname, cmd, sb, protocol, cntr, metasymbol)) return -1; #endif if(usual_stuff(asfd, cntr, ff->fname, ff->link, sb, cmd)) return -1; if(ff->type==FT_REG) cntr_add_val(cntr, CMD_BYTES_ESTIMATED, (uint64_t)ff->statp.st_size, 0); #ifdef HAVE_WIN32 if(split_vss && !strip_vss && cmd!=CMD_EFS_FILE // FIX THIS: May have to check that it is not a directory here. && !S_ISDIR(sb->statp.st_mode) // does this work? && maybe_send_extrameta(asfd, ff->fname, cmd, sb, protocol, cntr, vss_trail_symbol)) return -1; return 0; #else return maybe_send_extrameta(asfd, ff->fname, cmd, sb, protocol, cntr, metasymbol); #endif }
int mailprivacy_encrypt_msg(struct mailprivacy * privacy, char * privacy_driver, char * privacy_encryption, mailmessage * msg, struct mailmime * mime, struct mailmime ** result) { struct mailprivacy_protocol * protocol; struct mailprivacy_encryption * encryption; int r; protocol = get_protocol(privacy, privacy_driver); if (protocol == NULL) return MAIL_ERROR_INVAL; encryption = get_encryption(protocol, privacy_encryption); if (encryption == NULL) return MAIL_ERROR_INVAL; if (encryption->encrypt == NULL) return MAIL_ERROR_NOT_IMPLEMENTED; r = encryption->encrypt(privacy, msg, mime, result); if (r != MAIL_NO_ERROR) return r; return MAIL_NO_ERROR; }
result_t HttpResponse::sendHeader(Stream_base* stm, AsyncEvent* ac) { if (!ac) return CHECK_ERROR(CALL_E_NOSYNC); if (m_cookies) { int32_t len, i; m_cookies->get_length(len); for (i = 0; i < len; i++) { Variant v; obj_ptr<object_base> cookie; exlib::string str; m_cookies->_indexed_getter(i, v); cookie = v.object(); if (cookie) { cookie->toString(str); addHeader("Set-Cookie", str); } } m_cookies.Release(); } int32_t pos = shortcut[m_status / 100 - 1] + m_status % 100; exlib::string strCommand; get_protocol(strCommand); strCommand.append(status_lines[pos], status_lines_size[pos]); return m_message->sendHeader(stm, strCommand, ac); }
// Used on resume, this just reads the phase1 file and sets up cntr. static int read_phase1(struct manio *p1manio, struct conf **cconfs) { int ret=-1; struct sbuf *p1b; enum protocol protocol=get_protocol(cconfs); struct cntr *cntr=get_cntr(cconfs); if(!(p1b=sbuf_alloc(protocol))) return -1; while(1) { sbuf_free_content(p1b); switch(manio_read(p1manio, p1b)) { case 0: break; case 1: ret=0; default: goto end; } cntr_add_phase1(cntr, p1b->path.cmd, 0); if(sbuf_is_estimatable(p1b)) cntr_add_val(cntr, CMD_BYTES_ESTIMATED, (uint64_t)p1b->statp.st_size); } end: sbuf_free(&p1b); return ret; }
static int open_log(struct asfd *asfd, struct sdirs *sdirs, struct conf **cconfs) { int ret=-1; char *logpath=NULL; const char *peer_version=get_string(cconfs[OPT_PEER_VERSION]); if(!(logpath=prepend_s(sdirs->rworking, "log"))) goto end; if(log_fzp_set(logpath, cconfs)) { logp("could not open log file: %s\n", logpath); goto end; } logp("Client version: %s\n", peer_version?:""); logp("Protocol: %d\n", (int)get_protocol(cconfs)); if(get_int(cconfs[OPT_CLIENT_IS_WINDOWS])) logp("Client is Windows\n"); // Make sure a warning appears in the backup log. // The client will already have been sent a message with logw. // This time, prevent it sending a logw to the client by specifying // NULL for cntr. if(get_int(cconfs[OPT_VERSION_WARN])) version_warn(asfd, NULL, cconfs); ret=0; end: free_w(&logpath); return ret; }
man_off_t *do_resume(struct sdirs *sdirs, struct dpth *dpth, struct conf **cconfs) { man_off_t *p1pos=NULL; struct manio *cmanio=NULL; struct manio *umanio=NULL; struct manio *p1manio=NULL; enum protocol protocol=get_protocol(cconfs); logp("Begin phase1 (read previous file system scan)\n"); if(!(p1manio=manio_open_phase1(sdirs->phase1data, "rb", protocol)) || read_phase1(p1manio, cconfs)) goto end; manio_close(&p1manio); // First, open them in append mode, so that they will be created if // they do not exist. if(!(cmanio=manio_open_phase2(sdirs->changed, "ab", protocol)) || !(umanio=manio_open_phase2(sdirs->unchanged, "ab", protocol))) goto end; manio_close(&cmanio); manio_close(&umanio); if(!(p1pos=do_resume_work(sdirs, dpth, cconfs))) goto end; if(dpth_incr(dpth)) goto end; logp("End phase1 (read previous file system scan)\n"); end: manio_close(&p1manio); manio_close(&cmanio); manio_close(&umanio); return p1pos; }
static char *get_restore_style(struct asfd *asfd, struct conf **confs) { if(get_protocol(confs)==PROTO_1) return strdup_w(RESTORE_STREAM, __func__); if(asfd->simple_loop(asfd, confs, NULL, __func__, restore_style_func)) return NULL; return restore_style; }
void device_parameter::device_value_change_event(const ossia::value& val) { if (val.valid()) { m_current_value = val; get_protocol().push(*this); } }
static int run_list(struct asfd *asfd, struct sdirs *sdirs, struct conf **cconfs) { int ret=-1; char *cp=NULL; char *backupno=NULL; char *browsedir=NULL; char *listregex=NULL; struct iobuf *rbuf=asfd->rbuf; if(!client_can_generic(cconfs, OPT_CLIENT_CAN_LIST)) { logp("Not allowing list of %s\n", get_string(cconfs[OPT_CNAME])); asfd->write_str(asfd, CMD_GEN, "Client list is not allowed"); goto end; } if(!strncmp_w(rbuf->buf, "list ")) { if((cp=strchr(rbuf->buf, ':'))) { *cp='\0'; if(!(listregex=strdup_w(cp+1, __func__))) goto end; } if(!(backupno=strdup_w(rbuf->buf+strlen("list "), __func__))) goto end; } else if(!strncmp_w(rbuf->buf, "listb ")) { if((cp=strchr(rbuf->buf, ':'))) { *cp='\0'; if(!(browsedir=strdup_w(cp+1, __func__))) goto end; } strip_trailing_slashes(&browsedir); if(!(backupno=strdup_w(rbuf->buf+strlen("listb "), __func__))) goto end; } if(asfd->write_str(asfd, CMD_GEN, "ok")) goto end; iobuf_free_content(asfd->rbuf); if(list_server_init(asfd, sdirs, get_cntr(cconfs), get_protocol(cconfs), backupno, listregex, browsedir)) goto end; ret=do_list_server(); end: free_w(&backupno); free_w(&browsedir); free_w(&listregex); list_server_free(); return ret; }
static void parse_options( int argc, char** argv, struct configuration* cfg ) { int option_index = 0; int opt; static struct option long_options[] = { { "proto", required_argument, 0, 't' }, { "host", required_argument, 0, 'l' }, { "ioctl", required_argument, 0, 'i' }, { "port", required_argument, 0, 'p' }, { "mcast", required_argument, 0, 'c' }, { "max", required_argument, 0, 'n' }, { "templated", no_argument, 0, 'T' }, { "help", no_argument, 0, 'h' }, { 0, no_argument, 0, 0 } }; char const* optstring = "t:l:i:p:c:n:Th"; /* Defaults */ bzero(cfg, sizeof(struct configuration)); cfg->cfg_protocol = IPPROTO_UDP; cfg->cfg_port = 9000; opt = getopt_long(argc, argv, optstring, long_options, &option_index); while( opt != -1 ) { switch( opt ) { case 't': cfg->cfg_protocol = get_protocol(optarg); break; case 'l': cfg->cfg_host = optarg; break; case 'i': cfg->cfg_ioctl = optarg; break; case 'p': cfg->cfg_port = atoi(optarg); break; case 'c': cfg->cfg_mcast = optarg; break; case 'n': cfg->cfg_max_packets = atoi(optarg); break; #ifdef ONLOADEXT_AVAILABLE case 'T': cfg->cfg_templated = 1; break; #endif case 'h': default: print_help(); break; } opt = getopt_long(argc, argv, optstring, long_options, &option_index); } }
int backup_phase1_client(struct asfd *asfd, struct conf **confs) { int ret=-1; struct FF_PKT *ff=NULL; struct strlist *l=NULL; enable_acl=get_int(confs[OPT_ACL]); enable_xattr=get_int(confs[OPT_XATTR]); // First, tell the server about everything that needs to be backed up. logp("Phase 1 begin (file system scan)\n"); // Encryption not yet supported in protocol2. if(get_protocol(confs)==PROTO_1 && get_string(confs[OPT_ENCRYPTION_PASSWORD])) { encryption=ENCRYPTION_KEY_DERIVED; filesymbol=CMD_ENC_FILE; metasymbol=CMD_ENC_METADATA; #ifdef HAVE_WIN32 metasymbol=CMD_ENC_VSS; vss_trail_symbol=CMD_ENC_VSS_T; #endif } #ifdef HAVE_WIN32 dirsymbol=filesymbol; if(get_protocol(confs)==PROTO_1 && get_int(confs[OPT_STRIP_VSS])) dirsymbol=CMD_DIRECTORY; #endif if(!(ff=find_files_init(my_send_file))) goto end; for(l=get_strlist(confs[OPT_STARTDIR]); l; l=l->next) if(l->flag) if(find_files_begin(asfd, ff, confs, l->path)) goto end; ret=0; end: cntr_print_end_phase1(get_cntr(confs)); if(ret) logp("Error in phase 1\n"); logp("Phase 1 end (file system scan)\n"); find_files_free(&ff); return ret; }
void telemetry::parse_input() { if(get_protocol() == protocol_t::command_line){ parse_commandline(); }else{ parse_av_cobs(); telemetry::parse_frsky_bytestuff(); } // parse_input_from_FrSky_with_cobs_protocol(); }
static int my_send_file(struct asfd *asfd, struct FF_PKT *ff, struct conf **confs) { static struct sbuf *sb=NULL; struct cntr *cntr=get_cntr(confs); if(!sb && !(sb=sbuf_alloc(get_protocol(confs)))) return -1; #ifdef HAVE_WIN32 if(ff->winattr & FILE_ATTRIBUTE_ENCRYPTED) { if(ff->type==FT_REG || ff->type==FT_DIR) return to_server(asfd, confs, ff, sb, CMD_EFS_FILE); return logw(asfd, cntr, "EFS type %d not yet supported: %s\n", ff->type, ff->fname); } #endif switch(ff->type) { case FT_REG: case FT_RAW: case FT_FIFO: return do_to_server(asfd, confs, ff, sb, filesymbol, in_exclude_comp(get_strlist(confs[OPT_EXCOM]), ff->fname, get_int(confs[OPT_COMPRESSION]))); case FT_DIR: case FT_REPARSE: case FT_JUNCTION: return to_server(asfd, confs, ff, sb, dirsymbol); case FT_LNK_S: return to_server(asfd, confs, ff, sb, CMD_SOFT_LINK); case FT_LNK_H: return to_server(asfd, confs, ff, sb, CMD_HARD_LINK); case FT_SPEC: return to_server(asfd, confs, ff, sb, CMD_SPECIAL); case FT_NOFSCHG: return ft_err(asfd, confs, ff, "Will not descend: " "file system change not allowed"); case FT_NOFOLLOW: return ft_err(asfd, confs, ff, "Could not follow link"); case FT_NOSTAT: return ft_err(asfd, confs, ff, "Could not stat"); case FT_NOOPEN: return ft_err(asfd, confs, ff, "Could not open directory"); default: return logw(asfd, cntr, "Err: Unknown file type %d: %s\n", ff->type, ff->fname); } }
result_t HttpResponse::sendTo(Stream_base *stm, exlib::AsyncEvent *ac) { if (!ac) return CHECK_ERROR(CALL_E_NOSYNC); int pos = shortcut[m_status / 100 - 1] + m_status % 100; std::string strCommand; get_protocol(strCommand); strCommand.append(status_lines[pos], status_lines_size[pos]); return m_message.sendTo(stm, strCommand, ac); }
gboolean on_listen(GIOChannel *ch, GIOCondition condition, gpointer data) { int ssock, csock; unsigned laddr; struct sockaddr_in addr; char buf[MAXMSG]; char CN[MAX_DN_LEN]; ssize_t len; gnutls_session session; struct hb_quorumd_fns *fns; if (condition & G_IO_IN) { /* accept the connection */ ssock = g_io_channel_unix_get_fd(ch); laddr = sizeof(addr); csock = accept(ssock, (struct sockaddr*)&addr, &laddr); if (csock == -1) { quorum_log(LOG_ERR, "%s accept socket failed", __FUNCTION__); return TRUE; } memset(CN, 0, MAX_DN_LEN); session = initialize_tls_session(csock, CN); if (session == NULL) { quorum_log(LOG_ERR, "%s tls handshake failed", __FUNCTION__); close(csock); return TRUE; } memset(buf,0,MAXMSG); len = gnutls_record_recv(session, buf, MAXMSG); if (len <= 0) { quorum_log(LOG_ERR, "can't get version info"); gnutls_bye (session, GNUTLS_SHUT_WR); gnutls_deinit (session); close(csock); return TRUE; } quorum_debug(LOG_DEBUG, "version:%s(%d)",buf,(int)len); fns = get_protocol(buf); if(fns != NULL) { fns->on_connect(csock,session,CN); } else { quorum_log(LOG_WARNING, "version %s is not supported", buf); gnutls_bye (session, GNUTLS_SHUT_WR); gnutls_deinit (session); close(csock); } } return TRUE; }
unsigned Mavlink::get_free_tx_buf() { /* * Check if the OS buffer is full and disable HW * flow control if it continues to be full */ int buf_free = 0; #ifndef __PX4_POSIX // No FIONWRITE on Linux #if !defined(__PX4_LINUX) (void) ioctl(_uart_fd, FIONWRITE, (unsigned long)&buf_free); #endif if (get_flow_control_enabled() && buf_free < FLOW_CONTROL_DISABLE_THRESHOLD) { /* Disable hardware flow control: * if no successful write since a defined time * and if the last try was not the last successful write */ if (_last_write_try_time != 0 && hrt_elapsed_time(&_last_write_success_time) > 500 * 1000UL && _last_write_success_time != _last_write_try_time) { warnx("Disabling hardware flow control"); enable_flow_control(false); } } #endif // if we are using network sockets, return max lenght of one packet if (get_protocol() == UDP || get_protocol() == TCP ) { return 1500; } return buf_free; }
/* Returns the probe for specified protocol: * parameter is the description in builtins[], or "regex" * */ T_PROBE* get_probe(const char* description) { struct proto* p = get_protocol(description); if (p) return p->probe; /* Special case of "regex" probe (we don't want to set it in builtins * because builtins is also used to build the command-line options and * regexp is not legal on the command line)*/ if (!strcmp(description, "regex")) return regex_probe; return NULL; }
void write_to_log(char *proto, char *string, int protocol, struct in_addr sip, uint16_t sp, struct in_addr dip, uint16_t dp, unsigned char *packet, unsigned int len) { static unsigned long long file_count = 0; unsigned int i = 0; char *str = strdup(string); char *p = NULL; while(__sync_lock_test_and_set(&log_mutex,1)); if(initdone == 0) { init_log(); initdone = 1; } p = str; while(p != NULL && *p != '\0') { if(isspace(*p)) { *p = '_'; } p++; } file_count += fprintf(fp, "%s %s %s %s:%d ",proto, str, get_protocol(protocol), inet_ntoa(sip), sp); file_count += fprintf(fp, "%s:%d\t", inet_ntoa(dip), dp); for(i = 0; i < 100 && i < len; i++) { if(isprint(packet[i])){ file_count += fprintf(fp, "%c", packet[i]); } else if(packet[i] == '\n') { file_count += fprintf(fp, "."); } else { file_count += fprintf(fp, "."); } } file_count += fprintf(fp, "\n"); if(file_count > LOG_SIZE) { renew_log_file(); file_count = 0; } free(str); log_mutex = 0; }
char * mailprivacy_get_encryption_name(struct mailprivacy * privacy, char * privacy_driver, char * privacy_encryption) { struct mailprivacy_protocol * protocol; struct mailprivacy_encryption * encryption; protocol = get_protocol(privacy, privacy_driver); if (protocol == NULL) return NULL; encryption = get_encryption(protocol, privacy_encryption); if (encryption == NULL) return NULL; return encryption->description; }
static int backup_phase4_server(struct sdirs *sdirs, struct conf **cconfs) { int breaking=get_int(cconfs[OPT_BREAKPOINT]); if(breaking==4) return breakpoint(breaking, __func__); log_fzp_set(NULL, cconfs); // Phase4 will open logfp again (in case it is resuming). switch(get_protocol(cconfs)) { case PROTO_1: return backup_phase4_server_protocol1(sdirs, cconfs); default: return backup_phase4_server_protocol2(sdirs, cconfs); } }
static int setup_cntr(struct asfd *asfd, const char *manifest, regex_t *regex, int srestore, enum action act, char status, struct conf **cconfs) { int ars=0; int ret=-1; struct fzp *fzp=NULL; struct sbuf *sb=NULL; struct cntr *cntr=get_cntr(cconfs); // FIX THIS: this is only trying to work for protocol1. if(get_protocol(cconfs)!=PROTO_1) return 0; if(!(sb=sbuf_alloc(PROTO_1))) goto end; if(!(fzp=fzp_gzopen(manifest, "rb"))) { log_and_send(asfd, "could not open manifest"); goto end; } while(1) { if((ars=sbuf_fill_from_file(sb, fzp, NULL, NULL))) { if(ars<0) goto end; // ars==1 means end ok break; } else { if(want_to_restore(srestore, sb, regex, cconfs)) { cntr_add_phase1(cntr, sb->path.cmd, 0); if(sb->endfile.buf) cntr_add_val(cntr, CMD_BYTES_ESTIMATED, strtoull(sb->endfile.buf, NULL, 10), 0); } } sbuf_free_content(sb); } ret=0; end: sbuf_free(&sb); fzp_close(&fzp); return ret; }
static int backup_phase2_server(struct async *as, struct sdirs *sdirs, const char *incexc, int resume, struct conf **cconfs) { int breaking=get_int(cconfs[OPT_BREAKPOINT]); if(breaking==2) return breakpoint(breaking, __func__); switch(get_protocol(cconfs)) { case PROTO_1: return backup_phase2_server_protocol1(as, sdirs, incexc, resume, cconfs); default: return backup_phase2_server_protocol2(as, sdirs, resume, cconfs); } }
void send_message( lowlevel_unit_type &llu, const gpb::MethodDescriptor *method, gpb::RpcController *controller, const gpb::Message *request, gpb::Message *response, gpb::Closure *done ) { common::closure_holder done_holder(done); common::connection_iface_sptr clk(connection_.lock( )); if( clk.get( ) == NULL ) { if( controller ) { controller->SetFailed( "Connection lost" ); } parent_->get_channel_error_callback( )( "Connection lost" ); return; } const rpc::options *call_opt ( get_protocol( clk ).get_method_options(method) ); if( disable_wait( ) ) { llu.mutable_opt( )->set_wait( false ); } else { llu.mutable_opt( )->set_wait( call_opt->wait( ) ); llu.mutable_opt( )->set_accept_callbacks ( call_opt->accept_callbacks( ) ); } parent_->configure_message_for( clk, request, llu ); vtrc::uint64_t call_id = llu.id( ); if( llu.opt( ).wait( ) ) { /// Send and wait context_holder ch( &llu ); ch.ctx_->set_call_options( call_opt ); ch.ctx_->set_done_closure( done ); parent_->call_and_wait( call_id, llu, controller, response, clk, call_opt ); } else { /// Send and ... just send parent_->call_rpc_method( clk.get( ), llu ); } }
static int set_cstat_from_conf(struct cstat *cstat, struct conf **parentconfs, struct conf **cconfs) { struct strlist *s=NULL; // Make sure the permitted flag is set appropriately. cstat->permitted=cstat_permitted(cstat, parentconfs, cconfs); cstat->protocol=get_protocol(cconfs); sdirs_free((struct sdirs **)&cstat->sdirs); if(!(cstat->sdirs=sdirs_alloc()) || sdirs_init_from_confs((struct sdirs *)cstat->sdirs, cconfs)) return -1; strlists_free(&cstat->labels); for(s=get_strlist(cconfs[OPT_LABEL]); s; s=s->next) if(strlist_add_sorted(&cstat->labels, s->path, s->flag)) return -1; return 0; }