There are four commands for obtaining simple state variables, and one for determining whether a particular state is enabled or disabled.
void glGetBooleanv(GLenum pname, GLboolean *params);
void glGetIntegerv(GLenum pname, GLint *params);
void glGetFloatv(GLenum pname, GLfloat *params);
void glGetDoublev(GLenum pname, GLdouble *params);
Obtains Boolean, integer, floating-point, or double-precision state variables. The pname argument is a symbolic constant indicating the state variable to return, and params is a pointer to an array of the indicated type in which to place the returned data. The possible values for pname are listed in the tables in "OpenGL State Variables." A type conversion is performed if necessary to return the desired variable as the requested data type.
GLboolean glIsEnabled(GLenum cap)
Returns GL_TRUE if the mode specified by cap is enabled; otherwise, returns GL_FALSE. The possible values for cap are listed in the tables in "OpenGL State Variables"
Other specialized commands return specific state variables. The prototypes for these commands are listed here; to find out when you need to use these commands, use the tables in "OpenGL State Variables" Also see the OpenGL Reference Manual. OpenGL's error handling facility and the glGetError() command are described in more detail in the next section.
OpenGL Programming Guide