Protocol 120 of 81Layer 7FrameAssembly v3.3.0
Raw .mdllms-full.txt
c1222ANSI C12.22 / IEEE 1703 Smart-Meter Utility AMI Application Protocol

c1222 — Port 1153 ANSI C12.22 / IEEE 1703 Smart Grid AMI Tables

Default Port / Protocol
UDP 1153 (or TCP 1153 via transport tcp)
Host Endpoint Rule
Dual-Stack IPv4/IPv6
Wireshark Display Filter
c1222
Standards & Specs
ANSI C12.22-2012, IEEE 1703, ANSI C12.19 (Tables)
Wire Stack:Ethernet II[802.1Q / QinQ / MPLS]IPv4 / IPv6UDP 1153 (or TCP 1153 via transport tcp) (transport tcp|udp)ANSI C12.22 (AMI Smart Grid)
L2 Tagging: vlan · qinq · repeatable mpls · fcsHost Family: Dual-Stack IPv4/IPv6L3 QoS & TTL: ttl · dscp · ecnL4 State: transport tcp|udp|sctp (default udp)

What It Does on the Wire

Utility smart-meter AMI headends communicate over ANSI C12.22 on port 1153: c1222 encodes ASN.1 BER ACSE AP-titles (callingap, calledap) and EPSEM C12.19 table reads/writes (tableid).

ANSI C12.22 (c1222, IEEE 1703) transports ANSI C12.19 smart electric/gas/water meter tables across utility Advanced Metering Infrastructure (AMI) head-end servers, field-area mesh collectors, and IPv4/IPv6 smart meters on UDP or TCP port 1153. Every C12.22 frame wraps an ISO 8650 ASN.1 BER ACSE header (Calling-AP-title OID, Called-AP-title OID, Calling/Called AP-invocation-id) around an Extended Protocol Specification for Electric Metering (EPSEM) payload (EPSEM Control byte, optional ED-Class, and PSEM service codes: 0x20 Identify, 0x50 Logon, 0x30 Full Table Read, 0x40 Full Table Write, 0x52 Logoff, 0x21 Terminate).

FrameAssembly encodes valid ASN.1 BER ACSE OIDs, BER length octets, and ANSI C12.19 tableid read/write requests and <OK> (0x00) responses.

01. Application

AMI Head-End <-> Collector Firewall & Remote-Disconnect IDS Audits

Verify utility head-end firewalls allow authorized ANSI C12.19 billing table reads (c1222 read tableid 0 / tableid 23) on port 1153 while alerting on unauthorized c1222 write remote-disconnect or tariff modifications.

02. Application

IPv6 Field-Area Network (FAN / Wi-SUN) Smart Meter Telemetry Labs

Run identical c1222 ACSE + EPSEM exchanges over IPv6 (2001:db8:a001::/64) smart-meter mesh endpoints and Wireshark’s built-in c1222 dissector.

03. Application

EPSEM Error / Security Access Denied (errcode) Testing

Inject PSEM response codes (errcode 0x04 ISC Insufficient Security Clearance, 0x05 ONP Operation Not Possible) to test AMI head-end error handling.

Fig. 1 · RFC Octet & Bit Schematic

RFC Wire Header Layout (c1222)

Select any 32-bit wire word or field slice below to inspect which .frasm modifiers control those octets and what defaults the compiler writes.

0 ··············· 15 · 16 ··············· 31 bit
Selected Wire Segment
ANSI C12.22 (AMI Smart Grid) Wire PDU & Payload (Variable)
Controlling .frasm Modifiers
c1222 read · callingap · callingid · epsemctrl · tableid · payload · hexpayload
Compiler Default Behavior
RFC-compliant ANSI C12.22 (AMI Smart Grid) defaults (ANSI C12.22-2012)

Minimal Quickstart (c1222_quickstart.frasm)

Select Preview Packets to compile in-browser and inspect timestamps + wire byte lengths, or open directly in the Playground.

