Securing Embedded Systems: from Device Level to Network Level