Freeciv-3.2
Loading...
Searching...
No Matches
Public Member Functions | Data Fields | Static Public Attributes
generate_packets.Packet Class Reference
+ Inheritance diagram for generate_packets.Packet:

Public Member Functions

 __init__ (self, ScriptConfig cfg, str packet_type, int packet_number, str flags_text, typing.Iterable[str] lines, typing.Callable[[str], RawFieldType] resolve_type)
 
str name (self)
 
bool no_packet (self)
 
str extra_send_args (self)
 
str extra_send_args2 (self)
 
str extra_send_args3 (self)
 
str send_prototype (self)
 
str lsend_prototype (self)
 
str dsend_prototype (self)
 
str dlsend_prototype (self)
 
"set[str]" all_caps (self)
 
str get_struct (self)
 
str get_prototypes (self)
 
str get_stats (self)
 
str get_report_part (self)
 
str get_reset_part (self)
 
str get_send (self)
 
str get_variants (self)
 
str get_lsend (self)
 
str get_dsend (self)
 
str get_dlsend (self)
 

Data Fields

 cfg
 
 type
 
 type_number
 
 cancel
 
 is_info
 
 want_dsend
 
 want_lsend
 
 want_force
 
 want_pre_send
 
 want_post_send
 
 want_post_recv
 
 delta
 
 no_handle
 
 handle_via_packet
 
 handle_per_conn
 
 name
 
 dirs
 
 all_fields
 
 fields
 
 variants
 

Static Public Attributes

 CANCEL_PATTERN = re.compile(r"^cancel\((.*)\‍)$")
 
str is_info = "no"
 
bool want_dsend = False
 
bool want_lsend = False
 
bool want_force = False
 
bool want_pre_send = False
 
bool want_post_send = False
 
bool want_post_recv = False
 
bool delta = True
 
bool no_handle = False
 
bool handle_via_packet = True
 
bool handle_per_conn = False
 

Detailed Description

Represents a single packet type (possibly with multiple variants)

Definition at line 2512 of file generate_packets.py.

Constructor & Destructor Documentation

◆ __init__()

