I have never heard of 'sodomy' or 'the crime against nature' as referring to masturbation or any other simply non-procreational sex acts. It refers specifically to anal sex. According to most dictionaries, it refers to bestiality, anal sex, OR oral sex (whether homosexual or heterosexual). See Merriam-Webster online (m-w.com) for an example.