The issue isn't only the AF_CAN and PF_CAN. The lower levels need to deal with the socketCAN infrastructure. The best way to do this is to research what happens with AF_CAN and PF_CAN in sockets.c. The socketCAN interface has been usable in Linux now for almost 10 years. In fact the newest code I was looking at now also supports CANFD which is an enhancement to the original CAN protocol that supports larger messages at higher data rates for the data part.
Even if CANFD was not supported initially I suspect the best thing to do is to port the socketCAN section from the C code to the pascal side. Then rewrite, again without the CANFD support, the command line applications that are written in C like candump.
The candump application is clever enough to know the difference between a Lawicel CANUSB dongle and say the SPI based Pi MCP2515 or the Beagle embledded CAN device. In both cases those devices show up as files that can be opened.
To do most of this one doesn't have to actually know much about CAN, although it's useful, but mostly about how Linux handles devices that are files and how the socket communications deals with them. It's on my do list.
John