3. The method of claim 1 wherein the determining whether the given script entry is a last script entry comprises: determining whether an end of packet (EOP) indicator in the given script entry indicates that the given script entry is the last script entry for the modified data packet.
1. A method for modifying a data packet by a hardware-based packet editor comprising: receiving, by the packet editor, a packet editing script comprising one or more script entries indicating modifications to be applied to the data packet and a data block comprising data for the modified packet; for each given script entry in the packet editing script, copying, by the packet editor, data in the data block at a location and a size identified in the given script entry into a packet buffer; generating, by the packet editor, a modified data packet with the data in the packet buffer, wherein the copying comprises: retrieving the given script entry of the packet editing script; determining whether the given script entry is a first script entry for the modified data packet; in response to determining that the given script entry is the first script entry for the modified data packet, reserving the packet buffer for the modified data packet; copying the data in the data block at a block location and with a block length identified in the given script entry into the packet buffer; determining whether the given script entry is a last script entry for the modified data packet; and in response to determining that the given script entry is not the last script entry for the modified data packet, performing the copying the data in the data block at a block location and with a block length identified in the given script entry into the packet buffer and the determining whether the given script entry is a last script entry for the next given script entry of the packet editing script.