Given an infinite cardinal $\kappa$, Goedel's function is a well-known bijection $p:\kappa^2$ onto $\kappa$. 

Is $p$ definable in the structure $<\kappa;\in>$? 

Is $p$ definable in a bigger 2nd order structure $<\kappa;\mathcal P(\kappa);\in>$?

It looks like any typical attempt to code something like this (even + on ordinals) somehow refers to a pairing function.