/* ---------------- | Check cookie | ---------------- */ void cookie_chk(void) { OBJECT *ausg_tree; unsigned long val; int ret, set = OP_PSG; play_mode = PSG; rsrc_gaddr(R_TREE, AUSG_SEL, &ausg_tree); ret = get_cookie('_SND', &val); if (!ret || !(val & 2)) { ausg_tree[OP_DMA].ob_state |= DISABLED; ausg_tree[OT_DMA].ob_state |= DISABLED; menu_adr[SET_MW].ob_state |= DISABLED; } else { set = OP_DMA; play_mode = DMA; send_mwire(); } if (ret && !(val & 1)) { ausg_tree[OP_PSG].ob_state |= DISABLED; ausg_tree[OT_PSG].ob_state |= DISABLED; } ausg_tree[set].ob_state |= SELECTED; if (get_cookie('_CPU', &cpu_type)) cpu_type += 68000L; get_cookie('_MCH', &machine); }
void check_cookies(void) { MAGX_COOKIE *cv; if (get_cookie('MagX',(long *)&cv)) { magix = 1; if (cv) { if (cv->aesvars) { if ((cv->aesvars->magic == -2023406815L) && (cv->aesvars->magic2 == 'MAGX')) { mgxver = cv->aesvars->version; } } } if (mgxver >= 0x0200) memprot = 1; } else { if (get_cookie('MiNT',NULL)) memprot = 1; } }
static void poison( uint64_t dpid, const uint8_t mac[ OFP_ETH_ALEN ] ) { struct ofp_match match; memset( &match, 0, sizeof( struct ofp_match ) ); match.wildcards = ( OFPFW_ALL & ~OFPFW_DL_DST ); memcpy( match.dl_dst, mac, OFP_ETH_ALEN ); const uint16_t idle_timeout = 0; const uint16_t hard_timeout = 0; const uint16_t priority = 0; const uint32_t buffer_id = 0; const uint16_t flags = 0; buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_DELETE, idle_timeout, hard_timeout, priority, buffer_id, OFPP_NONE, flags, NULL ); send_openflow_message( dpid, flow_mod ); free_buffer( flow_mod ); memset( &match, 0, sizeof( struct ofp_match ) ); match.wildcards = ( OFPFW_ALL & ~OFPFW_DL_SRC ); memcpy( match.dl_src, mac, OFP_ETH_ALEN ); flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_DELETE, idle_timeout, hard_timeout, priority, buffer_id, OFPP_NONE, flags, NULL ); send_openflow_message( dpid, flow_mod ); free_buffer( flow_mod ); debug( "Poisoning all entries whose dl_src or dl_dst matches %02x:%02x:%02x:%02x:%02x:%02x at dpid %#" PRIx64, mac[ 0 ], mac[ 1 ], mac[ 2 ], mac[ 3 ], mac[ 4 ], mac[ 5 ], dpid ); }
int main(int argc, char *argv[]) { long fl; MagX=get_cookie('MagX',0L); MiNT=get_cookie('MiNT',0L); if (argc > 1) { strlwr(argv[1]); printf("name -=%s=-\n",argv[1]); if ( strncmp(argv[1],autonam,strlen(autonam)) == 0 && *(argv[1] + strlen(autonam)) == '.' ) { char *s = argv[1]; while (*s && *s != '.') s++; s++; /* The argv tells what we want to have. that name must change to "auto". But before that we must look what is in the current "auto" && change that "auto" to what's mentioned within it. This is determined in 'change()' */ if (*(s+2) == 0 || *(s+2) == '\\') { /* if (*s == 'n' && *(s+1) == 'a') /* N.AES */ return change(nm,nn); if (*s == 'x' && *(s+1) == 'a') /* XaAES */ return change(xm,nx); if (*s == 't' && *(s+1) == 'o') /* tos */ return change(tm,nt); */ if (*s == 'n' && *(s+1) == 'a') /* N.AES */ return change(nc,nn); if (*s == 'x' && *(s+1) == 'a') /* XaAES */ return change(xc,nx); if (*s == 't' && *(s+1) == 'o') /* tos */ return change(tc,nt); } printf("needs one of .na, .xa, || .to\n"); if (!(MagX|MiNT)) Bconin(2); return 1; }
static void handle_packet_in( uint64_t datapath_id, packet_in message ) { openflow_actions *actions = create_actions(); append_action_output( actions, ( uint16_t ) ( message.in_port + 1 ), OFPCML_NO_BUFFER ); struct ofp_match match; set_match_from_packet( &match, message.in_port, 0, message.data ); buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, 0, 0, OFP_HIGH_PRIORITY, message.buffer_id, OFPP_NONE, 0, actions ); send_openflow_message( datapath_id, flow_mod ); free_buffer( flow_mod ); delete_actions( actions ); }
static void discard_packet_in( uint64_t datapath_id, uint16_t in_port, const buffer *packet ) { const uint32_t wildcards = 0; struct ofp_match match; set_match_from_packet( &match, in_port, wildcards, packet ); char match_str[ 1024 ]; match_to_string( &match, match_str, sizeof( match_str ) ); const uint16_t idle_timeout = 0; const uint16_t hard_timeout = PACKET_IN_DISCARD_DURATION; const uint16_t priority = UINT16_MAX; const uint32_t buffer_id = UINT32_MAX; const uint16_t flags = 0; info( "Discarding packets for a certain period ( datapath_id = %#" PRIx64 ", match = [%s], duration = %u [sec] ).", datapath_id, match_str, hard_timeout ); buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, idle_timeout, hard_timeout, priority, buffer_id, OFPP_NONE, flags, NULL ); send_openflow_message( datapath_id, flow_mod ); free_buffer( flow_mod ); }
static void send_flow_mod_receiving_lldp( sw_entry *sw, uint16_t hard_timeout, uint16_t priority ) { struct ofp_match match; memset( &match, 0, sizeof( struct ofp_match ) ); if ( !options.lldp_over_ip ) { match.wildcards = OFPFW_ALL & ~OFPFW_DL_TYPE; match.dl_type = ETH_ETHTYPE_LLDP; } else { match.wildcards = OFPFW_ALL & ~( OFPFW_DL_TYPE | OFPFW_NW_PROTO | OFPFW_NW_SRC_MASK | OFPFW_NW_DST_MASK ); match.dl_type = ETH_ETHTYPE_IPV4; match.nw_proto = IPPROTO_ETHERIP; match.nw_src = options.lldp_ip_src; match.nw_dst = options.lldp_ip_dst; } openflow_actions *actions = create_actions(); const uint16_t max_len = UINT16_MAX; append_action_output( actions, OFPP_CONTROLLER, max_len ); const uint16_t idle_timeout = 0; const uint32_t buffer_id = UINT32_MAX; const uint16_t flags = 0; buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, idle_timeout, hard_timeout, priority, buffer_id, OFPP_NONE, flags, actions ); send_openflow_message( sw->datapath_id, flow_mod ); delete_actions( actions ); free_buffer( flow_mod ); debug( "Sent a flow_mod for receiving LLDP frames from %#" PRIx64 ".", sw->datapath_id ); }
int Clocky_SS(int on) { long adr; JCLKSTRUCT *jclk; int oldval; /* CHECK_CLOCKY_STRUCT; */ if (!get_cookie(CLOCKY_IDENT_NUM, &adr)) return 0; jclk = (JCLKSTRUCT *) adr; if (jclk->name != CLOCKY_IDENT) { return 0; } if ((jclk->version / 0x100) != (CLOCKY_VERSION / 0x100)) { return 0; } oldval = jclk->switches.par.SaverOn; jclk->switches.par.SaverOn = on; /* turn the Clocky's screen saver on/off */ return oldval; }
void SetUserStatusHandler::main(std::string url) { std::string usercode = get_cookie("usercode"); cppcms::json::value json_error; json_error["result"] = false; json_error["reason"] = "user not login"; if (usercode.size() <= 0){ response_as_json(json_error); return; } std::string session_value = get_session(usercode); if (session_value != "admin"){ response_as_json(json_error); return; } std::string targetusercode = request().get("usercode"); std::string status = request().get("status"); int userstatus = std::atoi(status.c_str()); DatabaseOperator *databaseOperator = new DatabaseOperator(); bool result = databaseOperator->userManager->set_user_status(targetusercode, userstatus); cppcms::json::value json; json["result"] = result; json["reason"] = "database operate result"; response_as_json(json); delete databaseOperator; }
static void send_packet( uint16_t destination_port, packet_in packet_in ) { openflow_actions *actions = create_actions(); append_action_output( actions, destination_port, UINT16_MAX ); struct ofp_match match; set_match_from_packet( &match, packet_in.in_port, 0, packet_in.data ); buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, 60, 0, UINT16_MAX, UINT32_MAX, OFPP_NONE, OFPFF_SEND_FLOW_REM, actions ); send_openflow_message( packet_in.datapath_id, flow_mod ); free_buffer( flow_mod ); send_packet_out( packet_in, actions ); delete_actions( actions ); }
static void handle_switch_ready( uint64_t datapath_id, void *user_data ) { UNUSED( user_data ); openflow_actions *actions = create_actions(); append_action_output( actions, OFPP_CONTROLLER, OFPCML_NO_BUFFER ); openflow_instructions *insts = create_instructions(); append_instructions_apply_actions( insts, actions ); buffer *flow_mod = create_flow_mod( get_transaction_id(), get_cookie(), 0, 0, OFPFC_ADD, 0, 0, OFP_LOW_PRIORITY, OFP_NO_BUFFER, 0, 0, OFPFF_SEND_FLOW_REM, NULL, insts ); send_openflow_message( datapath_id, flow_mod ); free_buffer( flow_mod ); delete_instructions( insts ); delete_actions( actions ); }
void test_GetEmptyCookieAb() { const char* cookiestra = "This=name; NYT_W2NYT_W2 =Some; Other=abc"; const char* cookiename = "NYT_W2"; const char* expected = "Some"; char* actual = get_cookie(cookiestra, cookiename); TEST_ASSERT_EQUAL_STRING(expected, actual); }
static void handle_packet_in( uint64_t datapath_id, packet_in message ) { if ( message.data == NULL ) { error( "data must not be NULL" ); return; } uint32_t in_port = get_in_port_from_oxm_matches( message.match ); if ( in_port == 0 ) { return; } openflow_actions *actions = create_actions(); append_action_output( actions, OFPP_ALL, OFPCML_NO_BUFFER ); openflow_instructions *insts = create_instructions(); append_instructions_apply_actions( insts, actions ); oxm_matches *match = create_oxm_matches(); set_match_from_packet( match, in_port, 0, message.data ); buffer *flow_mod = create_flow_mod( get_transaction_id(), get_cookie(), 0, 0, OFPFC_ADD, 60, 0, OFP_HIGH_PRIORITY, message.buffer_id, 0, 0, OFPFF_SEND_FLOW_REM, match, insts ); send_openflow_message( datapath_id, flow_mod ); free_buffer( flow_mod ); delete_oxm_matches( match ); delete_instructions( insts ); if ( message.buffer_id == OFP_NO_BUFFER ) { buffer *frame = duplicate_buffer( message.data ); fill_ether_padding( frame ); buffer *packet_out = create_packet_out( get_transaction_id(), message.buffer_id, in_port, actions, frame ); send_openflow_message( datapath_id, packet_out ); free_buffer( packet_out ); free_buffer( frame ); } delete_actions( actions ); }
void test_GetCookie(void) { const char * cookiestra = "NYT-Edition=edition|US; localytics.js=1; RMID=007f01002c15543d3ed50004; madison_user_id=3tO7Obk_Sg6uI4lzodnFTQ; madison_guest=false; s_pers=%20s_vsn_nytimesglobal_1%3D7844460248015%7C1730135643028%3B; __gads=ID=b7772508b463357f:T=1414525015:S=ALNI_MYUerI95dT7BeEuYt-8nbA3yaoQ-Q; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_=scott.blumenthal%7C1414785730%7Cdd4286dfc0d60c4f7e605a51dd4614c5; fbm_9869919170=base_domain=.nytimes.com; nyt-recommend=1; __utma=69104142.778352587.1413318396.1415723158.1415983661.32; __utmc=69104142; __utmz=69104142.1415212413.29.12.utmcsr=localhost.nytimes.com:3001|utmccn=(referral)|utmcmd=referral|utmcct=/portal; nyt-d=101.000000000NAI00000C9Iio1f6ous0z1Iq/0eVpii0qApjv1eUY4r0M4meE1/FImH0AUY4r0C1sCa0f6mf/0zB0SA1w0mSI0M6tmN0vCp0g0aVnyU0K2Wnv0eCoir0kVnyU032W9v0UUWC70I4HeU0D77np1hStHe1rTcD1@c194bf3e/378764d3; _dycmc=17; _dyuss_undefined=8; _dyus_undefined=4%7C0%7C0%7C4%7C0%7C0.17.1398875133463.1416256906833.1022457.0%7C320%7C47%7C10%7C114%7C1%7C0%7C0%7C0%7C0%7C0%7C0%7C1%7C0%7C3%7C4%7C0%7C0%7C4%7C4%7C7%7C0%7C0%7C0; _ga=GA1.2.778352587.1413318396; welcomeviewed=1; nyt-m=896A6446A903792D23C341A88595492C&e=i.1420088400&t=i.10&v=i.0&n=i.2&g=i.0&rc=i.0&er=i.1415720418&vr=l.4.64.240.307.192&pr=l.4.152.799.1466.948&vp=i.739&gf=l.10.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1&ft=i.0&fv=i.0&rl=l.1.-1&cav=i.6&imu=i.1&igu=i.1&prt=i.5&kid=i.1&ica=i.0&iue=i.1&ier=i.0&iub=i.0&ifv=i.0&igd=i.0&iga=i.0&imv=i.0&igf=i.0&iru=i.0&ird=i.0&ira=i.0&iir=i.1&l=l.15.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1.-1&gl=l.2.-1.-1&gb=l.3.0.5.1416286800; _dysvar_8765260=63%253A@%[email protected]%253A@%[email protected]%253A@%253Ainteractive; _dyuss_8765260=89; _dycst=tg.m.frv1.ms.ltos.c.; _dycnoabc=1417552237877; _dyus_8765260=694%7C0%7C0%7C6%7C0%7C0.0.1398091900829.1415140239176.17048338.0%7C307%7C45%7C10%7C114%7C9%7C9%7C0%7C0%7C5%7C4%7C0%7C18%7C12%7C0%7C1%7C10%7C4%7C18%7C25%7C52%7C14%7C7%7C62; circgroup=store; _cb_ls=1; __utma=28590334.778352587.1413318396.1416594906.1417620206.2; __utmb=28590334.6.8.1417620228850; __utmc=28590334; __utmz=28590334.1416594906.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); _chartbeat2=tH6YdLrhnyDMUI6M.1397144713343.1417621166239.0000000000000001; rsi_segs=H07707_11003|H07707_10415|H07707_11063|D08734_70059|H07707_10207|D08734_70105|D08734_70509|D08734_70751|D08734_72008|D08734_72078|H07707_10044|H07707_10577|H07707_10638|H07707_11173|H07707_11174|H07707_11207|H07707_11175|H07707_11176|H07707_11178|H07707_11183|H07707_11187|H07707_11194|H07707_11195|H07707_11196|H07707_0; ab1=yes; ab2=yes; ab3=yes; _dyuss_8765283=6; _dycst=tg.m.frv3.ms.ltos.c.; _dycnoabc=1417621169989; NYT-mab=%7B%221%22%3A%22RI%3A5%22%7D; WT_FPC=id=8ad5d99b-3fc9-4d66-820c-24c260f59c62:lv=1417621210781:ss=1417619144492; _dy_geo=US.NA; krux_segs=n58825q2q%7Cooo3l4e96%7Cohph8wqcu%7Cm8yi6fn0f%7Couxjsml96%7Coeh287nzm%7Copjtfyu92%7Cn7szfo3xl%7Corj54ice4%7Com4sj6shu%7Cmimpufxui%7Cn7seltb6y%7Cn7szfoqt6%7Cn7szfomx3%7Cosewaclj3%7Colkt7d9x1%7Cnr9v9llm0%7Coxtp6iwgj%7Cm9ewee5pq%7Clmviw2vot%7Cn7szfp6hd%7Cn7szflyme%7Cn7szfp1ky%7Cm9pwujheh%7Cn7szfl4pr%7Cm8yye40vf%7Cobz8gonvw%7Cosihzsglx%7Cn7szfq00g%7Cosepjej6x%7Cogpp6a8ph%7Cn7szfnicn%7Coo7ak7npn%7Cmithviff8%7Coj2aw1ioh%7Cm9pwg0j70%7Corqp3nlu7%7Cmf94g1ng5%7Cosfb5x7ni%7Cn7szfqu4p%7Cn7szfpd5c%7Cn7szfo8qn%7Cosiv2aaqb%7Cn7szfpxrm%7Cos7bpagdd%7Copz7ovkmb%7Cose3hh4uj%7Coktlxay2x%7Cllf28yvry%7Cnxjo4r9x2%7Cn7szfpiuz%7Cn7szfn5z4%7Cor63eu8tq%7Cnxq8cvp69%7Consdjs5d5%7Cn55py3t5z%7Cn7szfozqo%7Cn4l4i077e%7Cn7szfpsa8%7Cmg1nsx1fv%7Cni23h8v7i%7Coe2qe4v6h%7Cnts9co5pn%7Cosmd7fhhy%7Cnv0z088vj%7Cm5m11hxs9%7Cnjr5hi4dg%7Cn7szfotw4%7Cn3qirawfw%7Cn7szfovgr%7Cor63qghhk%7Cn7szfpg8d%7Cn7szfq3ce%7Coj2f8sugv%7Col8a2b12r%7Com4xgijd5%7Cosia5rtou%7Cn7szfqg9h%7Cn7szfp3w0%7Cmith0bdg1%7Cm8yxv39ew%7Cmk1bczyjt%7Coi15lc4ig%7Corrl8dtnr%7Cnvjujpjr5%7Cn7szfohm8%7Cnvjps5n77%7Com37mgsm0%7Cm9pwj9zwc%7Colij9j24i%7Cosinwlerj%7Corfj4mfif%7Clmviretav%7Cmitha2f0p%7Cosd9mpckx%7Cosfjeop7w%7Cn7szfnfqa%7Copz7s44rg%7Copvlqddbx%7Cn7szfm50i%7Cn7szfqqcb%7Cmu2yn384m%7Cn7szfqkrg%7Coygqn8xqq%7Cose9dhiwy%7Cmiticd6en%7Coygp13c0e%7Cosiap3fde%7Cn7szfmnx5%7Cosbq85ja6%7Cor6nmdiqi%7Consa2ur7h%7Cm5qw3j39o%7Cn7szfoflt%7Cmk1apcr0l%7Cn7szfopag%7Cmimp808l7%7Cop628novu%7Cnnebseogg%7Conzln8357%7Cor63hay7s%7Clmvity5kb%7Cocuqd5reh%7Cot62o7t28%7Cnuzmoezkg%7Cn7szfmfna%7Cn7szfnpkk%7Cookj64uiq%7Cn7szfp9zx%7Cn7szfokt4%7Cm9h4kcgmq%7Cosh3bzwwo%7Cn7szfpn20%7Cmkdw07f0t%7Coypsztoyt%7Cn0jujk1xo%7Cn7szfodpt%7Cn7szfmbfg%7Cm8yjzdn6h%7Cn7szfnjri%7Cnv0695lgs%7Cnjrz9tpye%7Cmimr5pw0n%7Conrl71gcz%7Coonzp0li4%7Cosbscev80%7Cor7a8d230%7Cmil0ydr2y%7Conrjxld9v%7Cmgy7i5i8n%7Cor63arfps%7Col44qk36m%7Comvfswdjz%7Coe92g4cti%7Cow6bxaj2q%7Coe5xlqm5g%7Cosbun07ae%7Colokhjnjo%7Cor624qgz2%7Cm8yynb42j; nyt-a=2c61af26c5e5dd3243e5dacee20368db; _chartbeat4=t=BO41WDCIZ6YKNL9NxGUYXYZ2Whf&E=0&x=0&c=8.05&y=5051&w=429; _dyus_8765283=850%7C0%7C0%7C0%7C0%7C0.0.1397144713754.1417621169050.20476455.0%7C336%7C49%7C11%7C114%7C6%7C0%7C0%7C0%7C0%7C0%7C0%7C6%7C0%7C0%7C0%7C0%7C2%7C6%7C0%7C6%7C62%7C10%7C2; _dyrc=; adxcl=t*3e882=547fea4f:1415163821|t*3fe28=54813bcf:1415283269|t*3f9e8=54813bcf:1415287349|t*400ca=54828d4f:1415373334|t*40156=5485304f:1415584888|l*3bfc4=6013964f:1|t*40711=54a2314f:1417460577|t*3d7de=54ab6bcf:1415144032|lcig=55c42d3f:1|l*31068=566cfb4f:1|t*3f9cc=54c9be4f:1416238182|l*352b7=55c42d3f:1; adxcs=s*3eb33=0:1|s*3eb34=0:1|s*3fc77=0:1|s*3e7a3=0:1|s*3ee80=0:1|stiffany-sur=0:3|s*3f2f6=0:1|s*400ca=0:1|s*3f65b=0:1|s*401a6=0:1|s*3a3d4=0:1|si=0:1|s*3ef58=0:2|s*3f1eb=0:1|s*3f232=0:1; NYT-S=488tnv36oe3LC4x8aE6wiJBUN9UMCN5cRph1fqDAt4FAo8/Tmo1TI8r4dnlfH.PgAlyITOtMElPUh/1BHDL5FwxTgU/uxaXj5EheKVKOJ3FDzatRBLydWjyKvJJp.6isWKAOv4Pg3StLRJXdiICg4xQbQEigbFF5r9EA3S3wXCb8hRCPVdhsyeEbQQSz4dVrWCDjRfwsa3OHQnYGGpMlOwgep2harHhSvXpFdwHys/y/cCQx0aGXKsAHLKZUTSaBQLiew/8jh4FIfztkIt4yfhCeFnnlktqWFTbppAT5nE4HRWkZmSBpm9u5NXoAIORqPBPZ1aIBl0RbQfzBXnU2qc3cV.Ynx4rkFI; NYT-wpAB=0002|1&0010|2&0011|3&0012|1; NYT_W2=New%20YorkNYUS|ChicagoILUS|London--UK|Los%20AngelesCAUS|San%20FranciscoCAUS|Tokyo--JP; abc=123"; printf("Cookie is this long: %lu\n\n", strlen(cookiestra)); const char* cookiename = "NYT_W2"; const char* expected = "New%20YorkNYUS|ChicagoILUS|London--UK|Los%20AngelesCAUS|San%20FranciscoCAUS|Tokyo--JP"; char* actual = get_cookie(cookiestra, cookiename); TEST_ASSERT_EQUAL_STRING(expected, actual); }
void test_GetEmptyCookieC() { const char* cookiestra = "This=name; NYT_W2=; Other=abc"; const char* cookiename = "NYT_W2"; const char* expected = NULL; char* actual = get_cookie(cookiestra, cookiename); printf("I have:%s:\n", actual); TEST_ASSERT_EQUAL_STRING(expected, actual); }
static ucs_status_t uct_ugni_fetch_pmi() { int spawned = 0, rc; if(job_info.initialized) { return UCS_OK; } /* Fetch information from Cray's PMI */ rc = PMI_Init(&spawned); if (PMI_SUCCESS != rc) { ucs_error("PMI_Init failed, Error status: %d", rc); return UCS_ERR_IO_ERROR; } ucs_debug("PMI spawned %d", spawned); rc = PMI_Get_size(&job_info.pmi_num_of_ranks); if (PMI_SUCCESS != rc) { ucs_error("PMI_Get_size failed, Error status: %d", rc); return UCS_ERR_IO_ERROR; } ucs_debug("PMI size %d", job_info.pmi_num_of_ranks); rc = PMI_Get_rank(&job_info.pmi_rank_id); if (PMI_SUCCESS != rc) { ucs_error("PMI_Get_rank failed, Error status: %d", rc); return UCS_ERR_IO_ERROR; } ucs_debug("PMI rank %d", job_info.pmi_rank_id); rc = get_ptag(&job_info.ptag); if (UCS_OK != rc) { ucs_error("get_ptag failed, Error status: %d", rc); return rc; } ucs_debug("PMI ptag %d", job_info.ptag); rc = get_cookie(&job_info.cookie); if (UCS_OK != rc) { ucs_error("get_cookie failed, Error status: %d", rc); return rc; } ucs_debug("PMI cookie %d", job_info.cookie); /* Context and domain is activated */ job_info.initialized = true; ucs_debug("UGNI job info was activated"); return UCS_OK; }
void sel4utils_unmap_pages(vspace_t *vspace, void *vaddr, size_t num_pages, size_t size_bits, vka_t *vka) { uintptr_t v = (uintptr_t) vaddr; sel4utils_alloc_data_t *data = get_alloc_data(vspace); sel4utils_res_t *reserve = find_reserve(data, v); if (!sel4_valid_size_bits(size_bits)) { ZF_LOGE("Invalid size_bits %zu", size_bits); return; } if (vka == VSPACE_FREE) { vka = data->vka; } for (int i = 0; i < num_pages; i++) { seL4_CPtr cap = get_cap(data->top_level, v); /* unmap */ if (cap != 0) { int error = seL4_ARCH_Page_Unmap(cap); if (error != seL4_NoError) { ZF_LOGE("Failed to unmap page at vaddr %p", vaddr); } } if (vka) { cspacepath_t path; vka_cspace_make_path(vka, cap, &path); vka_cnode_delete(&path); vka_cspace_free(vka, cap); if (sel4utils_get_cookie(vspace, vaddr)) { vka_utspace_free(vka, kobject_get_type(KOBJECT_FRAME, size_bits), size_bits, sel4utils_get_cookie(vspace, vaddr)); } } if (reserve == NULL) { clear_entries(vspace, v, size_bits); } else { reserve_entries(vspace, v, size_bits); } assert(get_cap(data->top_level, v) != cap); assert(get_cookie(data->top_level, v) == 0); v += (1 << size_bits); vaddr = (void *) v; } }
static void send_packet( uint32_t destination_port, packet_in packet_in, uint32_t in_port ) { openflow_actions *actions = create_actions(); append_action_output( actions, destination_port, OFPCML_NO_BUFFER ); openflow_instructions *insts = create_instructions(); append_instructions_apply_actions( insts, actions ); oxm_matches *match = create_oxm_matches(); set_match_from_packet( match, in_port, NULL, packet_in.data ); buffer *flow_mod = create_flow_mod( get_transaction_id(), get_cookie(), 0, 0, OFPFC_ADD, 60, 0, OFP_HIGH_PRIORITY, packet_in.buffer_id, 0, 0, OFPFF_SEND_FLOW_REM, match, insts ); send_openflow_message( packet_in.datapath_id, flow_mod ); free_buffer( flow_mod ); delete_oxm_matches( match ); delete_instructions( insts ); if ( packet_in.buffer_id == OFP_NO_BUFFER ) { buffer *frame = duplicate_buffer( packet_in.data ); fill_ether_padding( frame ); buffer *packet_out = create_packet_out( get_transaction_id(), packet_in.buffer_id, in_port, actions, frame ); send_openflow_message( packet_in.datapath_id, packet_out ); free_buffer( packet_out ); free_buffer( frame ); } delete_actions( actions ); }
/*virtual*/ void completedHeaders(U32 status, std::string const& reason, AIHTTPReceivedHeaders const& headers) { if (status == HTTP_OK) { std::string value = get_cookie("_slm_session"); if (!value.empty()) { sMarketplaceCookie = value; } else if (sMarketplaceCookie.empty()) { llwarns << "No such cookie \"_slm_session\" received!" << llendl; } } }
void sock4cookie(t_options *opt) { char* url=NULL; char *receive=NULL; unsigned int contentsize; int size; t_datathread *data=NULL; int sock; SSL *ssl= NULL; data=malloc(sizeof(t_datathread)); EXIT_IFNULL(data, "Memory Error"); data->opt=*opt; sock=opensock(data); EXIT_IFNEG(sock, "Socket error"); if(data->opt.url.ssl && data->opt.proxy.ip != NULL) { prepare_connect(data, sock); ssl=opensocks(sock, &data->opt); } else { if(data->opt.url.ssl) ssl=opensocks(sock, &data->opt); } EXIT_IFNEG(catch_cookie(&url, data), "Too long url"); size = iosocket(sock, url, &receive, data->opt, ssl, &contentsize); if(size == -1) if(data->opt.debug) fprintf(stderr, "\n"); EXIT_IFNEG(size, "can't read on socket"); get_cookie(receive, size, &data->opt); *opt=data->opt; if(data->opt.url.ssl) closesocks(&ssl, sock); else close(sock); FREE_BUF(data); FREE_BUF(url); FREE_BUF(receive); }
static int report_trace(struct stackframe *frame, void *d) { struct module *mod; unsigned int *depth = d, addr = frame->pc, cookie = NO_COOKIE, cpu = smp_processor_id(); if (*depth) { mod = __module_address(addr); if (mod) { cookie = get_cookie(cpu, per_cpu(backtrace_buffer, cpu), current, NULL, mod, true); addr = addr - (unsigned long)mod->module_core; } marshal_backtrace(addr & ~1, cookie); (*depth)--; } return *depth == 0; }
static void send_flow_mod_discarding_all_packets( sw_entry *sw, uint16_t hard_timeout, uint16_t priority ) { struct ofp_match match; memset( &match, 0, sizeof( struct ofp_match ) ); match.wildcards = OFPFW_ALL; const uint16_t idle_timeout = 0; const uint32_t buffer_id = UINT32_MAX; const uint16_t flags = 0; buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, idle_timeout, hard_timeout, priority, buffer_id, OFPP_NONE, flags, NULL ); send_openflow_message( sw->datapath_id, flow_mod ); free_buffer( flow_mod ); debug( "Sent a flow_mod for discarding all packets received on %#" PRIx64 ".", sw->datapath_id ); }
static void delete_flows_of( uint64_t datapath_id, uint16_t port_no ) { struct ofp_match match; memset( &match, 0, sizeof( struct ofp_match ) ); match.wildcards = OFPFW_ALL; buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_DELETE, 0, 0, 0, 0, port_no, 0, NULL ); send_openflow_message( datapath_id, flow_mod ); free_buffer( flow_mod ); memset( &match, 0, sizeof( struct ofp_match ) ); match.wildcards = OFPFW_ALL; match.wildcards &= ( uint32_t ) ~OFPFW_IN_PORT; match.in_port = port_no; teardown_path_by_match( match ); }
void AdminView::main(std::string url) { std::string usercode = get_cookie("usercode"); if (usercode.size() <= 0){ content::message c; c.static_host = static_file_host; render("message",c); return; } std::string session_value = get_session(usercode); if (session_value != "admin"){ content::message c; c.static_host = static_file_host; render("message",c); return; } content::index c; c.static_host = static_file_host; render("index",c); }
static int report_trace(struct stackframe *frame, void *d) { unsigned int *depth = d, cookie = NO_COOKIE; unsigned long addr = frame->pc; if (*depth) { #if defined(MODULE) unsigned int cpu = get_physical_cpu(); struct module *mod = __module_address(addr); if (mod) { cookie = get_cookie(cpu, current, mod->name, false); addr = addr - (unsigned long)mod->module_core; } #endif marshal_backtrace(addr & ~1, cookie); (*depth)--; } return *depth == 0; }
static void send_packet( uint16_t destination_port, packet_in packet_in ) { openflow_actions *actions = create_actions(); append_action_output( actions, destination_port, UINT16_MAX ); struct ofp_match match; set_match_from_packet( &match, packet_in.in_port, 0, packet_in.data ); buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, 60, 0, UINT16_MAX, packet_in.buffer_id, OFPP_NONE, OFPFF_SEND_FLOW_REM, actions ); send_openflow_message( packet_in.datapath_id, flow_mod ); free_buffer( flow_mod ); if ( packet_in.buffer_id == UINT32_MAX ) { buffer *frame = duplicate_buffer( packet_in.data ); fill_ether_padding( frame ); buffer *packet_out = create_packet_out( get_transaction_id(), packet_in.buffer_id, packet_in.in_port, actions, frame ); send_openflow_message( packet_in.datapath_id, packet_out ); free_buffer( packet_out ); free_buffer( frame ); } delete_actions( actions ); }
static void send_flow_mod( uint64_t datapath_id, uint8_t *macsa, uint8_t *macda, uint16_t out_port ) { struct ofp_match match; memset( &match, 0, sizeof( match ) ); match.wildcards = ( OFPFW_ALL & ~( OFPFW_DL_SRC | OFPFW_DL_DST ) ); memcpy( match.dl_src, macsa, OFP_ETH_ALEN ); memcpy( match.dl_dst, macda, OFP_ETH_ALEN ); uint16_t idle_timeout = 0; uint16_t hard_timeout = 10; uint16_t priority = UINT16_MAX; uint32_t buffer_id = UINT32_MAX; uint16_t out_port_for_delete_command = OFPP_NONE; uint16_t flags = OFPFF_SEND_FLOW_REM; openflow_actions *actions = create_actions(); append_action_output( actions, out_port, UINT16_MAX ); buffer *flow_mod = create_flow_mod( get_transaction_id(), match, get_cookie(), OFPFC_ADD, idle_timeout, hard_timeout, priority, buffer_id, out_port_for_delete_command, flags, actions ); delete_actions( actions ); send_openflow_message( datapath_id, flow_mod ); free_buffer( flow_mod ); }
void WriteJokeHandler::main(std::string url) { std::string usercode = get_cookie("usercode"); cppcms::json::value json_error; json_error["result"] = false; json_error["reason"] = "user not login"; if (usercode.size() <= 0){ response_as_json(json_error); return; } std::string session_value = get_session(usercode); if (session_value != "user"){ response_as_json(json_error); return; } std::string title = request().post("title"); std::string content = request().post("content"); WriteJoke *writeJoke = new WriteJoke(); bool result = writeJoke->write_joke(title, content); cppcms::json::value json_result; json_result["result"] = result; response_as_json(json_result); delete writeJoke; }
void check_info(void) { int check,dummy; has_agi = ((_GemParBlk.global[0] == 0x0399 && get_cookie('MagX',NULL)) || (_GemParBlk.global[0] >= 0x0400) || (appl_find("?AGI") >= 0)); if (appl_xgetinfo(10,&check,&dummy,&dummy,&dummy)) { if (((check & 0x00ff) >= 9) || (mgxver >= 0x0300)) shutdown = 1; if (((check & 0x00ff) >= 7) && (!magix)) broadcast = 1; } else { if (_GemParBlk.global[0] >= 0x0400) { shutdown = 1; broadcast = 1; } } if (appl_xgetinfo(4,&dummy,&dummy,&check,&dummy)) { if (check) search = 1; } else { if (_GemParBlk.global[0] >= 0x0400) search = 1; } if (appl_xgetinfo(6,&dummy,&dummy,&check,&dummy)) { if (check) mbar = 1; } }
static void modify_flow_entry( const pathresolver_hop *h, const buffer *original_packet, uint16_t idle_timeout ) { const uint32_t wildcards = 0; struct ofp_match match; set_match_from_packet( &match, h->in_port_no, wildcards, original_packet ); uint32_t transaction_id = get_transaction_id(); openflow_actions *actions = create_actions(); const uint16_t max_len = UINT16_MAX; append_action_output( actions, h->out_port_no, max_len ); const uint16_t hard_timeout = 0; const uint16_t priority = UINT16_MAX; const uint32_t buffer_id = UINT32_MAX; const uint16_t flags = 0; buffer *flow_mod = create_flow_mod( transaction_id, match, get_cookie(), OFPFC_ADD, idle_timeout, hard_timeout, priority, buffer_id, h->out_port_no, flags, actions ); send_openflow_message( h->dpid, flow_mod ); delete_actions( actions ); free_buffer( flow_mod ); }