Trunks and extesnsions are terms used in GUIs for Asterisk, not Asterisk itself. An extension in Asterisk is not a pysical object, but simply a number or other string that identifies a service. There is no explicit distinction in files like sp.conf.
Asterisk GUIs tend to categorise devices into trunks and extensions, but this is the wrong forum for details about he implementation of those GUIs.
If you are using raw Asterisk, and you want to enumerate GUI type extensions and extensions, you need to structure your channel driver configuration files and extension files in similar ways to those used by the GUIs.