digitalPinToPort() is in lib/targets/arduino/wiring.c but it doesn't appear to have a declaration in a .h file so is probably meant to be private. You will notice that it is a one line function. In the OneWire library the code needs to be accurate at the microsecond level and I found the normal digitalWrite() type calls to be a bit too inexact in timing so I went to the port and bit level like this...
extern "C" {
#include <avr/io.h>
}
... blah blah blah...
port = digital_pin_to_port[pin].port;
bit = digital_pin_to_port[pin].bit;
outputReg = port_to_output[port];
inputReg = port_to_input[port];
modeReg = port_to_mode[port];
... blah blah blah...
sbi( _SFR_IO8(modeReg), bit); // make pin an output
cbi( _SFR_IO8(outputReg), bit); // zero
... blah blah ...
cbi( _SFR_IO8(modeReg), bit); // set pin to be an input
r = (( _SFR_IO8(inputReg)>>bit) & 1);
You can see the whole gory mess at http://www.federated.com/~jim/onewire/ if you need.
You should be aware of the downside of this. Some pins get special handling in the digitalWrite() calls and such, specifically the TIMER* pins. If you hit one of these pins bad things will happen.