c1222_quickstart.frasm7 lines
Open in Playground
host ami_headend { ip 10.115.1.10 }
host smart_meter { ip 10.115.20.45 }
compile {
ami_headend -> smart_meter c1222 read callingap 1.3.6.1.4.1.9999.1 calledap 1.3.6.1.4.1.9999.45 callingid 1 tableid 1 wait 5ms
ami_headend <- smart_meter c1222 response callingap 1.3.6.1.4.1.9999.45 calledap 1.3.6.1.4.1.9999.1 callingid 1 value 4820
}

Handled Automatically on the Wire

  • Defaults to UDP destination port 1153 (transport tcp switches to stateful TCP 1153) and formats the outer ASN.1 BER 0x60 (AARE/AARQ C12.22 ACSE PDU) envelope.
  • Encodes callingap and calledap dotted OIDs in ASN.1 BER Object Identifier format alongside callingid / calledid invocation integers.
  • Builds the inner user-information (0xbe) EPSEM frame with epsemctrl (0x80 Cleartext), big-endian 16-bit C12.19 tableid, and 1-byte checksum.
Multi-Frame Example

IPv6 Wi-SUN Smart Meter Billing Collection: Identify, Logon, C12.19 Table 23 Read & Logoff

Simulates an IPv6 utility AMI collector identifying a residential smart meter, logging on, reading ANSI C12.19 Standard Table 23 (Current Register Data), and terminating the session.

c1222_ipv6_smart_meter_ami.frasm16 lines
Open in Playground
host collector_v6 { ip 2001:db8:1153::1 }
host meter_0042 { ip 2001:db8:1153::42 }
compile {
// 1. EPSEM Identify (0x20) -> <OK> (0x00) Response
collector_v6 -> meter_0042 c1222 identify callingap 1.3.6.1.4.1.33500.1 calledap 1.3.6.1.4.1.33500.42 callingid 10 wait 4ms
collector_v6 <- meter_0042 c1222 response callingap 1.3.6.1.4.1.33500.42 calledap 1.3.6.1.4.1.33500.1 callingid 10 errcode 0 wait 6ms
// 2. EPSEM Logon (0x50) -> <OK>
collector_v6 -> meter_0042 c1222 logon callingap 1.3.6.1.4.1.33500.1 calledap 1.3.6.1.4.1.33500.42 callingid 11 wait 4ms
collector_v6 <- meter_0042 c1222 ok callingap 1.3.6.1.4.1.33500.42 calledap 1.3.6.1.4.1.33500.1 callingid 11 wait 6ms
// 3. Full Read (0x30) of ANSI C12.19 Table 23 (Current Register Data kWh)
collector_v6 -> meter_0042 c1222 read callingap 1.3.6.1.4.1.33500.1 calledap 1.3.6.1.4.1.33500.42 callingid 12 tableid 23 wait 5ms
collector_v6 <- meter_0042 c1222 response callingap 1.3.6.1.4.1.33500.42 calledap 1.3.6.1.4.1.33500.1 callingid 12 value 12845 wait 6ms
// 4. Graceful Terminate (0x21)
collector_v6 -> meter_0042 c1222 terminate callingap 1.3.6.1.4.1.33500.1 calledap 1.3.6.1.4.1.33500.42 callingid 13
}
Terminal Commands (FrameAssembly CLI v3.3.0)
# 1. Eyeball relative timestamps, ports & wire lengths in your terminal
frameassembly show c1222_ipv6_smart_meter_ami.frasm

# 2. Compile .frasm -> classic .pcap, nanosecond .pcapng, or pipe via '-'
frameassembly c1222_ipv6_smart_meter_ami.frasm c1222_ipv6_smart_meter_ami.pcap
frameassembly c1222_ipv6_smart_meter_ami.frasm c1222_ipv6_smart_meter_ami.pcapng

# 3. Round-trip .pcap <-> .frasm whenever you want to scrub or tweak an existing capture
frameassembly reverse c1222_ipv6_smart_meter_ami.pcap c1222_ipv6_smart_meter_ami_edited.frasm

# 4. Verify dissected protocol fields in tshark
tshark -r c1222_ipv6_smart_meter_ami.pcap -Y "c1222"

