CDP is sent as a layer 2 multicast sent to the address 01:00:0c:cc:cc:cc
For more details refer here -
http://www.cisco.com/en/US/products/hw/switches/ps663/products_tech_note09186a0080094713.shtml#cdp
Wikipedia has some reasonable detail as well -
http://en.wikipedia.org/wiki/Cisco_Discovery_Protocol
There are no queries sent out by any devices - each device (such as the phone) just advertises it's details at periodical intervals and relies on the router or switch to build up a database of entries, which can then be examined by the "SHOW CDP NEIGHBOR DETAIL"
If all you want to do is send out a CDP packet, technically you could just send a crafted hex file that is the representation of the CDP details direct to the NIC of a PC.
If you want to determine details about phones on the network you would need to listen for all traffic on the 01:00:0c:cc:cc:cc multicast MAC address then simply build up a table of entries for additional processing. I'm not in any way an expert in network programming but I think you could find some guides that show you how to do this.