Maybe it could be not useful for you application, you can use glGetBufferParameteriv with argument GL_BUFFER_SIZE: it returns the number of bytes of the buffer object.
It's difficoult to say that this is the solution, since you should know the internal format of the buffer element (and indeed, its size in bytes), in order to have the number of elements composing the buffer object.
For sure, the best solution is to keep most information in a class representing the buffer object, but as I can understand from your question this is hard to implement.