All c1222 Keywords & Header Options

Every sub-keyword and header option is lowercase [a-z0-9]+ with zero underscores — mix and match them in any order after c1222:

src_host -> dst_host c1222 [read | write | identify | logon | logoff | terminate | response | ok | service "<text_or_num>"] [callingap <oid>] [calledap <oid>] [callingid <number>] [calledid <number>] [epsemctrl <0..255>] [edclass <number>] [tableid <0..65535>] [value <0..65535>] [errcode <0..255>] [transport <udp|tcp>]
Keyword / OptionAccepted ValueDefaultEffect on Packet
read | write | identify | logon | logoff | terminate | response | ok | service "<text_or_num>"EPSEM PSEM Service Code (0x20 Identify, 0x21 Terminate, 0x30 Read, 0x40 Write, 0x50 Logon, 0x52 Logoff, 0x00 OK)read (0x30)Selects the EPSEM Request or Response service byte inside the ACSE user-information block.
callingap <oid> | calledap <oid>Dotted ASN.1 OID (unquoted 1.3.6.1... or quoted "1.3.6.1...")1.3.6.1.4.1.9999.1 / 1.3.6.1.4.1.9999.2Encodes Calling-AP-title (0xa6) and Called-AP-title (0xa2) universal ApTitles.
callingid <number> | calledid <number>32-bit AP-invocation-id integerscallingid 1Encodes Calling-AP-invocation-id (0xa8) and optional Called-AP-invocation-id (0xa4).
epsemctrl <0..255> | edclass <number>8-bit EPSEM Control byte & optional 32-bit End-Device Classepsemctrl 0x80 (Reserved bit, cleartext)Writes the EPSEM Control header byte and optional 4-byte ED-Class when bit 0x10 is set.
tableid <0..65535> | value <0..65535> | errcode <0..255>16-bit ANSI C12.19 Table ID, 16-bit Table Data Word, and 8-bit PSEM Response Code (0x00 OK)tableid 1, value 0, errcode 0Populates C12.19 Table Read/Write payloads and <OK>/<ERR> response codes.
transport <udp|tcp>udp or tcpudpSwitches Layer 4 between connectionless C12.22/UDP (1153) and stateful TCP (1153).

Cross-Layer Wrappers Valid with c1222

802.1Q VLAN / QinQ / MPLS tags, IPv4/IPv6 QoS & TTL fields, wait gaps, and transport overrides allowed on this protocol

