public async Task <IActionResult> Edit(string id, [Bind("Id,Type,InActive,InActiveDate")] AddrType addrType) { if (id != addrType.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(addrType); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AddrTypeExists(addrType.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(addrType)); }
public ulong typeID = 0; // NodeID, ClientID, etc #endregion Fields #region Constructors public PyAddress() { type = AddrType.Invalid; typeID = 0; callID = 0; service = ""; bcast_type = ""; }
public async Task <IActionResult> Create([Bind("Id,Type,InActive,InActiveDate")] AddrType addrType) { if (ModelState.IsValid) { _context.Add(addrType); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(addrType)); }
public IActionResult Create([FromBody] AddrType aType) { if (aType == null) { return(BadRequest()); } _context.AddrType.Add(aType); _context.SaveChanges(); return(CreatedAtRoute("GetAddrType", new { id = aType.Id }, aType)); }
private Expr transformLoad(string label, Cmd c, Expr toTransform) { AddrType addrType = AddrType.Unknown; if (Options.optimizeLoadITE) { addrType = (isStackAddress(this.current_label, c, this.loadAddressRegionDB)) ? AddrType.StackAddress : ((isBitmapAddress(this.current_label, c, this.loadAddressRegionDB)) ? AddrType.BitmapAddress : AddrType.Unknown); } return(splitMemoryOnAllLoads(toTransform, addrType, isNotBitmapAddress(this.current_label, c, this.loadAddressRegionDB), isNotStackAddress(this.current_label, c, this.loadAddressRegionDB))); }
//constructor without id's public Address(String addrLine, String city, String zip, String province, int floor, bool elevator, bool stairs, bool isBilling, AddrType addrType, String notes) { id = 0; orderId = 0; this.addrLine = addrLine; this.city = city; this.zip = zip; this.province = province; this.floor = floor; this.elevator = elevator; this.stairs = stairs; this.isBilling = isBilling; this.addrType = addrType; this.notes = notes; }
public static void add_addresses_to_email(MailMessage msg, string addrs, AddrType addr_type) { btnet.Util.write_to_log("to email addr: " + addrs); string separator_char = btnet.Util.get_setting("EmailAddressSeparatorCharacter", ","); string[] addr_array = addrs.Replace(separator_char + " ", separator_char).Split(separator_char[0]); for (int i = 0; i < addr_array.Length; i++) { string just_address = Email.simplify_email_address(addr_array[i]); string just_display_name = addr_array[i].Replace(just_address, "").Replace("<>", ""); if (addr_type == AddrType.to) { msg.To.Add(new MailAddress(just_address, just_display_name, Encoding.UTF8)); } else { msg.CC.Add(new MailAddress(just_address, just_display_name, Encoding.UTF8)); } } }
public IActionResult Update(string id, [FromBody] AddrType aType) { if (aType == null || aType.Id != id) { return(BadRequest()); } var uType = _context.AddrType.FirstOrDefault(t => t.Id == id); if (uType == null) { return(NotFound()); } uType.Type = aType.Type; uType.InActive = aType.InActive; uType.InActiveDate = aType.InActiveDate; _context.AddrType.Update(uType); _context.SaveChanges(); return(new NoContentResult()); }
public AwaitableWrapper WriteReply(Rep rep, AddrType atyp, byte[] addr, int port) { if (Status == Socks5Status.ReplySent) { throw getException("Socks5 reply has been already sent."); } Status = Socks5Status.ReplySent; var buf = this.buf; this.buf = null; buf[0] = (0x05); buf[1] = ((byte)rep); buf[2] = (0x00); buf[3] = ((byte)AddrType.IPv4Address); for (int i = 0; i < 4; i++) { buf[4 + i] = addr[i]; } buf[8] = (0x00); buf[9] = (0x00); return(Stream.WriteAsyncR(new BytesSegment(buf, 0, 10))); }
public bool Decode(PyObject from) { if (from.Type != PyObjectType.ObjectData) { return false; } PyObjectData obj = from.As<PyObjectData>(); if (obj.Name != "macho.MachoAddress") { return false; } if (obj.Arguments.Type != PyObjectType.Tuple) { return false; } PyTuple args = obj.Arguments.As<PyTuple>(); if (args.Items.Count < 3) { return false; } if (args.Items[0].Type != PyObjectType.String) { return false; } PyString typei = args.Items[0].As<PyString>(); switch (typei.Value) { case "A": if (args.Items.Count != 3) { return false; } if (!DecodeService(args.Items[1]) || !DecodeCallID(args.Items[2])) { return false; } type = AddrType.Any; break; case "N": if (args.Items.Count != 4) { return false; } if (!DecodeTypeID(args.Items[1]) || !DecodeService(args.Items[2]) || !DecodeCallID(args.Items[3])) { return false; } type = AddrType.Node; break; case "C": if (args.Items.Count != 4) { return false; } if (!DecodeTypeID(args.Items[1]) || !DecodeCallID(args.Items[2]) || !DecodeService(args.Items[3])) { return false; } type = AddrType.Client; break; case "B": if (args.Items.Count != 4) { return false; } type = AddrType.Broadcast; if (args.Items[1].Type != PyObjectType.String) { return false; } if (args.Items[3].Type != PyObjectType.String) { return false; } PyString bid = args.Items[1].As<PyString>(); PyString idt = args.Items[3].As<PyString>(); service = bid.Value; bcast_type = idt.Value; break; default: return false; } return true; }
public override List <Cmd> VisitCmdSeq(List <Cmd> cmdSeq) { if (!Options.splitMemoryModel) { return(base.VisitCmdSeq(cmdSeq)); } List <Cmd> newCmdSeq = new List <Cmd>(); foreach (Cmd c in cmdSeq) { if (c is AssignCmd) { AssignCmd ac = c as AssignCmd; Utils.Assert(ac.Lhss.Count == 1 && ac.Rhss.Count == 1, "Not handling parallel AssignCmd"); ac = new AssignCmd(Token.NoToken, new List <AssignLhs> { ac.Lhss[0] }, new List <Expr> { transformLoad(this.current_label, c, ac.Rhss[0]) }); switch (Utils.getSlashVerifyCmdType(ac)) { case SlashVerifyCmdType.Store8: case SlashVerifyCmdType.Store16: case SlashVerifyCmdType.Store32: case SlashVerifyCmdType.Store64: //mem := store(mem, y, e) { Tuple <Variable, Expr, Expr> storeArgs = Utils.getStoreArgs(ac); Expr store_addr = storeArgs.Item2; Expr store_value = storeArgs.Item3; AddrType addrType = AddrType.Unknown; if (Options.optimizeStoreITE) { if (isStackAddress(this.current_label, c, this.storeAddressRegionDB)) { addrType = AddrType.StackAddress; } else if (isBitmapAddress(this.current_label, c, this.storeAddressRegionDB)) { addrType = AddrType.BitmapAddress; } //else if (isMemAddress(this.current_label, c, this.storeAddressRegionDB)) { addrType = AddrType.MemAddress; } else { addrType = AddrType.Unknown; } } if (addrType == AddrType.StackAddress) { //adds mem_stack := STORE(mem_stack, addr, value); AssignCmd new_ac = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_stack)) }, new List <Expr> { new NAryExpr(Token.NoToken, (ac.Rhss[0] as NAryExpr).Fun, new List <Expr> { new IdentifierExpr(Token.NoToken, this.mem_stack), store_addr, store_value }) }); newCmdSeq.Add(new_ac); } else if (addrType == AddrType.BitmapAddress) { //adds mem_bitmap := STORE(mem_bitmap, addr, value); AssignCmd new_ac = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_bitmap)) }, new List <Expr> { new NAryExpr(Token.NoToken, (ac.Rhss[0] as NAryExpr).Fun, new List <Expr> { new IdentifierExpr(Token.NoToken, this.mem_bitmap), store_addr, store_value }) }); newCmdSeq.Add(new_ac); } else { if (this.splitProgram) { if (!isBitmapAddress(this.current_label, c, this.storeAddressRegionDB) && !isStackAddress(this.current_label, c, this.storeAddressRegionDB)) { newCmdSeq.Add(ac); } break; } Expr isAddrInBitmap = new NAryExpr(Token.NoToken, new FunctionCall(this.addrInBitmap), new List <Expr> { store_addr }); Expr isAddrInStack = new NAryExpr(Token.NoToken, new FunctionCall(this.addrInStack), new List <Expr> { store_addr }); newCmdSeq.Add(ac); Expr rhs; //may exist an execution such that the stack is written // mem_stack := ITE(isAddrInStack(storeAddr), STORE(mem_stack, addr, value), mem_stack); if (!isNotStackAddress(this.current_label, c, this.storeAddressRegionDB)) { rhs = new NAryExpr(Token.NoToken, new IfThenElse(Token.NoToken), new List <Expr> { isAddrInStack, new NAryExpr(Token.NoToken, (ac.Rhss[0] as NAryExpr).Fun, new List <Expr> { new IdentifierExpr(Token.NoToken, this.mem_stack), store_addr, store_value }), new IdentifierExpr(Token.NoToken, this.mem_stack) }); AssignCmd stack_ac = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_stack)) }, new List <Expr> { rhs }); newCmdSeq.Add(stack_ac); } //may exist an execution such that the bitmap is written // mem_bitmap := ITE(isAddrInBitmap(storeAddr), STORE(mem_bitmap, addr, value), mem_bitmap); if (!isNotBitmapAddress(this.current_label, c, this.storeAddressRegionDB)) { rhs = new NAryExpr(Token.NoToken, new IfThenElse(Token.NoToken), new List <Expr> { isAddrInBitmap, new NAryExpr(Token.NoToken, (ac.Rhss[0] as NAryExpr).Fun, new List <Expr> { new IdentifierExpr(Token.NoToken, this.mem_bitmap), store_addr, store_value }), new IdentifierExpr(Token.NoToken, this.mem_bitmap) }); AssignCmd bitmap_ac = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_bitmap)) }, new List <Expr> { rhs }); newCmdSeq.Add(bitmap_ac); } } break; } case SlashVerifyCmdType.RepStosB: { Tuple <Variable, Expr, Expr, Expr> repstosArgs = Utils.getRepStosbArgs(ac); Expr base_addr = repstosArgs.Item3; Expr length = repstosArgs.Item2; Expr isAddrInBitmap = new NAryExpr(Token.NoToken, new FunctionCall(this.addrInBitmap), new List <Expr> { base_addr }); Expr isAddrInStack = new NAryExpr(Token.NoToken, new FunctionCall(this.addrInStack), new List <Expr> { base_addr }); Expr rhs = new NAryExpr(Token.NoToken, new IfThenElse(Token.NoToken), new List <Expr> { isAddrInStack, new NAryExpr(Token.NoToken, (ac.Rhss[0] as NAryExpr).Fun, new List <Expr> { new IdentifierExpr(Token.NoToken, this.mem_stack), repstosArgs.Item2, repstosArgs.Item3, repstosArgs.Item4 }), new IdentifierExpr(Token.NoToken, this.mem_stack) }); AssignCmd stack_ac = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_stack)) }, new List <Expr> { rhs }); rhs = new NAryExpr(Token.NoToken, new IfThenElse(Token.NoToken), new List <Expr> { isAddrInBitmap, new NAryExpr(Token.NoToken, (ac.Rhss[0] as NAryExpr).Fun, new List <Expr> { new IdentifierExpr(Token.NoToken, this.mem_bitmap), repstosArgs.Item2, repstosArgs.Item3, repstosArgs.Item4 }), new IdentifierExpr(Token.NoToken, this.mem_bitmap) }); AssignCmd bitmap_ac = new AssignCmd(Token.NoToken, new List <AssignLhs>() { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_bitmap)) }, new List <Expr>() { rhs }); newCmdSeq.Add(ac); newCmdSeq.Add(stack_ac); newCmdSeq.Add(bitmap_ac); break; } default: { if (ac.Lhss.First().DeepAssignedVariable.Name.Equals("mem_stack")) { if (isBitmapAddress(this.current_label, c, this.storeAddressRegionDB) || isNotStackAddress(this.current_label, c, this.storeAddressRegionDB)) { break; } else if (isStackAddress(this.current_label, c, this.storeAddressRegionDB)) { AssignCmd updateStack = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_stack)) }, new List <Expr> { Utils.getSplitMemoryUpdateExpr(ac) }); newCmdSeq.Add(updateStack); break; } } else if (ac.Lhss.First().DeepAssignedVariable.Name.Equals("mem_bitmap")) { if (isStackAddress(this.current_label, c, this.storeAddressRegionDB) || isNotBitmapAddress(this.current_label, c, this.storeAddressRegionDB)) { break; } else if (isBitmapAddress(this.current_label, c, this.storeAddressRegionDB)) { AssignCmd updateBitmap = new AssignCmd(Token.NoToken, new List <AssignLhs> { new SimpleAssignLhs(Token.NoToken, new IdentifierExpr(Token.NoToken, this.mem_bitmap)) }, new List <Expr> { Utils.getSplitMemoryUpdateExpr(ac) }); newCmdSeq.Add(updateBitmap); break; } } newCmdSeq.Add(ac); break; } } } else { newCmdSeq.Add(c); } } return(base.VisitCmdSeq(newCmdSeq)); }
//private bool isMemAddress(string label, Cmd c, Dictionary<Tuple<string, Cmd, AssertCmd>, bool> db) //{ // return isRegionAddress(label, c, "GE_64", db); //} //takes an expression and substitutes desired mem for each load(mem,..) sub-expression private Expr splitMemoryOnAllLoads(Expr e, AddrType addrType, bool notBitmap, bool notStack) { //takes as input the addr expr of LOAD(mem,addr), and returns the desired expression for mem : ITE(addrInBitmap(.), mem_bitmap, ITE(..)) Func <Tuple <Expr, Expr>, Expr> getDesiredMemExpr = delegate(Tuple <Expr, Expr> load_info) { if (addrType == AddrType.StackAddress) { return(new IdentifierExpr(Token.NoToken, this.mem_stack)); } if (addrType == AddrType.BitmapAddress) { return(new IdentifierExpr(Token.NoToken, this.mem_bitmap)); } Expr addr = load_info.Item2; List <string> targetedMemSpacesNames = this.splitProgram ? Utils.getSplitMemoryAccessSpace(load_info.Item1 as NAryExpr).Select(i => i.Decl.Name).ToList() : new List <string> { "mem", "mem_bitmap", "mem_stack" }; Expr isAddrInBitmap = new NAryExpr(Token.NoToken, new FunctionCall(this.addrInBitmap), new List <Expr> { addr }); Expr isAddrInStack = new NAryExpr(Token.NoToken, new FunctionCall(this.addrInStack), new List <Expr> { addr }); Expr tmp = new IdentifierExpr(Token.NoToken, mem); if (!notBitmap && targetedMemSpacesNames.Contains("mem_bitmap")) //may target the bitmap { tmp = new NAryExpr(Token.NoToken, new IfThenElse(Token.NoToken), new List <Expr> { isAddrInBitmap, new IdentifierExpr(Token.NoToken, this.mem_bitmap), tmp }); } if (!notStack && targetedMemSpacesNames.Contains("mem_stack")) //may target the stack { tmp = new NAryExpr(Token.NoToken, new IfThenElse(Token.NoToken), new List <Expr> { isAddrInStack, new IdentifierExpr(Token.NoToken, this.mem_stack), tmp }); } return(tmp); }; //if there is no load, no point in recursing if (!(Utils.getNestedFunctions(e).Any(x => x.FunctionName.Contains("LOAD_LE")))) { return(e); } //we have one or more load expressions here. so let's recursively find them and substitute. if (e is NAryExpr) { //this is a load expression if ((e as NAryExpr).Fun.FunctionName.Contains("LOAD_LE")) { Tuple <Expr, Expr> load_args = Utils.getLoadArgs(e); if (this.splitProgram && load_args.Item1 is IdentifierExpr) { return(e); } Expr desired_mem = getDesiredMemExpr(load_args); //even the address expression can have a load return(new NAryExpr(Token.NoToken, (e as NAryExpr).Fun, new List <Expr> { desired_mem, splitMemoryOnAllLoads(load_args.Item2, addrType, notBitmap, notStack) })); } else { //not a load expression, but we need to recurse List <Expr> new_args = new List <Expr>(); foreach (Expr arg in (e as NAryExpr).Args) { new_args.Add(splitMemoryOnAllLoads(arg, addrType, notBitmap, notStack)); } return(new NAryExpr(Token.NoToken, (e as NAryExpr).Fun, new_args)); } } if (e is BvExtractExpr) { return(new BvExtractExpr(Token.NoToken, splitMemoryOnAllLoads((e as BvExtractExpr).Bitvector, addrType, notBitmap, notStack), (e as BvExtractExpr).End, (e as BvExtractExpr).Start)); } if (e is BvConcatExpr) { return(new BvConcatExpr(Token.NoToken, splitMemoryOnAllLoads((e as BvConcatExpr).E0, addrType, notBitmap, notStack), splitMemoryOnAllLoads((e as BvConcatExpr).E1, addrType, notBitmap, notStack))); } if (e is IdentifierExpr) { return(e); //cant } if (e is LiteralExpr) { return(e); } Utils.Assert(false, "Should not get here"); return(null); }
public TAddressType(string privKey, string address, AddrType type) { this.privKey = privKey; this.address = address; this.type = type; }