generate_packets.Packet.__init__ (   self,
ScriptConfig  cfg,
str  packet_type,
int  packet_number,
str  flags_text,
typing.Iterable[str lines,
typing.Callable[[str], RawFieldType resolve_type 
)

Reimplemented in generate_packets.PacketsDefinition.

Definition at line 2561 of file generate_packets.py.

Member Function Documentation

◆ all_caps()

"set[str]" generate_packets.Packet.all_caps (   self)
Set of all capabilities affecting this packet

Reimplemented in generate_packets.PacketsDefinition.

Definition at line 2746 of file generate_packets.py.

◆ dlsend_prototype()

str generate_packets.Packet.dlsend_prototype (   self)
Prototype for the dlsend function (directly takes values; list of connections)

Definition at line 2739 of file generate_packets.py.

◆ dsend_prototype()

str generate_packets.Packet.dsend_prototype (   self)
Prototype for the dsend function (directly takes values instead of a packet struct)

Definition at line 2733 of file generate_packets.py.

◆ extra_send_args()

str generate_packets.Packet.extra_send_args (   self)
Argements for the regular send function

Definition at line 2692 of file generate_packets.py.

◆ extra_send_args2()

str generate_packets.Packet.extra_send_args2 (   self)
Arguments passed from lsend to send

See also extra_send_args

Definition at line 2701 of file generate_packets.py.

◆ extra_send_args3()

str generate_packets.Packet.extra_send_args3 (   self)
Arguments for the dsend and dlsend functions

Definition at line 2713 of file generate_packets.py.

◆ get_dlsend()

str generate_packets.Packet.get_dlsend (   self)
Generate the implementation of the dlsend function, combining
dsend and lsend functionality.

See self.get_dsend() and self.get_lsend()

Definition at line 2891 of file generate_packets.py.

◆ get_dsend()

str generate_packets.Packet.get_dsend (   self)
Generate the implementation of the dsend function, which directly
takes packet fields instead of a packet struct.

Definition at line 2871 of file generate_packets.py.

◆ get_lsend()

str generate_packets.Packet.get_lsend (   self)
Generate the implementation of the lsend function, which takes
a list of connections to send a packet to.

Definition at line 2857 of file generate_packets.py.

◆ get_prototypes()

str generate_packets.Packet.get_prototypes (   self)
Generate the header prototype declarations for the public
functions associated with this packet.

Definition at line 2769 of file generate_packets.py.

◆ get_report_part()

str generate_packets.Packet.get_report_part (   self)
Generate this packet's part of the delta_stats_report() function.

See Variant.get_report_part() and
PacketsDefinition.code_delta_stats_report

Definition at line 2795 of file generate_packets.py.

◆ get_reset_part()

str generate_packets.Packet.get_reset_part (   self)
Generate this packet's part of the delta_stats_reset() function.

See Variant.get_reset_part() and
PacketsDefinition.code_delta_stats_reset

Definition at line 2802 of file generate_packets.py.

◆ get_send()

str generate_packets.Packet.get_send (   self)
Generate the implementation of the send function, which sends a
given packet to a given connection.

Definition at line 2809 of file generate_packets.py.

◆ get_stats()

str generate_packets.Packet.get_stats (   self)
Generate the code declaring counters for this packet's variants.

See Variant.get_stats()

Definition at line 2789 of file generate_packets.py.

◆ get_struct()

str generate_packets.Packet.get_struct (   self)
Generate the struct definition for this packet

Definition at line 2751 of file generate_packets.py.

◆ get_variants()

str generate_packets.Packet.get_variants (   self)
Generate all code associated with individual variants of this
packet; see the Variant class (and its methods) for details.

Definition at line 2837 of file generate_packets.py.

◆ lsend_prototype()

str generate_packets.Packet.lsend_prototype (   self)
Prototype for the lsend function (takes a list of connections)

Definition at line 2727 of file generate_packets.py.

◆ name()

str generate_packets.Packet.name (   self)
Snake-case name of this packet type

Definition at line 2681 of file generate_packets.py.

◆ no_packet()

bool generate_packets.Packet.no_packet (   self)
Whether this packet's send functions should take no packet
argument. This is the case iff this packet has no fields.

Definition at line 2686 of file generate_packets.py.

◆ send_prototype()

str generate_packets.Packet.send_prototype (   self)
Prototype for the regular send function

Definition at line 2722 of file generate_packets.py.

Field Documentation

◆ all_fields

generate_packets.Packet.all_fields

Definition at line 2645 of file generate_packets.py.

◆ cancel

generate_packets.Packet.cancel

Definition at line 2575 of file generate_packets.py.

◆ CANCEL_PATTERN

generate_packets.Packet.CANCEL_PATTERN = re.compile(r"^cancel\((.*)\‍)$")
static

Definition at line 2515 of file generate_packets.py.

◆ cfg

generate_packets.Packet.cfg

Definition at line 2563 of file generate_packets.py.

◆ delta [1/2]

bool generate_packets.Packet.delta = True
static

Definition at line 2547 of file generate_packets.py.

◆ delta [2/2]

generate_packets.Packet.delta

Definition at line 2613 of file generate_packets.py.

◆ dirs

generate_packets.Packet.dirs

Definition at line 2634 of file generate_packets.py.

◆ fields

generate_packets.Packet.fields

Definition at line 2652 of file generate_packets.py.

◆ handle_per_conn [1/2]

bool generate_packets.Packet.handle_per_conn = False
static

Definition at line 2557 of file generate_packets.py.

◆ handle_per_conn [2/2]

generate_packets.Packet.handle_per_conn

Definition at line 2622 of file generate_packets.py.

◆ handle_via_packet [1/2]

bool generate_packets.Packet.handle_via_packet = True
static

Definition at line 2553 of file generate_packets.py.

◆ handle_via_packet [2/2]

generate_packets.Packet.handle_via_packet

Definition at line 2619 of file generate_packets.py.

◆ is_info [1/2]

str generate_packets.Packet.is_info = "no"
static

Definition at line 2521 of file generate_packets.py.

◆ is_info [2/2]

generate_packets.Packet.is_info

Definition at line 2589 of file generate_packets.py.

◆ name

generate_packets.Packet.name

Definition at line 2630 of file generate_packets.py.

◆ no_handle [1/2]

bool generate_packets.Packet.no_handle = False
static

Definition at line 2550 of file generate_packets.py.

◆ no_handle [2/2]

generate_packets.Packet.no_handle

Definition at line 2616 of file generate_packets.py.

◆ type

generate_packets.Packet.type

Definition at line 2565 of file generate_packets.py.

◆ type_number

generate_packets.Packet.type_number

Definition at line 2570 of file generate_packets.py.

◆ variants

generate_packets.Packet.variants

Definition at line 2674 of file generate_packets.py.

◆ want_dsend [1/2]

bool generate_packets.Packet.want_dsend = False
static

Definition at line 2525 of file generate_packets.py.

◆ want_dsend [2/2]

generate_packets.Packet.want_dsend

Definition at line 2595 of file generate_packets.py.

◆ want_force [1/2]

bool generate_packets.Packet.want_force = False
static

Definition at line 2533 of file generate_packets.py.

◆ want_force [2/2]

generate_packets.Packet.want_force

Definition at line 2601 of file generate_packets.py.

◆ want_lsend [1/2]

bool generate_packets.Packet.want_lsend = False
static

Definition at line 2529 of file generate_packets.py.

◆ want_lsend [2/2]

generate_packets.Packet.want_lsend

Definition at line 2598 of file generate_packets.py.

◆ want_post_recv [1/2]

bool generate_packets.Packet.want_post_recv = False
static

Definition at line 2543 of file generate_packets.py.

◆ want_post_recv [2/2]

generate_packets.Packet.want_post_recv

Definition at line 2610 of file generate_packets.py.

◆ want_post_send [1/2]

bool generate_packets.Packet.want_post_send = False
static

Definition at line 2540 of file generate_packets.py.

◆ want_post_send [2/2]

generate_packets.Packet.want_post_send

Definition at line 2607 of file generate_packets.py.

◆ want_pre_send [1/2]

bool generate_packets.Packet.want_pre_send = False
static

Definition at line 2537 of file generate_packets.py.

◆ want_pre_send [2/2]

generate_packets.Packet.want_pre_send

Definition at line 2604 of file generate_packets.py.