15 options
OptionRange / FormatDefaultEffect on Packet
wait <number><ns|us|ms|s|m>Time gap (ns, us, ms, s, m)10msAdvances the packet timestamp clock after sending this packet and before the next packet (wait 0ns sends back-to-back).
comment "<text>"Quoted UTF-8 annotationOmittedAttaches an Enhanced Packet Block opt_comment annotation when compiling to .pcapng (Wireshark pkt_comment filter).
payload "<text>" | hexpayload "<hex>"Quoted text or hex bytes (choose one)OmittedAppends or overrides raw payload bytes ("deadbeef", "de:ad:be:ef", or "\x01\x02") and updates packet lengths and checksums.
srcmac <mac> | dstmac <mac> | ethertype <0..65535>Colon/hyphen/Cisco MAC · EtherType 0..65535 (e.g. 0x0800)Host MAC / RFC multicast MAC / auto EtherTypeOverrides the 14-byte Ethernet II source MAC, destination MAC, or standalone Layer 2 16-bit EtherType.
fcs | badfcsEthernet CRC-32 trailer flags (choose one)Omittedfcs appends a valid IEEE 802.3 4-byte CRC-32 Frame Check Sequence trailer; badfcs XOR-corrupts the CRC-32 for NIC/tap negative tests.
vlan <0..4095> [pcp <0..7>] [dei <0|1>]VLAN ID 0..4095, PCP 0..7, DEI 0..1UntaggedWraps the packet in an IEEE 802.1Q VLAN tag (0x8100) with optional 802.1p QoS priority.
qinq <0..4095> [innervlan <0..4095>]Outer S-VLAN 0..4095, Inner C-VLAN 0..4095Untagged (innervlan 1 when qinq is set)Double-tags the packet with outer IEEE 802.1ad S-Tag (0x88a8) plus inner IEEE 802.1Q C-Tag (0x8100).
mpls <0..1048575> [label <0..1048575>] [exp|tc <0..7>] [bos <0|1>] [mplsttl <0..255>]Repeatable label stack (0..1048575, exp/tc 0..7, bos 0..1, ttl 0..255)Unlabeled (auto bos=0 on outer labels, bos=1 on bottom)Prepends one or more 32-bit MPLS label shims (0x8847, e.g. mpls 16000 mpls 24010) ahead of Layer 2 EoMPLS or Layer 3 payloads.
ttl <0..255> [dscp <0..63>] [ecn <0..3>]TTL/Hop Limit 0..255, DSCP 0..63, ECN 0..3ttl 64, dscp 0, ecn 0Sets IPv4 TTL or IPv6 Hop Limit plus DiffServ (DSCP) and ECN QoS markings.
ipid <0..65535> [df] [mf] [fragoffset <0..8191>] [routeralert] [badipchecksum]IPv4 ID, DF/MF flags, offset 0..8191, Router Alert & checksum faultipid 1, flags 0, fragoffset 0, valid RFC 1071 checksumSets IPv4 Identification/fragmentation, injects RFC 2113 Router Alert (20 04 00 00), or corrupts the 16-bit IPv4 header checksum (badipchecksum).
flowlabel <0..1048575>20-bit IPv6 Flow Label (0..1048575)0Sets the 20-bit IPv6 Flow Label for ECMP routing tests (valid on IPv6 endpoint pairs only).
srcport <0..65535> | dstport <0..65535>Port number 0..65535srcport 49152 (remembered), UDP 1153 (or TCP 1153 via transport tcp)Overrides source or destination port and remembers the port pair automatically on <- replies.
transport <tcp|udp|sctp>tcp, udp, or sctp (dual TCP/UDP + universal L7 SCTP)transport udpSwitches Layer 4 transport between stateful TCP, connectionless UDP, or Castagnoli CRC-32c SCTP association.
badchecksum | nochecksumL4 checksum fault or UDP zero-checksum flagValid RFC checksum / CRC-32cbadchecksum corrupts the L4 checksum for negative firewall/NIC offload tests; nochecksum writes 0x0000 in UDP headers.
seq <number> | acknum <number> | win|window <0..65535> | urgent <0..65535> | syn | ack | psh | fin | rst | urg | ece | cwrTCP sequence/ack numbers, window, flags, SACK, TCP-MD5 & TFO optionspsh ack, win 65535, automatic TCP seq/acknumWhen using TCP (transport tcp or default TCP): overrides automatic TCP sequence tracking, flags, or mss/wscale/sackperm/sackblock/tsval/tsecr/tcpmd5/tfo.

Gotchas & Quick Fixes

Pass Valid Dotted Numeric OIDs (At Least 2 Arcs) to callingap / calledap

Rejected
headend -> meter c1222 read callingap "meter01"
Valid v3.3.0 Syntax
headend -> meter c1222 read callingap 1.3.6.1.4.1.9999.1 calledap 1.3.6.1.4.1.9999.2

ANSI C12.22 ApTitle fields are ASN.1 BER OBJECT IDENTIFIER values (1.3.6.1... or 2.16.124...), not free-form hostnames.

Swap callingap and calledap on Meter <- Responses

Valid v3.3.0 Syntax
h -> m c1222 identify callingap 1.3.6.1.4.1.99.1 calledap 1.3.6.1.4.1.99.2 h <- m c1222 ok callingap 1.3.6.1.4.1.99.2 calledap 1.3.6.1.4.1.99.1

When the smart meter responds, its own ApTitle becomes Calling-AP-title and the head-end’s OID becomes Called-AP-title.

Field Guide 03
Poke Stateful Firewalls, Suricata, Zeek & OT Conduits